Skip to main content

Memorable Unique Identifier

Project description

muid

Memorable Unique Identifiers

Wait you say ... that's an oxymoron

Memorable unique identifiers are a provocative misnomer. When generating unique identifiers such as privately used keys, memorability is antithetical to uniqueness. MUIDs might be better termed "hash-memorable" identifiers. They form a subset of UUIDs whose SHA-256 hashes are memorable.

Start mining now

Just want to mine? Run this bash script.

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

The script will explain itself and the motivation, as it mines. If it doesn't work then maybe try

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

although we'd rather not get into a debate about the "best" way to install Python on a mac.

Sponsor a statistician

If you find a spirit animal of length 13 or more you can make the day of someone looking to enter a worldwide statistics contest, to be announced Apr 1st, 2020. The clock is ticking.

Using the library directly

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

Install

pip install muid

MUIDs are just like UUIDs (uuid.uuid4)

import muid
key  = muid.muid4(min_len=8)  

Only they take much, much longer to generate because ...

... the SHA-256 hash is memorable

Try this:

print( muid.mhash(key) )    

Don't see it yet? Look closer. Here's an example I just happenned to have lying around:

f01dab1eca70403aa0c700f6c29596c4

This reads a bit like:

Foldable Cat  

Mining

It is trivial to mine for MUIDs.

muid.mine()

At time of writing, mining MUIDs is roughly one order of magnitude more profitable than mining bitcoin even if you use this lousy library to do your mining. With a little work, you should be able to mine with 100x the economics of bitcoin ... at least for a while!

Caching in

There is a bid for MUIDs of len at least min_len where:

min_len = int(requests.get("http://www.microprediction.com/config.json").json()['min_len'])

More details on that soon.

An example of the use of MUIDs

We hope you have your own uses and would love to hear about them. Many applications can benefit from one less join.

Implementation decisions

We welcome thoughtful suggestions at https://github.com/microprediction/muid/issues or https://algorithmia.com/algorithms/microprediction/mverify/discussion.

Choice of hash

muid.mhash() 

Uses SHA-256 hash from hashlib.sha256

Readable hex

Hex strings are just a,b,e,d,e,f plus digits and hyphens, which makes for a sucky game of scrabble. We introduce readable hex as follows:

word.replace('0', 'o').replace('1', 'l').replace('2', 'z').replace('3', 'm').replace('4', 'y').replace(
    '5', 's').replace('6', 'h').replace('7', 't').replace('8', 'x').replace('9', 'g')

which is to say

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

with a,b,c,d,e,f unchanged of course.

Collisions (forgettaboutit)

It is well appreciated that approximately 2.71 quintillion uuid4() can be generated before the risk of collision exceeds fifty percent (Wikipedia). Thus UUID collisions are a non-issue. But since an MUID collision requires an underlying collision in UUIDs which are generated while mining, a moment's reflection should convince the reader that the computational capacity required to create MUID collisions over any interval of time is at least as large as the computational capacity employed to create UUID collisions. In short, the thing to worry about is the relatively short supply of MUIDs (an obvious limitation) not collisions between them.

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.2.8.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

muid-0.2.8-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: muid-0.2.8.tar.gz
  • Upload date:
  • Size: 14.7 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.2.8.tar.gz
Algorithm Hash digest
SHA256 351dc3e60063c6de26810daba836e98377e2271cbf5c48a6ff6c576b16ec77f3
MD5 d9afe67c5b5501f2e2f15939741c7d15
BLAKE2b-256 027209c4f5e5f340d23fc11c321225af18a22cce1269eefe221ea2f25a74b427

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muid-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 18.7 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.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 dd1c467eaebdde617016f15d88b263d5a13abb4d302a6c9fe8e7f453e551aa43
MD5 a0f282f40ead596ece04c975a967736f
BLAKE2b-256 0aa29ab9e3814e991ee0156e6337116d58240388ca4cf37b67efee2011c61ef2

See more details on using hashes here.

Supported by

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