sri

package
v0.0.1-rc4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: ISC Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm string
const (
	SHA256 Algorithm = "sha256"
	SHA384 Algorithm = "sha384"
	SHA512 Algorithm = "sha512"
)

func AlgorithmFromString

func AlgorithmFromString(s string) (Algorithm, error)

func (Algorithm) ByteLen

func (a Algorithm) ByteLen() int

func (Algorithm) Hash

func (a Algorithm) Hash(in io.Reader) ([]byte, error)

type Integrity

type Integrity struct {
	// Algorithm is the algorithm used to generate the hash.
	Algorithm
	// Hash is the hash of the payload.
	Hash []byte
}

func FromReader

func FromReader(algorithm Algorithm, payload io.Reader) (Integrity, error)

func FromString

func FromString(s string) (Integrity, error)

func (Integrity) String

func (i Integrity) String() string

func (Integrity) Validate

func (i Integrity) Validate(payload io.Reader) error

Jump to

Keyboard shortcuts

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