Skip to main content

Memorable Unique Identifier

Project description

muid

Memorable Unique Identifiers

Wait you say ... that's an oxymoron

Video explanation at https://vimeo.com/397352413

Memorable unique identifiers are a provocative misnomer because memorability is antithetical to uniqueness. MUIDs might be better termed "hash-memorable" identifiers: identifiers whose SHA-256 hashes are in part memorable.

Start mining now

Just want to mine?

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/microprediction/muid/master/examples/mine_from_venv.sh)"

If it fails you might need Python 3

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python

Using the library directly

As per https://muid.readthedocs.io/en/latest/ ...

Install

pip install muid

Hash-memorability

>>> muid.bhash(b'f601f291896bb66b8a3c3d783077713a')
b'56a33411a3ae7cfc95597911708358ad'

Don't see it?

>>> muid.pretty(b'56a33411a3ae7cfc95597911708358ad',k1=6,k2=5)
'Shammy Llama'

Create one MUID

>>> muid.create(difficulty=8, with_report=True)
[{'length': 8, 'pretty': 'Thof Clam', 'key': b'79f7faf8d1272b94eaac367972a09f7b', 'hash': b'760fc1a3368216b67a044e3d4da1fd85'}]

String version of hash

Use shash instead of bhash

>>> muid.shash('f601f291896bb66b8a3c3d783077713a')
56a33411a3ae7cfc95597911708358ad

Validation

>>> muid.animal(b'f601f291896bb66b8a3c3d783077713a')
'Shammy Llama'

>>> muid.validate(b'f601f291896bb66b8a3c3d783077713a')
True

Mining for multiple MUIDs

Runs forever and produces MUIDs of increasing length.

>>> muid.mine()

{'hash': b'56a33411a3ae7cfc95597911708358ad',
'key': b'f601f291896bb66b8a3c3d783077713a',
'length': 11,
'pretty': 'Shammy Llama'}

{'hash': b'6ea176470adcff53855f04181bca1a1b',
'key': b'fb74baf628d43892020d803614f91f29',
'length': 11,
'pretty': 'Healthy Toad'}

{'hash': b'a3e76457c0de70a153e82067845f1527',
'key': b'769adf0f307181e4ab2bc4c1b991cdc6',
'length': 11,
'pretty': 'Amethyst Cod'}

Bequeath unwanted MUIDs to a worthy statistician.

Applications

See the video at https://vimeo.com/397352413 for some motivation.

We hope you have an application that can benefit from one less join.

Implementation decisions

We welcome thoughtful suggestions at https://github.com/microprediction/muid/issues

Choice of hash

We truncate the output of hashlib.sha256 For example muid.shash('abe5') is equivalent to

sha256('abe5'.encode('ascii')).hexdigest()[:32]

Readable hex

Hex Human Hex HUman Hex Human
1 l 5 s 9 g
2 z 6 h 0 o
3 m 7 t
4 y 8 x

Miscellaneous

Collisions

MUID collision requires approximately the same computational capacity as UUID collision, or more. Thus unlikely to be an issue.

Stupid dog trick

https://vimeo.com/396819347

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muid-0.3.3.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

muid-0.3.3-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file muid-0.3.3.tar.gz.

File metadata

  • Download URL: muid-0.3.3.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for muid-0.3.3.tar.gz
Algorithm Hash digest
SHA256 b9cdc3aaf6e1b86804802ff2a8e7e9e0ca503f6c511044683b7f405e59b72fd0
MD5 69e5804297a4561af2ca302ab72c2881
BLAKE2b-256 d6eebb773be5da50b55caa745b52ae1c323df2afa1ecb20dcc180d392d2ee233

See more details on using hashes here.

File details

Details for the file muid-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: muid-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for muid-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c171163942cf892d92c01d12b4adabe34b6c99d3c0e5e7d69c9f20cbadd5f0e5
MD5 5f2a9402e7311abc0eb6b829288cd1a6
BLAKE2b-256 3f11a71b2c680771ca89bf9d7a947029918f4202c3d0a8a73fb3e71b57127b76

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page