Implementing MD5 using PIC16F84
i’ve search around google to find acticles on how to implement MD5 hash function in a microcontroller such PIC16F84 but results nothing. Just for for the sake of curiosity, suddenly i code MD5 algorithm into PIC16F84 assembly language. During debugging process. i dealt much with “big endian” and “little endian” format which is confusing
. Finally i’ve done everything properly. I compared hash of “abc” string using DAMN Hash Calculator and using MPLAB simulator and got the same hash. It was amazing. I also simulate the code using Oshon Soft “PIC Simulator IDE” which gives me the same result as well. Big thanks to oshon soft, your shareware program helps me much.
To implement all of this i used approximately 900 bytes of PIC16F84 program memory. I have not optimize this code, please let me know if you have any other algorithm which is faster than the original one. Now I am currently trying to implement SHA1 or SHA160 using AT89S52 microcontroller. Hopefully someday i will implement all of hashing function on microcontroller.
I have modified the original code of this. The original code requires 20.45 ms to compute hash, however the modified one just takes 15.99 ms which is 4.4 ms faster.
Here some screenshot, i took it from damn hash calculator, MPLAB and PIC Simulator IDE.
Damn Hash Calculator
MPLAB Simulator 5.20
Oshon Soft PIC Simulator IDE
RELATED STUFF
Downloads:
Source Code v1.0
Source Code v1.1
PIC16F84 Datasheet
Mid-Range Reference Manual
References:
MD5
Ronald Rivest
RFC1321
Official Website:
- Microchip
- Ronald Rivest
- RSA Security
- PIC IDE Simulator






