Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func RegisterHash ¶
RegisterHash registers a hash function. It panics ErrUnknown when unknown hash was given.
Types ¶
type Hash ¶
type Hash uint
Hash identifies a 'Non Cryptographic' hash function that is implemented in another package. Note that this identifies NON CRYPTOGRAPHIC hash. Use crypto.Hash for cryptographic hash.
const ( FNV32 Hash = offset + iota // Non cryptographic. import github.com/aileron-projects/go/zhash/zfnv FNV32a // Non cryptographic. import github.com/aileron-projects/go/zhash/zfnv FNV64 // Non cryptographic. import github.com/aileron-projects/go/zhash/zfnv FNV64a // Non cryptographic. import github.com/aileron-projects/go/zhash/zfnv FNV128 // Non cryptographic. import github.com/aileron-projects/go/zhash/zfnv FNV128a // Non cryptographic. import github.com/aileron-projects/go/zhash/zfnv CRC32IEEE // Non cryptographic. import github.com/aileron-projects/go/zhash/zcrc32 CRC32Castagnoli // Non cryptographic. import github.com/aileron-projects/go/zhash/zcrc32 CRC32Koopman // Non cryptographic. import github.com/aileron-projects/go/zhash/zcrc32 CRC64ISO // Non cryptographic. import github.com/aileron-projects/go/zhash/zcrc64 CRC64ECMA // Non cryptographic. import github.com/aileron-projects/go/zhash/zcrc64 )
func (Hash) Available ¶
Available reports whether the given hash algorithm is linked into the binary.
func (Hash) Compare ¶
Compare compares the hashed value and the non-hashed value. Compare may return following errors:
- ErrNotMatch: hashed value does not match.
- ErrNotAvailable: hash function specified by h is not available.
- Any errors returned from the hash function.
func (Hash) Equal ¶
Equal returns if the two hashed value and non-hashed value are equal or not. To know why hashes are not matched, use [Compare] instead.
func (Hash) New ¶
New returns a new hash instance. It panics with ErrNotAvailable if hash function is not available.
func (Hash) NewFunc ¶
NewFunc returns a function to generate new hash instances. It panics with ErrNotAvailable if hash function is not available.
func (Hash) Size ¶
Size returns the digest size of the hash. It panics with ErrUnknown when unknown hash was given.