digest

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm string
const (
	SHA1   Algorithm = "sha1"   // sha1 with hex encoding (lower case only)
	SHA256 Algorithm = "sha256" // sha256 with hex encoding (lower case only)
	MD5    Algorithm = "md5"    // md5 with hex encoding (lower case only)
)

supported digest types

func (Algorithm) String

func (a Algorithm) String() string

type Digest

type Digest string

Digest allows simple protection of hex formatted digest strings, prefixed by their algorithm.

The following is an example of the contents of Digest types:

sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc

func CalcSHA1

func CalcSHA1(r io.ReadSeeker) (Digest, error)

func CalcSHA256

func CalcSHA256(r io.ReadSeeker) (Digest, error)

func NewDigest

func NewDigest(alg Algorithm, h hash.Hash) Digest

NewDigest returns a Digest from alg and a hash.Hash object.

func NewDigestFromString

func NewDigestFromString(alg Algorithm, h string) Digest

NewDigestFromString returns a Digest from alg and a string.

func (Digest) Algorithm

func (d Digest) Algorithm() Algorithm

func (Digest) Encoded

func (d Digest) Encoded() string

func (Digest) String

func (d Digest) String() string

Jump to

Keyboard shortcuts

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