fingerprint

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 8 Imported by: 0

README

go-fingerprint Go

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"

Overview

Index

Package files

fingerprint.go scanner.go stringer.go

func Identify

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

func SetHashKeyWithSeed(s int64)

SetHashKeyWithSeed sets the seed and generates a new 32 key for the internal hash function

type Scanner

type Scanner struct {
    // contains filtered or unexported fields
}

Scanner provides the ability to create a single hash.Hash that can be reused

func NewScanner
func NewScanner() Scanner

NewScanner returns an instance of scanner with the hash initialized using the math/rand package

func (Scanner) Identify
func (sc Scanner) Identify(strObjects ...fmt.Stringer) (string, error)
func (*Scanner) SetHashKeyWithSeed
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

type Stringer string

Stringer is a type alias for the string primitive that allows normal strings to satisfy the fmt.Stringer interface

func (Stringer) String
func (s Stringer) String() string

Generated by godoc2md

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identify

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

func SetHashKeyWithSeed(s int64)

SetHashKeyWithSeed sets the seed and generates a new 32 key for the internal hash function

Types

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner provides the ability to create a single hash.Hash that can be reused

func NewScanner

func NewScanner() *Scanner

NewScanner returns an instance of scanner with the hash initialized using the math/rand package

func (*Scanner) Identify

func (sc *Scanner) 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 (*Scanner) SetHashKeyWithSeed

func (sc *Scanner) SetHashKeyWithSeed(s int64) *Scanner

SetHashKeyWithSeed sets the seed and generates a new 32 key for the internal hash function

type Stringer

type Stringer string

Stringer is a type alias for the string primitive that allows normal strings to satisfy the fmt.Stringer interface

func (Stringer) String

func (s Stringer) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL