hasher

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHashMismatch = errors.New("two hashes don't match")

Functions

func BytesToBase32Hash

func BytesToBase32Hash(b []byte) string

BytesToBase32Hash copies nix here https://nixos.org/nixos/nix-pills/nix-store-paths.html The comments tell us to compute the base32 representation of the first 160 bits (truncation) of a sha256 of the above string:

func HashString

func HashString(input string) string

Types

type Hasher

type Hasher struct {
	// contains filtered or unexported fields
}

Hasher is used to compute path hash values. Hasher implements io.Writer and takes a sha256 hash of the input bytes. The output string is a lowercase base32 representation of the first 160 bits of the hash

func New

func New() *Hasher

func (*Hasher) Sha256Hex

func (h *Hasher) Sha256Hex() string

func (*Hasher) String

func (h *Hasher) String() string

func (*Hasher) Write

func (h *Hasher) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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