Documentation ¶
Overview ¶
Package hhash implements a customizable, human-readable hashing engine.
Index ¶
- Variables
- type HHash
- func (hasher *HHash) HashBytes(bytes []byte) string
- func (hasher *HHash) HashString(s string) string
- func (hasher *HHash) HashUint(seed uint64) string
- func (hasher *HHash) InitPattern(pattern string) error
- func (hasher *HHash) Random() string
- func (hasher *HHash) WordsForType(wordType WordType) []string
- type WordCase
- type WordType
Constants ¶
This section is empty.
Variables ¶
var DefaultAdjectives = []string{} /* 1987 elements not displayed */
DefaultAdjectives provide default set of adjects
var DefaultAdverbs = []string{} /* 1199 elements not displayed */
DefaultAdverbs provide default set of adverbs
var DefaultDatasetVersion = 1
DefaultDatasetVersion is the version of the default datasets to determine whether two instances of HHash will produce consistent hashes.
var DefaultNouns = []string{} /* 5000 elements not displayed */
DefaultNouns provide default set of nouns
var DefaultVerbs = []string{} /* 5000 elements not displayed */
DefaultVerbs provide default set of verbs
var DefaultVerbsGerund = []string{} /* 401 elements not displayed */
DefaultVerbsGerund provide default set of gerunds ("-ing")
var DefaultVerbsPast = []string{} /* 1024 elements not displayed */
DefaultVerbsPast provide default set of verbs in the past tense
Functions ¶
This section is empty.
Types ¶
type HHash ¶
type HHash struct { // Adjectives is a slice of adjectives Adjectives []string // Adverbs is a slice of adverbs Adverbs []string // Adverbs is a slice of nouns Nouns []string // Verbs is a slice of verbs Verbs []string // VerbsPast is a slice of verbs in the past tense VerbsPast []string // VerbsGerund is a slice of verbs in the present participle VerbsGerund []string // AllowRepeats, if true, allows consecutive tokens to generate the same word (default: false) AllowRepeats bool // CalculateCollisionRate, if true, calculates the collision rate given the datasets, upon the first hash operation CalculateCollisionRate bool // contains filtered or unexported fields }
HHash uses xxhash to generate human-readable hash, with custom pattern and options for various parts of speech.
func NewDefault ¶
func NewDefault() *HHash
NewDefault instantiates an HHash with default datasets and the default pattern.
func NewWDefaultWithPattern ¶
NewWDefaultWithPattern instantiates an HHash with default datasets and the given pattern.
func (*HHash) HashString ¶
HashString returns a human-readable hash for the given string.
func (*HHash) InitPattern ¶
InitPattern initializes hhash with a new pattern of word tokens. TODO: examples
func (*HHash) WordsForType ¶
WordsForType returns the dataset for the given word type.
type WordCase ¶
type WordCase int
WordCase represents an enumeration of the categories in which a word may be cased.
type WordType ¶
type WordType int
WordType is a semantic type of words that a given token would generate. For example, the token "%A" represents a title-cased Adjective, and the "%v{G}" represents a a lowercased VerbGerund
const ( // Adjective represents adjectives. Adjective WordType = iota // Adverb represents adverbs. Adverb // Noun represents things and ideas but not persons or places. Noun // Verb represents actions in their present simple tense ("throw", "eat", "sing"). Verb // VerbPast represents verbs in the past tense. VerbPast // VerbGerund represents verbs in the present participle tense. VerbGerund )