diff options
author | Mattes D <github@xoft.cz> | 2014-08-01 22:35:12 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-08-01 22:35:12 +0200 |
commit | 941a182d8a8a210bb6400cc6b2750a06b5f6c038 (patch) | |
tree | 82dfee0f38536020345a820c84ff2c4f01c3213b /src/ClientHandle.cpp | |
parent | Merge pull request #1273 from Howaner/GlobalFixes (diff) | |
parent | Merged branch 'master' into NameToUUID. (diff) | |
download | cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.gz cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.bz2 cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.lz cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.xz cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.zst cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.zip |
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r-- | src/ClientHandle.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 7bac41062..d71c6a9d8 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -234,13 +234,14 @@ AString cClientHandle::GenerateOfflineUUID(const AString & a_Username) // This guarantees that they will never collide with an online UUID and can be distinguished. // Proper format for a version 3 UUID is: // xxxxxxxx-xxxx-3xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, A, or B + // Note that we generate a short UUID (without the dashes) // Generate an md5 checksum, and use it as base for the ID: unsigned char MD5[16]; md5((const unsigned char *)a_Username.c_str(), a_Username.length(), MD5); MD5[6] &= 0x0f; // Need to trim to 4 bits only... MD5[8] &= 0x0f; // ... otherwise %01x overflows into two chars - return Printf("%02x%02x%02x%02x-%02x%02x-3%01x%02x-8%01x%02x-%02x%02x%02x%02x%02x%02x", + return Printf("%02x%02x%02x%02x%02x%02x3%01x%02x8%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], |