2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Don't use pnUtils for MD5 checksumming.

On the other hand, have we ever figured out exactly what this code is
supposed to do? Mark added it for something, but it's not really clear
what the purpose is.
This commit is contained in:
Darryl Pogue
2012-02-11 21:58:30 -08:00
parent 76a754f55a
commit f4878166d5

View File

@ -42,6 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pyAgeInfoStruct.h"
#include "hsStlUtils.h"
#include "pnUtils/pnUtCrypt.h"
#include "plEncryption/plChecksum.h"
///////////////////////////////////////////////////////////////////////////
@ -129,9 +130,23 @@ void pyAgeInfoStruct::SetAgeInstanceGuid( const char * guid )
// if it starts with an @ then do a meta kind of GUID
std::string curInst = fAgeInfo.GetAgeInstanceName();
std::string y = curInst + guid;
plUUID instanceGuid;
CryptDigest(kCryptMd5, instanceGuid.fData , y.length(), y.c_str());
plMD5Checksum hash;
hash.Start();
hash.AddTo(y.length(), (uint8_t*)y.c_str());
hash.Finish();
const char* md5sum = hash.GetAsHexString();
plStringStream ss;
for (size_t i = 0; i < 16; i++) {
ss << md5sum[2*i];
ss << md5sum[(2*i)+1];
if (i == 3 || i == 5 || i == 7 || i == 9)
ss << '-';
}
instanceGuid.FromString(ss.GetString());
fAgeInfo.SetAgeInstanceGuid(&instanceGuid);
}
else {