Lesson 54--Microduino MD5

From Microduino Wiki
Jump to: navigation, search


This course will show you the most common MD5(Message Digest Algorithm 5) and explain the correctness of encryption in Microduino.

MD5 Encryption


MD5 is a widely-used hash function in the field of computer safety, offering overall protection for information. The file number of the algorithm is RFC 1321. ( R.Rivest,MIT Laboratory for Computer Science and RSA Data Security Inc. April 1992)

Here is the brief introduction of MD5: MD5 handles the input information grouped in 512-bit and each group is divided into sixteen 32-bit group. After a series of processing, the output of the algorithm consists of four 32-bit groups which generates a 128-bit hash value after cascading.


Van oorschot and Wiener has considered to find brute-force hash function and they supposed a specially designed MD5 conflict searching machine can find a conflict every 24-day. But from the year of 1991 to 2001, there was no new algorithm that came to replace MD5. From that we can see, MD5 is not influenced in safety. All the defects cannot become the problem of MD5 in practical application. Besides, since MD5 algorithm needs no copyright cost to pay, it can also be treated as an excellent intermediate technology.


On August 17th, 2004, Chinese professor Xiaoyun Wang posted the decode of MD5, HAVAL-128, MD4 and RIPEMD algorithm in Crypto' 2004 in the US, announcing the decoding result of MD series algorithm. (Note: it was not really decode but accelerated hash collisions.)


  • Other Hardware Equipment
    • USB cable one
    • Breadboard jumpers one box


#include "MD5.h"
This is en example of how to use my MD5 library. It provides two
 easy-to-use methods, one for generating the MD5 hash, and the second
 one to generate the hex encoding of the hash, which is frequently used.
void setup()
  //initialize serial
  //give it a second
  //generate the MD5 hash for our string
  unsigned char* hash=MD5::make_hash("Hello Microduino");
  //generate the digest (hex encoding) of our hash
  char *md5str = MD5::make_digest(hash, 16);
  //print it on our serial monitor

  char* test="Hello Microduino";
  unsigned char* hash2=MD5::make_hash(test);
  md5str=MD5::make_digest((unsigned char*)hash2, 16);


void loop()


Step 1: Download the code and run it. If the compile goes wrong, it means you don't have local library of [ArduinoMD5]. After download and installation, you should restart IDE.

Step 2: Open serial communication and it will show two lines of ciphertext, just as follows:


The ciphertext is the text after “Hello Microduino” gets enciphered by MD5.

Step 3:

MicroduinoMD5 1.jpg

The result is consistent with the calculation result of the editor on the online MD5 website.


The text "Hello Microduino" is enciphered by MD5 algorithm, which is very hard to be changed to the previous one.