cocos2d-x 文件MD5校验(11)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-15 19:49 点击:次
p> for ( int i=0; i < nMD5Size; i++)
p> {
p> std::string Str;
p> if (lpszMD5[i] == 0)
p> {
p> Str = std::string("00");
p> }
p> else if (lpszMD5[i] <= 15)
p> {
p> char tmp[255]={0};
p> sprintf(tmp, "0%x",lpszMD5[i]);
p> Str =tmp;
p> }
p> else
p> {
p> char tmp[255]={0};
p> sprintf(tmp, "%x",lpszMD5[i]);
p> Str =tmp;
p> }
p>
p> ASSERT( Str.length() == 2 );
p> strMD5 += Str;
p> }
p> ASSERT( strMD5.length() == 32 );
p> return strMD5;
p>}
p>
p>
p>/*****************************************************************************************
p> FUNCTION: CMD5Checksum::Update
p> DETAILS: protected
p> DESCRIPTION: Implementation of main MD5 checksum algorithm
p> RETURNS: void
p> ARGUMENTS: BYTE* Input : input block
p> UINT nInputLen : length of input block
p> NOTES: Computes the partial MD5 checksum for 'nInputLen' bytes of data in 'Input'
p> *****************************************************************************************/
p>void CMD5Checksum::Update( BYTE* Input, ULONG nInputLen )
p>{
p> //Compute number of bytes mod 64
p> UINT nIndex = (UINT)((m_nCount[0] >> 3) & 0x3F);
p>
p> //Update number of bits
p> if ( ( m_nCount[0] += nInputLen << 3 ) < ( nInputLen << 3) )
p> {
p> m_nCount[1]++;
p> }
p> m_nCount[1] += (nInputLen >> 29);
p>
p> //Transform as many times as possible.
p> UINT i=0;
p> UINT nPartLen = 64 - nIndex;
p> if (nInputLen >= nPartLen)
p> {
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>