views:

248

answers:

3

I'm currently attempting to code one for part of a college project - binary/hex handling and cryptographic functions are well regarded in the mark scheme, so I thought I'd kill two birds with one stone.

However, the documentation availible on the algorithm itself is thorough but confusing. Is there a prexisting PHP libary/class that I could take a look at, or is there a step by step explanation of the algorithm, and the variables it uses (T and X especially) somewhere?

Thanks

A: 

Here's MD5 written in C. I don't know if it'll help, considering it's not PHP, but here it is: http://www.google.com/codesearch/p?hl=en&sa=N&cd=10&ct=rc#zd%5FoLGoxqmg/md5.c&q=function%20md5.c%20lang%3Ac

brianreavis
Thanks, but that's the one included in the official RCA. I've tried reading it but to be honest I don't understand much of it.
blake
+1  A: 

Wikipedia has a good write up of the algorithm (along with the valid reasons you should avoid it).

It also contains a full pseudocode example of its implementation.

jheddings
Thanks, the Wikipedia write-up seems pretty decent - I just hope it's correct ;)
blake
Yeah, as much as I use WP, I'd like to believe it's always accurate. In this case, that implementation looks good to me (but I haven't written an MD5 hasher in a while).
jheddings
+2  A: 

Get hold of a copy of Bruce Schneier's Applied Cryptography. Although the source code is in C, he does provide an excellent background to the design principles and theory behind the algorithm.

zebrabox