views:

117

answers:

2
+1  Q: 

Need MD5 guideline

Is there any specific algorithm for the encoding and decoding MD5. Kindly give me the proper direction or guideline, so that I can move on.. I have search a lot on Google but I haven't find, kindly give the articles or tutorial link.

+6  A: 

MD5 is a hashing algorithm, which by definition is (supposed to be) un-decodable. For a description of the algorithm, read Wikipedia.

However, you rarely need to implement the algorithm yourself because most platforms come with an implementation.

First google hit: http://sourceforge.net/projects/libmd5-rfc/

Matti Virkkunen
+1 for not implementing it yourself.
RichieHindle
I am working in ANSI C, is there any library in ANSI C for MD5??
Arman
+2  A: 

MD5, does not "encode" or "decode". MD5 transforms a variable-size input (up to many many terabytes) into a fixed-size output (128 bits, aka 16 bytes). The point of MD5 is to not allow the inverse transformation to be computed.

The MD5 specification is short, easy to read, and includes test vectors and a C implementation. Many programming languages/environments already include MD5 implementations. There are also many independent cryptographic libraries which offer MD5 implementations in various languages; you may want to have a look at sphlib which includes optimized code for MD5 in both C and Java.

Note, though, that MD5 is now considered to be cryptographically weak. In particular, ways have been found to efficiently compute collisions (two distinct inputs with the same output), something which a good hash function should not allow (collision necessarily exist for any hash function, but it should not be feasible to actually compute such collisions; for MD5 it is quite easy [about 14 seconds worth of CPU on a basic PC]).

Thomas Pornin
if MD5 can't inverse transform then what is the purpose of MD5? Only fixed the size? Where we can use MD5??
Arman
The point of a hash function (such as MD5) is to compute a one-way digest of the document, into a fixed-size format. This is the first step for computing digital signatures, or for many integrity-check procedures. MD5 is _not_ an encryption function.
Thomas Pornin