generators

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Sha1Name   = "sha1"
	Sha256Name = "sha256"
	Sha512Name = "sha512"
	Sha3224    = "sha3-224"
	Sha3256    = "sha3-256"
	Sha3384    = "sha3-384"
	Sha3512    = "sha3-512"
)
View Source
const (
	MurMurHash32Size  = 4
	MurMurHash64Size  = 8
	MurMurHash128Size = 16
)

Variables

This section is empty.

Functions

func BuildBytesFromInt64

func BuildBytesFromInt64(value int64) []byte

func BuildBytesFromUint64

func BuildBytesFromUint64(value uint64) []byte

func BuildInt64FromBytes

func BuildInt64FromBytes(data []byte) (res int64)

BuildInt64FromBytes - decode bytes array to int64 representation. In case there is less

func BuildUint64FromBytes

func BuildUint64FromBytes(data []byte) (res uint64)

func GetHashFunctionNameBySize

func GetHashFunctionNameBySize(size int) (string, int, error)

Types

type Generator

type Generator interface {
	Generate([]byte) ([]byte, error)
	Size() int
}

We don't know the byte length in the output, min value, max value

func GetHashBytesGen

func GetHashBytesGen(salt []byte, size int) (Generator, error)

func NewHash

func NewHash(salt []byte, funcName string) (Generator, error)

func NewHashReducer

func NewHashReducer(g Generator, size int) Generator

func NewSipHash

func NewSipHash(salt []byte) (Generator, error)

type Hash

type Hash struct {
	hash.Hash
	// contains filtered or unexported fields
}

func (*Hash) Generate

func (s *Hash) Generate(data []byte) ([]byte, error)

type HashReducer

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

func (*HashReducer) Generate

func (hr *HashReducer) Generate(data []byte) (res []byte, err error)

func (*HashReducer) Size

func (hr *HashReducer) Size() int

type HybridBytes

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

func NewHybridBytes

func NewHybridBytes(seed int64, requestedSize int, h Generator) *HybridBytes

func (*HybridBytes) Generate

func (hb *HybridBytes) Generate(data []byte) ([]byte, error)

type Int64Random

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

func NewInt64Random

func NewInt64Random(seed int64) (*Int64Random, error)

func (*Int64Random) Generate

func (i *Int64Random) Generate(data []byte) ([]byte, error)

func (*Int64Random) Size

func (i *Int64Random) Size() int

type MurmurHash

type MurmurHash struct {
	hash.Hash
	// contains filtered or unexported fields
}

func NewMurmurHash

func NewMurmurHash(seed uint32, size int) *MurmurHash

func (*MurmurHash) Generate

func (mh *MurmurHash) Generate(data []byte) ([]byte, error)

func (*MurmurHash) Size

func (mh *MurmurHash) Size() int

type Projector

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

func NewProjector

func NewProjector(generators ...Generator) *Projector

func (*Projector) Generate

func (p *Projector) Generate(data []byte) (res []byte, err error)

func (*Projector) Size

func (p *Projector) Size() int

type RandomBytes

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

func NewRandomBytes

func NewRandomBytes(seed int64, size int) *RandomBytes

func (*RandomBytes) Generate

func (br *RandomBytes) Generate(data []byte) ([]byte, error)

func (*RandomBytes) Size

func (br *RandomBytes) Size() int

type SipHash

type SipHash struct {
	hash.Hash
	// contains filtered or unexported fields
}

func (*SipHash) Generate

func (s *SipHash) Generate(data []byte) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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