hash

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: GPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBlake2b256

func NewBlake2b256() hash.Hash

func NewBlake2b384

func NewBlake2b384() hash.Hash

func NewBlake2b512

func NewBlake2b512() hash.Hash

func NewBlake2s256

func NewBlake2s256() hash.Hash

Types

type Algorithm

type Algorithm uint8
const (
	SHA2_224 Algorithm = 1 + iota
	SHA2_256
	SHA2_512_224
	SHA2_512_256
	SHA2_384
	SHA2_512
	SHA3_224
	SHA3_256
	SHA3_384
	SHA3_512
	BLAKE2S_256
	BLAKE2B_256
	BLAKE2B_384
	BLAKE2B_512
)

func RecommendedAlg

func RecommendedAlg(strengthInBits uint16) Algorithm

func (Algorithm) BlockSize

func (a Algorithm) BlockSize() uint8

func (Algorithm) Name

func (a Algorithm) Name() string

func (Algorithm) New

func (a Algorithm) New() hash.Hash

func (Algorithm) SecurityStrength

func (a Algorithm) SecurityStrength() uint8

func (Algorithm) Size

func (a Algorithm) Size() uint8

func (Algorithm) String

func (a Algorithm) String() string

type Hash

type Hash struct {
	Algorithm Algorithm
	Sum       []byte
}

func FromBytes

func FromBytes(bytes []byte) (*Hash, int, error)

func FromHex

func FromHex(s string) (*Hash, error)

func FromSafe64

func FromSafe64(s string) (*Hash, error)

func Sum

func Sum(data []byte, alg Algorithm) *Hash

func SumAndCompare

func SumAndCompare(data []byte, other Hash) (bool, *Hash)

func SumReader

func SumReader(reader io.Reader, alg Algorithm) (*Hash, error)

func SumReaderAndCompare

func SumReaderAndCompare(reader io.Reader, other Hash) (bool, *Hash, error)

func SumString

func SumString(data string, alg Algorithm) *Hash

func (*Hash) Bytes

func (h *Hash) Bytes() []byte

func (*Hash) Equal

func (h *Hash) Equal(other *Hash) bool

func (*Hash) Hex

func (h *Hash) Hex() string

func (*Hash) Safe64

func (h *Hash) Safe64() string

Jump to

Keyboard shortcuts

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