diff options
author | Mattes D <github@xoft.cz> | 2014-06-27 19:34:53 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-06-27 19:34:53 +0200 |
commit | 563f706422554d1d8ff1121b9613ab9d34951a3b (patch) | |
tree | 3823d1dd610fafeedea79125706b56cd7b21c9a2 /src/ClientHandle.cpp | |
parent | CMake: pthread is used only on Unix. (diff) | |
download | cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.gz cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.bz2 cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.lz cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.xz cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.zst cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.zip |
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r-- | src/ClientHandle.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 46083a8f1..611995148 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -30,7 +30,7 @@ #include "CompositeChat.h" #include "Items/ItemSword.h" -#include "md5/md5.h" +#include "polarssl/md5.h" @@ -239,18 +239,14 @@ AString cClientHandle::GenerateOfflineUUID(const AString & a_Username) // xxxxxxxx-xxxx-3xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, A, or B // Generate an md5 checksum, and use it as base for the ID: - MD5 Checksum(a_Username); - AString UUID = Checksum.hexdigest(); - UUID[12] = '3'; // Version 3 UUID - UUID[16] = '8'; // Variant 1 UUID - - // Now the digest doesn't have the UUID slashes, but the client requires them, so add them into the appropriate positions: - UUID.insert(8, "-"); - UUID.insert(13, "-"); - UUID.insert(18, "-"); - UUID.insert(23, "-"); - - return UUID; + unsigned char MD5[16]; + md5((const unsigned char *)a_Username.c_str(), a_Username.length(), MD5); + return Printf("%02x%02x%02x%02x-%02x%02x-3%01x%02x-8%01x%02x-%02x%02x%02x%02x%02x%02x", + MD5[0], MD5[1], MD5[2], MD5[3], + MD5[4], MD5[5], MD5[6], MD5[7], + MD5[8], MD5[9], MD5[10], MD5[11], + MD5[12], MD5[13], MD5[14], MD5[15] + ); } |