forked from zacharyvoase/humanhash
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
198 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
*.egg-info/ | ||
*.pyc | ||
*.pyo | ||
.coverage | ||
.DS_Store | ||
MANIFEST | ||
build/ | ||
dist/ | ||
htmlcov/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- "2.7" | ||
# Coverage doesn't support Python 3.2 | ||
- "3.3" | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" | ||
install: pip install coverage coveralls flake8 | ||
script: | ||
- flake8 humanhash.py | ||
- coverage run humanhash.py | ||
after_script: | ||
- coverage report | ||
- coverage combine | ||
- coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include humanhash.py | ||
include README.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
humanhash | ||
========= | ||
|
||
humanhash provides human-readable representations of digests. | ||
|
||
.. image:: https://img.shields.io/travis/blag/humanhash.svg | ||
:target: https://travis-ci.org/blag/humanhash | ||
|
||
.. image:: https://img.shields.io/coveralls/blag/humanhash.svg | ||
:target: https://coveralls.io/github/blag/humanhash | ||
|
||
.. image:: https://img.shields.io/pypi/v/humanhash3.svg | ||
:target: https://pypi.python.org/pypi/humanhash3 | ||
|
||
.. image:: https://img.shields.io/pypi/l/humanhash3.svg | ||
:target: https://github.com/blag/humanhash/blob/master/UNLICENSE | ||
|
||
.. image:: https://img.shields.io/pypi/pyversions/humanhash3.svg | ||
:target: https://github.com/blag/humanhash/blob/master/.travis.yml | ||
|
||
Example | ||
------- | ||
|
||
.. code-block:: python | ||
>>> import humanhash | ||
>>> digest = '7528880a986c40e78c38115e640da2a1' | ||
>>> humanhash.humanize(digest) | ||
'three-georgia-xray-jig' | ||
>>> humanhash.humanize(digest, words=6) | ||
'high-mango-white-oregon-purple-charlie' | ||
>>> humanhash.uuid() | ||
('potato-oranges-william-friend', '9d2278759ae24698b1345525bd53358b') | ||
Caveats | ||
------- | ||
|
||
Don’t store the humanhash output, as its statistical uniqueness is only | ||
around 1 in 4.3 billion. Its intended use is as a human-readable (and, | ||
most importantly, **memorable**) representation of a longer digest, | ||
unique enough for display in a user interface, where a user may need to | ||
remember or verbally communicate the identity of a hash, without having | ||
to remember a 40-character hexadecimal sequence. Nevertheless, you | ||
should keep original digests around, then pass them through | ||
``humanize()`` only as you’re displaying them. | ||
|
||
How It Works | ||
------------ | ||
|
||
The procedure for generating a humanhash involves compressing the input | ||
to a fixed length (default: 4 bytes), then mapping each of these bytes | ||
to a word in a pre-defined wordlist (a default wordlist is supplied with | ||
the library). This algorithm is consistent, so the same input, given the | ||
same wordlist, will always give the same output. You can also use your | ||
own wordlist, and specify a different number of words for output. | ||
|
||
Inspiration | ||
----------- | ||
|
||
- `Chroma-Hash`_ - A human-viewable representation of a hash (albeit not | ||
one that can be output on a terminal, or shouted down a hallway). | ||
- `The NATO Phonetic Alphabet`_ - A great example of the trade-off | ||
between clarity of human communication and byte-wise efficiency of | ||
representation. | ||
|
||
.. _Chroma-Hash: http://mattt.github.com/Chroma-Hash/ | ||
.. _The NATO Phonetic Alphabet: http://en.wikipedia.org/wiki/NATO_phonetic_alphabet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,38 @@ | |
|
||
from distutils.core import setup | ||
|
||
with open('README.rst', 'r') as f: | ||
long_description = f.read() | ||
|
||
setup( | ||
name='humanhash', | ||
version='0.0.1', | ||
name='humanhash3', | ||
version='0.0.5', | ||
description='Human-readable representations of digests.', | ||
long_description=long_description, | ||
author='Zachary Voase', | ||
author_email='[email protected]', | ||
url='http://github.com/zacharyvoase/humanhash', | ||
url='https://github.com/blag/humanhash', | ||
py_modules=['humanhash'], | ||
license='Public Domain', | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: End Users/Desktop', | ||
'Topic :: Security', | ||
'Topic :: Utilities', | ||
|
||
# Pick your license as you wish (should match "license" above) | ||
'License :: Public Domain', | ||
|
||
# Specify the Python versions you support here. In particular, ensure | ||
# that you indicate whether you support Python 2, Python 3 or both. | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
# 'Programming Language :: Python :: 3.2', # Not tested | ||
'Programming Language :: Python :: 3.3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
], | ||
) |