Skip to content

A simple hashing library designed to create easy (for humans) to remember hash values

Notifications You must be signed in to change notification settings

dev-null-matt/babble

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babble

A simple hashing library designed to create easy (for humans) to remember hash values

Usage

Babble hash creates a hash value that is optimized for humans to remember the generated value. The hash value consists of common English dictionary words and a short string of digits.

BabbleHash bh = new BabbleHash()

bh.hash("[email protected]") // output is "ForestCloud03264"

Custom Libraries

Babble by default tries to create an inoffensive hash value by using a curated dictionary of words. If you want to use a different dictionary of words, you can load a custom dictionary from a yaml file. Bear in mind that a small dictionary could lead to hash collisions.

The size of the hash set for the default babble implementation is dictionary_size ^ 2 * 2 ^ 16.

// Construct the dictionary from a java.util.Collection
Dictionary collectionDict = new Dictionary(["fox", "kilo", "alpha"])
BabbleHash collectionHash = new BabbleHash(library: collectionLib)

// Read library from a yaml file
Dictionary yamlDict = new Dictionary(new File("path/to/file", "yamlKey")
BabbleHash yamlHash = new BabbleHash(library: yamlLib)

Custom Hashing Functions

Babble by default will use a 128 bit murmur3 hash to digest the supplied string to hash. If desired, this algorithm can be replaced with a different one, for example, if a cryptographic hash is desired. Guava's Hashing contains a variety of hash functions that can be passed to the BabbleHash class's constructor.

// From guava
import com.google.common.hash.HashFunction
import com.google.common.hash.Hashing

BabbleHash cryptoHash = new BabbleHash(hashFunction: Hashing.sha256())

About

A simple hashing library designed to create easy (for humans) to remember hash values

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages