mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Add SDLTest lib support
This commit is contained in:
parent
1b2ba7b2d8
commit
1e8a0d6155
37
MiniEngine_Test.cpp
Normal file
37
MiniEngine_Test.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "MiniEngine_Test.h"
|
||||
#include <SDL2/SDL_test.h>
|
||||
#include <cstring>
|
||||
|
||||
namespace MiniEngine
|
||||
{
|
||||
|
||||
namespace Test
|
||||
{
|
||||
|
||||
void GetMD5Raw(unsigned char* buffer,unsigned int bufferLen,unsigned char* outbuff)
|
||||
{
|
||||
SDLTest_Md5Context ct;
|
||||
SDLTest_Md5Init(&ct);
|
||||
SDLTest_Md5Update(&ct,buffer,bufferLen);
|
||||
SDLTest_Md5Final(&ct);
|
||||
memcpy(outbuff,ct.digest,16);
|
||||
}
|
||||
|
||||
std::string GetMD5(unsigned char* buffer,unsigned int bufferLen)
|
||||
{
|
||||
unsigned char buff[16];
|
||||
char tmp[8];
|
||||
GetMD5Raw(buffer,bufferLen,buff);
|
||||
std::string str;
|
||||
for(int i=0;i<16;i++)
|
||||
{
|
||||
sprintf(tmp,"%02x",buff[i]);
|
||||
str.append(tmp);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
}/// End of namespace MiniEngine::Test
|
||||
|
||||
}/// End of namespace MiniEngine
|
15
MiniEngine_Test.h
Normal file
15
MiniEngine_Test.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace MiniEngine
|
||||
{
|
||||
|
||||
namespace Test
|
||||
{
|
||||
|
||||
std::string GetMD5(unsigned char* buffer,unsigned int bufferLen);
|
||||
void GetMD5Raw(unsigned char* buffer,unsigned int bufferLen,unsigned char* outbuff);
|
||||
|
||||
}/// End of namespace MiniEngine::Test
|
||||
|
||||
}/// End of namespace MiniEngine
|
Loading…
x
Reference in New Issue
Block a user