This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MD5 or other hash for 8051?

Hi all,

A little background:
I've cobbled together a firmware-updating boot loader for an 8051-based board from application notes. The firmware can receive a firmware image in 128-byte blocks over uart. Each of the blocks is CRC16 checked and this all works great. Now, to be doubly sure, I was thinking I should hash the entire file at the end of receiving the blocks and verify before flashing.

I was looking at MD5 for hashing the file and have found source for it. Unfortunately, when I implement it, I get incorrect hashes/results. I presume the problem is a combination of endian differences and 'int' sizes being different. Even after attempting to correct that, my results are incorrect.
I've noticed a few threads mentioning a Graham Cole that ported md5 in a nice compact (and working!) way, but I can't find any source for that solution, I presume he can't be contacted anymore (some people mentioned they tried).

On to my question(s):

1) does anyone have a version of md5 ported for 8051? Or Graham Cole's solution?
2) Is md5 a good fit for what I'm trying to do?
3) OR- I being overly paranoid? Is the CRC16 of each block (and numbering the blocks for order) good enough?