From f4878166d59095338835a7f4451c4fc76bb9fa4e Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 11 Feb 2012 21:58:30 -0800 Subject: [PATCH] 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. --- .../FeatureLib/pfPython/pyAgeInfoStruct.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp index 7620cdf4..938a9cac 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAgeInfoStruct.cpp @@ -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 {