package ahash
import "git.wntrmute.dev/kyle/goutils/ahash"
Package ahash provides support for hashing data with a selectable
hash function.
Index ¶
- func HashList() []string
- func InsecureHashList() []string
- func SecureHashList() []string
- func Sum(algo string, data []byte) ([]byte, error)
- func SumLimitedReader(algo string, r io.Reader, n int64) ([]byte, error)
- func SumReader(algo string, r io.Reader) ([]byte, error)
- type Hash
Functions ¶
func HashList ¶
func HashList() []string
HashList returns a sorted list of all the hash algorithms supported by the package.
func InsecureHashList ¶
func InsecureHashList() []string
InsecureHashList returns a sorted list of all the insecure hash algorithms supported by the package.
func SecureHashList ¶
func SecureHashList() []string
SecureHashList returns a sorted list of all the secure (cryptographic) hash algorithms supported by the package.
func Sum ¶
Sum returns the digest (not the hex digest) of the data using the given algorithm.
func SumLimitedReader ¶
SumLimitedReader reads n bytes of data from the io.reader and returns the digest (not the hex digest) from the specified algorithm.
func SumReader ¶
SumReader reads all the data from the given io.Reader and returns the digest (not the hex digest) from the specified algorithm.
Types ¶
type Hash ¶
Hash represents a generic hash function that may or may not be secure. It satisfies the hash.Hash interface.
func New ¶
New returns a new Hash for the specified algorithm.
func (*Hash) HashAlgo ¶
HashAlgo returns the name of the underlying hash algorithm.
func (*Hash) IsHash32 ¶
IsHash32 returns true if the underlying hash is a 32-bit hash function.
func (*Hash) IsHash64 ¶
IsHash64 returns true if the underlying hash is a 64-bit hash function.
func (*Hash) IsSecure ¶
IsSecure returns true if the Hash is a cryptographic hash.
func (*Hash) Sum32 ¶
Sum32 returns true if the underlying hash is a 32-bit hash; if is, the uint32 parameter will contain the hash.
func (*Hash) Sum64 ¶
Sum64 returns true if the underlying hash is a 64-bit hash; if is, the uint64 parameter will contain the hash.
Source Files ¶
ahash.go
- Version
- v1.7.7 (latest)
- Published
- Jun 15, 2024
- Platform
- linux/amd64
- Imports
- 18 packages
- Last checked
- 4 days ago –
Tools for package owners.