hash

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package hash provides SHA-256 and xxHash helpers for message and content hashing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesHash added in v0.1.1

func BytesHash(b []byte) string

BytesHash returns a SHA256 hash of the given bytes as a hex string. Returns empty string if input is empty.

func SHA256 added in v0.1.1

func SHA256(data []byte) string

SHA256 computes SHA-256 hash returns hex-encoded string

func SHA256String added in v0.1.1

func SHA256String(data []byte) [sha256.Size]byte

SHA256String computes the SHA-256 hash, returns the raw 32-byte array

func SHA512 added in v0.1.1

func SHA512(data []byte) string

SHA512 computes SHA-512 hash, returns hex-encoded string

func WriteBool

func WriteBool(h hash.Hash, v bool)

WriteBool writes a boolean value to the hash in a deterministic format (1 for true, 0 for false).

func WriteFloat32

func WriteFloat32(h hash.Hash, v float32)

WriteFloat32 writes a float32 value to the hash by converting it to its IEEE 754 binary representation.

func WriteFloat64 added in v0.1.4

func WriteFloat64(h hash.Hash, v float64)

WriteFloat64 writes a float64 value to the hash by converting it to its IEEE 754 binary representation.

func WriteInt64

func WriteInt64(h hash.Hash, v int64)

WriteInt64 writes an int64 value to the hash in little-endian format.

func WriteUint32 added in v0.1.4

func WriteUint32(h hash.Hash, v uint32)

WriteUint32 writes a uint32 value to the hash in little-endian format.

func XXHash added in v0.1.1

func XXHash(data []byte) uint64

XXHash computes the XXHash, fast, non-cryptographic

Types

This section is empty.

Jump to

Keyboard shortcuts

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