Documentation
¶
Overview ¶
Package hash provides SHA-256 and xxHash helpers for message and content hashing.
Index ¶
- func BytesHash(b []byte) string
- func SHA256(data []byte) string
- func SHA256String(data []byte) [sha256.Size]byte
- func SHA512(data []byte) string
- func WriteBool(h hash.Hash, v bool)
- func WriteFloat32(h hash.Hash, v float32)
- func WriteFloat64(h hash.Hash, v float64)
- func WriteInt64(h hash.Hash, v int64)
- func WriteUint32(h hash.Hash, v uint32)
- func XXHash(data []byte) uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesHash ¶ added in v0.1.1
BytesHash returns a SHA256 hash of the given bytes as a hex string. Returns empty string if input is empty.
func SHA256String ¶ added in v0.1.1
SHA256String computes the SHA-256 hash, returns the raw 32-byte array
func WriteBool ¶
WriteBool writes a boolean value to the hash in a deterministic format (1 for true, 0 for false).
func WriteFloat32 ¶
WriteFloat32 writes a float32 value to the hash by converting it to its IEEE 754 binary representation.
func WriteFloat64 ¶ added in v0.1.4
WriteFloat64 writes a float64 value to the hash by converting it to its IEEE 754 binary representation.
func WriteInt64 ¶
WriteInt64 writes an int64 value to the hash in little-endian format.
func WriteUint32 ¶ added in v0.1.4
WriteUint32 writes a uint32 value to the hash in little-endian format.
Types ¶
This section is empty.