

* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
* MS .NET adaption by tsc@sutor.ws 01/2004


* Configurable variables. You may need to tweak these to be compatible with
* the server-side, but the defaults work in most cases.










* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
















* Perform a simple self-test to see if the VM is working


}


* Calculate the MD5 of an array of little-endian words, and a bit length




x[len
x[(((len


a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
d
c
b
a
b
c
d
}
}


* These functions implement the four basic operations the algorithm uses.


}


}


}


}


}


* Calculate the HMAC-MD5, of a key and some data




ipad[i]
opad[i]
}
}


* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.


}


* Bitwise rotate a 32-bit number to the left.


}


* Convert a string to an array of little-endian words
* If chrsz is ASCII, characters >255 have their hi-byte silently ignored.


bin[i
}


* Convert an array of little-endian words to a string


str
}


* Convert an array of little-endian words to a hex string.




str
hex_tab.charAt((binarray[i
}
}


* Convert an array of little-endian words to a base-64 string






}
}
}


* Convert an array of little-endian words to a ms hex string.




str
hex_tab.charAt((binarray[i
}
}