i found this code years ago somewhere on the net and "ported" it to Ext...as it wasnt Part of the existing crypto Plugin that only contains SHA-1 (yes, i know SHA-1 is more secure because of 160-Bit instead of 128-Bit with MD5, but as MD5 is furthermore used in many applications and i needed it for my old and current projects, i hope this is useful for someone else also)
It works exactly like the PHP function md5()
[UPDATE 2008/03/20]
- added optional parameters for raw binary output of a 16 letter binary string instead of the 32 Bit hex-string
- moved the hexcase parameter as optional parameters to the function call (default to false=> lowercase)
- moved the charset parameter as optional parameters to the function call (default to 8=> ASCII)
- passes the jslint test now
Usage:
string Ext.util.MD5 ( string str [, bool raw_output ][, bool hexcase ][, number charset {8(ASCII):16(UNICODE)} ] )
[code]
var MD5Hash = Ext.util.MD5("testtext"); //returns 0ea2d99c9848117666c38abce16bb43e
var MD5Hash = Ext.util.MD5("testtext",false,true); //returns 0EA2D99C9848117666C38ABCE16BB43E
var MD5Hash = Ext.util.MD5("testtext",true); //returns binary string
Parts of this work are based upon work by "RSA Data Security, Inc. MD5 Message-Digest Algorithm"