Skip to content

Instantly share code, notes, and snippets.

@bugshake bugshake/ReadableID
Created Feb 22, 2017

What would you like to do?
Translate a unique ID into something human readable/recognizable/discernable
public static class ReadableID
static readonly string[] syllables = new string[256];
public static void initOnce()
string[] consonants = new string[] { "b", "br", "c", "ch", "d", "f", "fr", "g", "h", "j", "k", "kn", "l", "m", "n", "p", "pr", "qu", "r", "s", "st", "sl", "sc", "t", "tr", "v", "w", "x", "z" };
string[] vowels = new string[] { "a", "e", "i", "o", "u", "y", "ae", "ee", "ea", "ai" };
for (int i = 0; i < syllables.Length; ++i)
syllables[i] = consonants[i % consonants.Length] + vowels[i / consonants.Length];
public static string makeReadable(uint ID)
// NOTE: hash ID through something like Deadbeef32 (
// to get more diverse words
return string.Format("{0}{1}{2}{3}",
syllables[ID >> 24],
syllables[(ID >> 16) & 0xFF],
syllables[(ID >> 8) & 0xFF],
syllables[ID & 0xFF]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.