summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-06-29 00:46:11 +0200
committerMattes D <github@xoft.cz>2014-06-29 00:46:11 +0200
commit1b89b997ffb81c38dbe27bc8719efb59a38e14a0 (patch)
treeeee8b1ce2cc05d7eea2d5e54fd3c3e33a8daf953 /src/ClientHandle.cpp
parentLikely fixed too quick food depletion (diff)
parentFixed a silly path error in #include. (diff)
downloadcuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.gz
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.bz2
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.lz
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.xz
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.zst
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index e7b876b24..95dfaffb2 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]
+ );
}