Documentation ¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/unqnown/swca1" ) func main() { h := swca1.New( swca1.Size(swca1.Max), swca1.Alphabet(swca1.NULS), swca1.Unique, swca1.NoTypeRepetition, swca1.NoCharacterRepetition, ) _, _ = h.Write([]byte("salt")) _, _ = h.Write([]byte("hint")) fmt.Printf("%s", h.Sum(nil)) }
Output: e@c*x6d-q#J8U&F^%H+t7Y!L1P4M5I$g0S2A?R3o9n
Index ¶
Examples ¶
Constants ¶
View Source
const ( // NULS represents default alphabet's tokens. NULS = "nuls" // ABC represents default alphabet. ABC = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz?!@#$%^&*-+" // Enough is an optimal hash size for default alphabet. Enough = 20 // Max is reserved identifier for maximum hash size within required complexity. Max = 0 )
Variables ¶
View Source
var ErrUnreachableComplexity = errors.New("swca1: unreachable complexity")
ErrUnreachableComplexity means that there is no way to generate a hash of such size with requested complexity.
Functions ¶
func NoCharacterRepetition ¶
func NoCharacterRepetition(o *Options)
NoCharacterRepetition guarantees that in any pair of adjacent characters there will be no more than one letter, regardless of case.
func NoTypeRepetition ¶
func NoTypeRepetition(o *Options)
NoTypeRepetition guarantees any pair of adjacent characters in the hash will have a different type.
Types ¶
type Option ¶
type Option func(*Options)
Option is an type of go idiomatic options representation.
Click to show internal directories.
Click to hide internal directories.