MD5/Implementation: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: added syntax colouring the hard way)
Line 3,334: Line 3,334:
</lang>
</lang>


=={{header|Mathematica}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>md5[string_String] :=
<lang Mathematica>md5[string_String] :=
Module[{r = {7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17,
Module[{r = {7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17,
Line 3,363: Line 3,363:
FromDigits[
FromDigits[
Flatten[Reverse@IntegerDigits[#, 256, 4] & /@ {h0, h1, h2, h3}],
Flatten[Reverse@IntegerDigits[#, 256, 4] & /@ {h0, h1, h2, h3}],
256], 16, 32]]
256], 16, 32]]</lang>
</lang>
Example:
Example:
<lang Mathematica>md5["12345678901234567890123456789012345678901234567890123456789012345678901234567890"]</lang>
<lang Mathematica>md5["12345678901234567890123456789012345678901234567890123456789012345678901234567890"]</lang>