integrity

package
v0.0.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package integrity implements checksum verification for downloaded assets.

Only SHA-256 is supported today. Checksums are expressed as "<algorithm>:<hex>" strings inside manifests.

Index

Constants

This section is empty.

Variables

View Source
var ErrMismatch = fmt.Errorf("checksum mismatch")

ErrMismatch is returned when a checksum does not match the expected value.

Functions

func HashBytes

func HashBytes(algo string, data []byte) string

HashBytes returns the "<algo>:<hex>" digest of data. It panics if algo is unsupported; callers that want to recover from an unsupported algorithm should use Parse first.

func Parse

func Parse(s string) (algo, sum string, err error)

Parse splits an "<algo>:<hex>" checksum into its components. It returns an error if the algorithm is not recognised or the hex part is empty.

func SumFile

func SumFile(path, algo string) (string, error)

SumFile returns the "<algo>:<hex>" digest of path.

func VerifyFile

func VerifyFile(path, expected string) error

VerifyFile checks that the contents of path match expected. expected must be of the form "<algo>:<hex>".

Types

This section is empty.

Jump to

Keyboard shortcuts

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