MD5算法中,为什么追加的是0x80?
最近在看MD5 算法,但是有一点儿很迷惑,就是RFC描述和附带的代码不太一样,麻烦懂的指点一下,有点儿晕RFC文档中:
Padding is performed as follows: a single "1" bit is appended to the
message, and then "0" bits are appended so that the length in bits of
the padded message becomes congruent to 448, modulo 512. In all, at
least one bit and at most 512 bits are appended.
而附带的代码中:
static unsigned char PADDING = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
0x80不是1啊,在这里很困惑,请大佬指点一下,谢谢~
0x80 = 128
二进制 10000000
congruent to 448, modulo 512
记录这64个中每一位是否被标记
pzx521521 发表于 2020-1-6 16:40
0x80 = 128
二进制 10000000
congruent to 448, modulo 512
多谢,明白了
页:
[1]