Skip to content

Instantly share code, notes, and snippets.

@jbeezley
Created November 15, 2019 19:26
Show Gist options
  • Save jbeezley/d9c2693bed925d15e67979996444c9d7 to your computer and use it in GitHub Desktop.
Save jbeezley/d9c2693bed925d15e67979996444c9d7 to your computer and use it in GitHub Desktop.
def int_to_uuid(id):
h = hex(int(id) << 65)[2:]
assert len(h) <= 32
for i in range(len(h), 32):
h = '0' + h
assert len(h) == 32
return h[:8] + '-' + h[8:12] + '-' + h[12:14]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment