MD5 算法实现

MD5 算法的标准文件见 RFC1321。这里说一下具体实现时,应该注意的地方。

LSB 和 MSB

其实,在官方文档中已经提到过这个,但是没注意,现把它摘抄如下:

In this document a “word” is a 32-bit quantity and a “byte” is an eight-bit quantity. A sequence of bits can be interpreted in a natural manner as a sequence of bytes, where each consecutive group of eight bits is interpreted as a byte with the high-order (most significant) bit of each byte listed first. Similarly, a sequence of bytes can be interpreted as a sequence of 32-bit words, where each consecutive group of four bytes is interpreted as a word with the low-order (least significant) byte given first.

阅读全文