Task

Encode a string using an MD5 algorithm.   The algorithm can be found on   Wikipedia.



Optionally, validate your implementation by running all of the test values in   IETF RFC (1321)   for MD5.

Additionally,   RFC 1321   provides more precise information on the algorithm than the Wikipedia article.



 Warning:   MD5 has known weaknesses, including collisions and forged signatures.   Users may consider a stronger alternative when doing production-grade cryptography, such as SHA-256 (from the SHA-2 family), or the upcoming SHA-3.

If the solution on this page is a library solution, see   MD5/Implementation   for an implementation from scratch.




include ffl/md5.fs
 
\ Create a MD5 variable md1 in the dictionary
 
md5-create md1
 
\ Update the variable with data
 
s" The quick brown fox jumps over the lazy dog" md1 md5-update
 
\ Finish the MD5 calculation resulting in four unsigned 32 bit words
\ on the stack representing the hash value
 
md1 md5-finish
 
\ Convert the hash value to a hex string and print it
 
md5+to-string type cr