0.0
No commit activity in last 3 years
No release in over 3 years
Creates a mnemonic sequence of words representing an integer in a specified range.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Mnemonic Words

This ruby gem was inspired by the xkcd comic ("correct horse battery staple") on password strength:

http://xkcd.com/936/

If you believe lists of words are easier to remember than a long number or random string, why not represent numbers as lists of words? And while you're at it, you might as well do some error detection.

Sample Usage

$ irb
2.0.0dev :001 > mw = MnemonicWords.new(
2.0.0dev :002 >     (0..9999999999), # Specify valid range is ten digits
2.0.0dev :003 >     0.01             # Maximum chance of undetected error is <= 0.01
2.0.0dev :004?>   )
< n: 4, -log10(p): 3.489438330097295 >   # Will create 4-word representation with
                                         # probability of undetected error <= 10 ^ -3.48...
2.0.0dev :005 > mw.encode(4155551212)    # Encode a US phone number as a list of words
"muscle hesitate trust two"
2.0.0dev :006 > mw.decode("muscle hesitate trust two") # Decode into an integer
4155551212
2.0.0dev :007 > mw.decode("muscle hesitate two trust") # Introduce an error
nil                                  # If an error is detected, result is nil

Credits

Special thanks to Alan Blanchard, Jon Hamkins, and Clark Brooks for helping me think through the error detection stuff.

Donations

Bitcoin donation address: 1MWeioFdnwFZC8eqJwxjKcA3SErKxEBu8V