0

md5計算アルゴリズムには関数があります

// decodes input (unsigned char) into output (uint4). Assumes len is a multiple of 4.
void MD5::decode(uint4 output[], const uint1 input[], size_type len)
{
   for (unsigned int i = 0, j = 0; j < len; i++, j += 4)
     output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) |
       (((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24);
}

なぜmemcpyでコピーしないのですか?マシンごとにバイトオーダーが異なる可能性があるためですか?

4

1 に答える 1

2

正しい、それはバイト順です。これは、リトルエンディアン システムでのそのままのコピーと同等ですが、ビッグ エンディアンでは最終的にバイトが逆になります。

于 2012-12-17T05:02:16.633 に答える