This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string GetOfflinePlayerUUID(string username) | |
{ | |
//new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name)); | |
byte[] rawresult = System.Security.Cryptography.MD5.Create().ComputeHash(Encoding.UTF8.GetBytes($"OfflinePlayer:{username}")); | |
//set the version to 3 -> Name based md5 hash | |
rawresult[6] = (byte)(rawresult[6] & 0x0f | 0x30); | |
//IETF variant | |
rawresult[8] = (byte)(rawresult[8] & 0x3f | 0x80); | |
//convert to string and remove any - if any | |
string finalresult = BitConverter.ToString(rawresult).Replace("-", ""); |