cocos2d-x 文件MD5校验(12)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-15 19:49 点击:次
p> memcpy( &m_lpszBuffer[nIndex], Input, nPartLen );
p> Transform( m_lpszBuffer );
p> for (i = nPartLen; i + 63 < nInputLen; i += 64)
p> {
p> Transform( &Input[i] );
p> }
p> nIndex = 0;
p> }
p> else
p> {
p> i = 0;
p> }
p>
p> // Buffer remaining input
p> memcpy( &m_lpszBuffer[nIndex], &Input[i], nInputLen-i);
p>}
p>
p>
p>
p>std::string CMD5Checksum::GetMD5OfString(std::string strString)
p>{
p> CMD5Checksum MD5Checksum; //checksum object
p> int nLength = strString.length(); //number of bytes read from the file
p> //const int nBufferSize = 1024; //checksum the file in blocks of 1024 bytes
p> BYTE *Buffer; //buffer for data read from the file
p> Buffer=(BYTE*)(strString.c_str());
p> //checksum the file in blocks of 1024 bytes
p> //while ((nLength = File.Read( Buffer, nBufferSize )) > 0 )
p> //{
p> MD5Checksum.Update( Buffer, nLength );
p> //}
p> //finalise the checksum and return it
p> return MD5Checksum.Final();
p>}
p>
p>使用方法
p>[cpp]
p>std::string pszPath = CCFileUtils::sharedFileUtils()->getWritablePath()+"data.zip";
p> std::string strFileMD5 = CMD5Checksum::GetMD5(pszPath);
p>
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 进入详细评论页>>
您可能感兴趣的文章
- wince5.0 eVC中实现CCheckListBox,Listbox中带复选框的
- cocos2d-x通过build_natice.sh编译成android时不用每次更
- PhoneGap API中文帮助文档——Compass(罗盘)
- cocos2d的下载
- 拓展训练:突破自己,提升自己
- PhoneGap API中文帮助文档——Events(事件)
- [Cocos2d-x游戏引擎开发笔记]在ubuntu上将游戏发布到
- cocos2dx 3.2 裁剪节点 ClippingNode
- Cocos2dx游戏开发系列笔记19:vs2013下开发cocos2dx3
- Cocos2d-x-2.2.1如何创建工程,以及如何将工程独立