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>
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 进入详细评论页>>
您可能感兴趣的文章
- Cocos2d-x初学指南(5): Tiled Map的使用(视角移动,碰
- [C/OC的那点事儿]Objective-C实现学生成绩管理系统
- [cocos2d-x IOS游戏开发]2014年开发及学习计划:coc
- Cocos2d-x教程(17)-Box2D 物理引擎
- cocos2d-x学习笔记(5)-- CCScene场景的切换
- cocos2d-x3.0 ListView
- cocos2dx图片适配不同机型
- cocos2dxHellowoed 发现 2.2.3
- Cocos2dx 3.0 过渡篇(二十五)死不了的贪食蛇(触摸
- Cocos2d-x MultipleTouch & CCControllButton'

![cocos2d_x+lua[2]](/uploads/allimg/131030/110J64609-0-lp.jpg)








