Just as the title says. I tried to strike a balance between code size and performance, which resulted in around 2KB of code and around 1750 bytes/s when hashing on a Commodore 64.
You will need cc65 (https://github.com/cc65/cc65) to build.
In order to calculate MD5 hash of a message:
- Call
_md5_init
. - Call
_md5_next_block
for every 64-byte block of the message, passing a pointer to beginning of the block in A/X (lo/hi) and size of the block in Y. Only the final's block size can be smaller than 64 bytes! - Call
_md5_finalize
. - Find computed MD5 hash in 16 bytes starting at
_md5_hash
.
See tests.s
for examples.
Currently messages of up to 2MiB are supported. This should not be a problem, but if the need arises, the limit can be increased easily.
Sure. Run make test
. If it fa
5D2F
ils, you optimized too much.
Yes. make md5.prg
and have fun benchmarking.
Milek Smyk (firstlast on gmail)