hashutil

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyChecksum indicates the provided checksum string is empty.
	ErrEmptyChecksum = errors.New("empty checksum string")
	// ErrUnsupportedChecksumEncoding indicates the checksum string is not a supported encoding.
	ErrUnsupportedChecksumEncoding = errors.New("unsupported checksum encoding")
)

Functions

func CanonicalHexSHA256

func CanonicalHexSHA256(s string) (string, error)

CanonicalHexSHA256 decodes the input checksum and re-encodes it as a lowercase hexadecimal string.

func DecodeSHA256String

func DecodeSHA256String(s string) ([]byte, error)

DecodeSHA256String attempts to decode the provided checksum string which may be hex-encoded or base64/base64url-encoded. It returns the raw 32-byte digest.

func EqualSHA256

func EqualSHA256(expected string, actual [32]byte) bool

EqualSHA256 reports whether the provided checksum string (hex or base64) matches the supplied SHA256 digest.

Types

This section is empty.

Jump to

Keyboard shortcuts

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