cocos2d-x 文件MD5校验(7)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-15 19:49 点击:次
p> //ASSERT( AfxIsValidAddress(Input, nLength, FALSE) );
p>
p> //initialisations
p> UINT i=0; //index to Output array
p> UINT j=0; //index to Input array
p>
p> //transfer the data by shifting and copying
p> for ( ; j < nLength; i++, j += 4)
p> {
p> Output[i] = (ULONG)Input[j] |
p> (ULONG)Input[j+1] << 8 |
p> (ULONG)Input[j+2] << 16 |
p> (ULONG)Input[j+3] << 24;
p> }
p>}
p>
p>/*****************************************************************************************
p> FUNCTION: CMD5Checksum::Transform
p> DETAILS: protected
p> DESCRIPTION: MD5 basic transformation algorithm; transforms 'm_lMD5'
p> RETURNS: void
p> ARGUMENTS: BYTE Block[64]
p> NOTES: An MD5 checksum is calculated by four rounds of 'Transformation'.
p> The MD5 checksum currently held in m_lMD5 is merged by the
p> transformation process with data passed in 'Block'.
p> *****************************************************************************************/
p>void CMD5Checksum::Transform(BYTE Block[64])
p>{
p> //initialise local data with current checksum
p> ULONG a = m_lMD5[0];
p> ULONG b = m_lMD5[1];
p> ULONG c = m_lMD5[2];
p> ULONG d = m_lMD5[3];
p>
p> //copy BYTES from input 'Block' to an array of ULONGS 'X'
p> ULONG X[16];
p> ByteToDWord( X, Block, 64 );
p>
p> //Perform Round 1 of the transformation
p> FF (a, b, c, d, X[ 0], MD5_S11, MD5_T01);
p> FF (d, a, b, c, X[ 1], MD5_S12, MD5_T02);
p> FF (c, d, a, b, X[ 2], MD5_S13, MD5_T03);
p> FF (b, c, d, a, X[ 3], MD5_S14, MD5_T04);
p> FF (a, b, c, d, X[ 4], MD5_S11, MD5_T05);
p> FF (d, a, b, c, X[ 5], MD5_S12, MD5_T06);
p> FF (c, d, a, b, X[ 6], MD5_S13, MD5_T07);
p> FF (b, c, d, a, X[ 7], MD5_S14, MD5_T08);
p> FF (a, b, c, d, X[ 8], MD5_S11, MD5_T09);
p> FF (d, a, b, c, X[ 9], MD5_S12, MD5_T10);
p> FF (c, d, a, b, X[10], MD5_S13, MD5_T11);
p> FF (b, c, d, a, X[11], MD5_S14, MD5_T12);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>