go-fingerprint
This is a simple interface, which wraps github.com/minio/highwayhash to allow fingerprinting for any object that implements the Stringer interface. This allows for server side finger printing of structs created by server request payloads.
fingerprint
import "github.com/marcsantiago/go-fingerprint"
fingerprint.go scanner.go stringer.go
func Identify(strObjects ...fmt.Stringer) (string, error)
Identify takes the string representation of objects and creates a hash in the form of a uuid
if a seed is not provided a random 32 byte key is generated using a timestamp
func SetHashKeyWithSeed(s int64)
SetHashKeyWithSeed sets the seed and generates a new 32 key for the internal hash function
type Scanner struct {
}
Scanner provides the ability to create a single hash.Hash that can be reused
func NewScanner() Scanner
NewScanner returns an instance of scanner with the hash initialized using the math/rand package
func (sc Scanner) Identify(strObjects ...fmt.Stringer) (string, error)
func (sc *Scanner) SetHashKeyWithSeed(s int64)
SetHashKeyWithSeed sets the seed and generates a new 32 key for the internal hash function
note that this is not protected by a mutex for performance reasons
type Stringer string
Stringer is a type alias for the string primitive that allows normal strings to satisfy the fmt.Stringer interface
func (s Stringer) String() string
Generated by godoc2md