Function Request: MD5
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Sungam

Does anyone feel like whipping together a function to create an MD5 hash from a string? Or pointing me in the direction of some explanation of how to do it?
I'd very much like such a function, myself, and can think of several other uses for it... but I have absolutely no clue how it works.

Posted on 2004-11-07 09:56:18

RageCage

what is a MD5 hash?

Posted on 2004-11-07 20:12:18

Omni

I second that question. Because I'm too lazy to use Google.

Posted on 2004-11-07 21:14:41

Kildorf

An MD5 hash is a 32-byte (if I recall) string that you get by running an arbitrary amount of data through an MD5 hashing algorithm. It's not a reversible algorithm, but it is reproducible... the same chunk of data will always produce the same MD5 hash, but you can't get that data out of the hash.

It's used for storing passwords (so a cursory glance at a passwd file won't give you everyone's passwords) and things like getting unique IDs for server sessions and so on.

It's complicated, but this seems like a pretty good step-by-step. I'd write it myself, but I'd rather concentrate my my limited time elsewhere at the moment (it doesn't look entirely trivial to implement). Hopefully, though, this'll help someone on their way to making it. It would be a useful library, no doubt. :)

Posted on 2004-11-07 21:29:43

Sungam

Exactly, Kildorf. Thanks for the link. I'll see if I can figure it out.

An MD5 hash is basically (as I understand it - I only use the stuff :p) a form of encryption that cannot be decrypted. It doesn't hold the original data, but rather a 'fingerprint' of it, which is nearly unique.

It has many uses, most commonly for passwords, as Kildorf said. Rather than retrieving an encrypted password, decrypting it and then comparing to what the user entered (which is an obvious security risk), you'd just MD5 the entered password and compare it with the encrypted, and if they match, you're good to go.
Another excellent use for it is as a checksum. If you want to ensure that a file has not been altered, run an MD5 on the content you expect to be in the file and then check that before using it. Even the tiniest changes in any file are almost certain to show up as a different MD5 hash. SNES (and probably other consoles) ROMs use this for checking if it is a good dump or not. Linux distributions also commonly come with an MD5 checking tool.

/rant off.



EDIT: Eh... Just took a look at that link, and my brain started boiling around the second paragraph...
I'll keep trying to figure it out, but for the record, I'm still very interested if anyone else wanted to give it a shot ;)

Posted on 2004-11-08 01:34:23 (last edited on 2004-11-08 01:41:00)


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.