Skip to content

Instantly share code, notes, and snippets.

@Silvenga
Created May 31, 2016 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Silvenga/54d72dc00a446a7d1c3f41f57caa6c35 to your computer and use it in GitHub Desktop.
Save Silvenga/54d72dc00a446a7d1c3f41f57caa6c35 to your computer and use it in GitHub Desktop.
Convert from GUID to UUID
var guid = Guid.Parse("10a5be07-e2ba-46fa-bb18-273f77dc39f0");
var b = guid.ToByteArray();
var mirror = guid.ToByteArray();
b[0] = mirror[3];
b[1] = mirror[2];
b[2] = mirror[1];
b[3] = mirror[0];
b[4] = mirror[5];
b[5] = mirror[4];
b[6] = mirror[7];
b[7] = mirror[6];
foreach (var byt in b)
{
Console.Write("{0:X2}", byt);
}
Console.WriteLine();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment