Skip to content

Instantly share code, notes, and snippets.

@frankvilhelmsen
Created August 12, 2015 13:14
Show Gist options
  • Save frankvilhelmsen/c1c4deef778f9c2882a8 to your computer and use it in GitHub Desktop.
Save frankvilhelmsen/c1c4deef778f9c2882a8 to your computer and use it in GitHub Desktop.
uuid-short-prefixed
UUID uuid = UUID.randomUUID()
String partone = ""+ Long.toString(uuid.getMostSignificantBits(), 36)
String parttow = ""+ Long.toString(uuid.getLeastSignificantBits(), 36)
String k = "PREFIX$partone$parttow".replace("-", "")
String l = k.length()
println "UUID short version ($l) : $k"
@frankvilhelmsen
Copy link
Author

UUID short version (31) : PREFIXkrfa04jbis5b16aj3psyqcnln

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment