11 lines
599 B
Plaintext
11 lines
599 B
Plaintext
procedure main() # validate against the RFC test strings and more
|
|
testMD5("The quick brown fox jumps over the lazy dog", 16r9e107d9d372bb6826bd81d3542a419d6)
|
|
testMD5("The quick brown fox jumps over the lazy dog.", 16re4d909c290d0fb1ca068ffaddf22cbd0)
|
|
testMD5("", 16rd41d8cd98f00b204e9800998ecf8427e)
|
|
end
|
|
|
|
procedure testMD5(s,rh) # compute the MD5 hash and compare it to reference value
|
|
write("Message(length=",*s,") = ",image(s))
|
|
write("Digest = ",hexstring(h := MD5(s)),if h = rh then " matches reference hash" else (" does not match reference hash = " || hexstring(rh)),"\n")
|
|
end
|