Here MD5 algorithm is explained :
http://en.wikipedia.org/wiki/Md5#Algorithm