digest

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

provides common digest calculation utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateDirectory

func CalculateDirectory(dirPath string, extensions []string) (string, error)

calculates a combined hash of all files in a directory

func CalculateFile

func CalculateFile(filepath string) (string, error)

calculates the SHA256 digest of a file

func CalculateReader

func CalculateReader(r io.Reader) (string, error)

calculates the SHA256 digest from a reader

func CleanupTempDir

func CleanupTempDir(dirPath string) error

removes temp dir if it's under os.TempDir()

func CreateTempDir

func CreateTempDir(prefix string) (string, func(), error)

creates a temp dir and returns its path along with cleanup func

func Format

func Format(algorithm, hexDigest string) string

formats a digest with its algorithm prefix

func Normalize

func Normalize(digest string) string

ensures a digest has the algorithm prefix

func Parse

func Parse(digest string) (algorithm, hexDigest string, err error)

parses a digest string into algorithm and hex parts

func ValidateFormat

func ValidateFormat(algorithm, hexDigest string) error

validates digest format based on algorithm

Types

This section is empty.

Jump to

Keyboard shortcuts

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