- Do some arithmetic on the thingy, represented as an integer to make a probably-unique identifier
- Universally unique identifier
herein is proposed ULID:
- 128-bit compatibility with UUID
- 1.21e+24 unique ULIDs per millisecond
- Lexicographically sortable!
- Canonically encoded as a 26 character string, as opposed to the 36 character UUID
- Uses Crockford’s base32 for better efficiency and readability (5 bits per character)
- Case insensitive
- No special characters (URL safe)
- Monotonic sort order (correctly detects and handles the same millisecond)
In general what would help the humans would be if IDs were not only unique, but were also that are readable, spellable, and pronounceable and just generally convenient for a human to use — as well as being a reasonably efficient information encoding. We therefore propose PRO-nouncable QUINT-uplets of alternating unambiguous consonants and vowels, or “proquints”, as the solution.
There is only so much Shannon entropy you can get by pushing air through flapping organs originally purposed for eating and breathing. We assume it best to re-use the method to which natural language has already converged.
- python library used by some respectable projects; a good choice I suppose?
shortuuidis a simple python library that generates concise, unambiguous, URL-safe UUIDs.
Often, one needs to use non-sequential IDs in places where users will see them, but the IDs must be as concise and easy to use as possible. `shortuuid`` solves this problem by generating uuids using Python’s built-in uuid module and then translating them to base57 using lowercase and uppercase letters and digits, and removing similar-looking characters such as l, 1, I, O and 0.
You would invoke that as
# Generate a random mnemonic using crypto.randomBytes mnemonic = bip39.generateMnemonic() # strength defaults to 128 bits 'seed sock milk update focus rotate barely fade car face mechanic mercy'
MUID, the memorable unique id system has a whiff more cryptography about it. Names are expensive to generate, so you use this where you wish to constrain supply.
Weissman, Gerald, and Gerald Weissmann. 2007. “Giving Things Their Proper Names: Carl Linnaeus and W. H. Auden.” FASEB Journal : Official Publication of the Federation of American Societies for Experimental Biology 21 (June): 1285–9. https://doi.org/10.1096/fj.07-0501ufm.