MD5/Implementation: Difference between revisions

Content added Content deleted
Line 862: Line 862:
[A, B, C, D] =
[A, B, C, D] =
[D, B + lrot(A + F + K[i] + (M[x + (g & 15)] ? 0), s[i]), B, C]
[D, B + lrot(A + F + K[i] + (M[x + g % 16] ? 0), s[i]), B, C]
a0 += A
a0 += A
Line 876: Line 876:
</lang>
</lang>


This implementation is more focused towards brevity rather than speed. Use a javascript MD5 implementation if speed is desired.
This implementation is more focused towards brevity rather than speed. Use a javascript MD5 implementation if speed is desired. Fork this code [https://gist.github.com/Higgs1/08ec61fbb250c1c92151 on github].


Note: this only works on byte strings. To use arbitrary Javascript strings, you must first encode as UTF-8.
Note: this only works on byte strings. To use arbitrary Javascript strings, you must first encode as UTF-8.