hash

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MD5Hash    Algorithm = "md5"
	FNV32Hash            = "fnv32"
	FNV32aHash           = "fnv32a"
	FNV64Hash            = "fnv64"
	FNV64aHash           = "fnv64a"
	SHA1Hash             = "sha1"
	SHA256Hash           = "sha256"
	SHA224Hash           = "sha224"
	SHA512Hash           = "sha512"
	SHA384Hash           = "sha384"
)

Variables

View Source
var ErrUnsupportedAlgorithm = errors.New("hashutils: unsupported hashing algorithm")

Functions

func FNV32

func FNV32(text string) (uint32, error)

func FNV32a

func FNV32a(text string) (uint32, error)

func FNV64

func FNV64(text string) (uint64, error)

func FNV64a

func FNV64a(text string) (uint64, error)

func MD5

func MD5(text string) ([]byte, error)

func MD5Base64RawStdEnc

func MD5Base64RawStdEnc(text string) (string, error)

func MD5Base64RawURLEnc

func MD5Base64RawURLEnc(text string) (string, error)

func MD5Base64StdEnc

func MD5Base64StdEnc(text string) (string, error)

func MD5Base64URLEnc

func MD5Base64URLEnc(text string) (string, error)

func MD5Dir

func MD5Dir(path string) ([]byte, error)

func MD5DirBase64RawStdEnc

func MD5DirBase64RawStdEnc(path string) (string, error)

func MD5DirBase64RawURLEnc

func MD5DirBase64RawURLEnc(path string) (string, error)

func MD5DirBase64StdEnc

func MD5DirBase64StdEnc(path string) (string, error)

func MD5DirBase64URLEnc

func MD5DirBase64URLEnc(path string) (string, error)

func MD5DirHex

func MD5DirHex(path string) (string, error)

func MD5File

func MD5File(path string) ([]byte, error)

func MD5FileBase64RawStdEnc

func MD5FileBase64RawStdEnc(path string) (string, error)

func MD5FileBase64RawURLEnc

func MD5FileBase64RawURLEnc(path string) (string, error)

func MD5FileBase64StdEnc

func MD5FileBase64StdEnc(path string) (string, error)

func MD5FileBase64URLEnc

func MD5FileBase64URLEnc(path string) (string, error)

func MD5FileHex

func MD5FileHex(path string) (string, error)

func MD5Hex

func MD5Hex(text string) (string, error)

func SHA1

func SHA1(text string) ([]byte, error)

func SHA1Base64RawStdEnc

func SHA1Base64RawStdEnc(text string) (string, error)

func SHA1Base64RawURLEnc

func SHA1Base64RawURLEnc(text string) (string, error)

func SHA1Base64StdEnc

func SHA1Base64StdEnc(text string) (string, error)

func SHA1Base64URLEnc

func SHA1Base64URLEnc(text string) (string, error)

func SHA1File

func SHA1File(path string) ([]byte, error)

func SHA1FileBase64RawStdEnc

func SHA1FileBase64RawStdEnc(path string) (string, error)

func SHA1FileBase64RawURLEnc

func SHA1FileBase64RawURLEnc(path string) (string, error)

func SHA1FileBase64StdEnc

func SHA1FileBase64StdEnc(path string) (string, error)

func SHA1FileBase64URLEnc

func SHA1FileBase64URLEnc(path string) (string, error)

func SHA1FileHex

func SHA1FileHex(path string) (string, error)

func SHA1Hex

func SHA1Hex(text string) (string, error)

func SHA224

func SHA224(text string) ([]byte, error)

func SHA224Base64RawStdEnc

func SHA224Base64RawStdEnc(text string) (string, error)

func SHA224Base64RawURLEnc

func SHA224Base64RawURLEnc(text string) (string, error)

func SHA224Base64StdEnc

func SHA224Base64StdEnc(text string) (string, error)

func SHA224Base64URLEnc

func SHA224Base64URLEnc(text string) (string, error)

func SHA224File

func SHA224File(path string) ([]byte, error)

func SHA224FileBase64RawStdEnc

func SHA224FileBase64RawStdEnc(path string) (string, error)

func SHA224FileBase64RawURLEnc

func SHA224FileBase64RawURLEnc(path string) (string, error)

func SHA224FileBase64StdEnc

func SHA224FileBase64StdEnc(path string) (string, error)

func SHA224FileBase64URLEnc

func SHA224FileBase64URLEnc(path string) (string, error)

func SHA224FileHex

func SHA224FileHex(path string) (string, error)

func SHA224Hex

func SHA224Hex(text string) (string, error)

func SHA256

func SHA256(text string) ([]byte, error)

func SHA256Base64RawStdEnc

func SHA256Base64RawStdEnc(text string) (string, error)

func SHA256Base64RawURLEnc

func SHA256Base64RawURLEnc(text string) (string, error)

func SHA256Base64StdEnc

func SHA256Base64StdEnc(text string) (string, error)

func SHA256Base64URLEnc

func SHA256Base64URLEnc(text string) (string, error)

func SHA256File

func SHA256File(path string) ([]byte, error)

func SHA256FileBase64RawStdEnc

func SHA256FileBase64RawStdEnc(path string) (string, error)

func SHA256FileBase64RawURLEnc

func SHA256FileBase64RawURLEnc(path string) (string, error)

func SHA256FileBase64StdEnc

func SHA256FileBase64StdEnc(path string) (string, error)

func SHA256FileBase64URLEnc

func SHA256FileBase64URLEnc(path string) (string, error)

func SHA256FileHex

func SHA256FileHex(path string) (string, error)

func SHA256Hex

func SHA256Hex(text string) (string, error)

func SHA384

func SHA384(text string) ([]byte, error)

func SHA384Base64RawStdEnc

func SHA384Base64RawStdEnc(text string) (string, error)

func SHA384Base64RawURLEnc

func SHA384Base64RawURLEnc(text string) (string, error)

func SHA384Base64StdEnc

func SHA384Base64StdEnc(text string) (string, error)

func SHA384Base64URLEnc

func SHA384Base64URLEnc(text string) (string, error)

func SHA384File

func SHA384File(path string) ([]byte, error)

func SHA384FileBase64RawStdEnc

func SHA384FileBase64RawStdEnc(path string) (string, error)

func SHA384FileBase64RawURLEnc

func SHA384FileBase64RawURLEnc(path string) (string, error)

func SHA384FileBase64StdEnc

func SHA384FileBase64StdEnc(path string) (string, error)

func SHA384FileBase64URLEnc

func SHA384FileBase64URLEnc(path string) (string, error)

func SHA384FileHex

func SHA384FileHex(path string) (string, error)

func SHA384Hex

func SHA384Hex(text string) (string, error)

func SHA512

func SHA512(text string) ([]byte, error)

func SHA512Base64RawStdEnc

func SHA512Base64RawStdEnc(text string) (string, error)

func SHA512Base64RawURLEnc

func SHA512Base64RawURLEnc(text string) (string, error)

func SHA512Base64StdEnc

func SHA512Base64StdEnc(text string) (string, error)

func SHA512Base64URLEnc

func SHA512Base64URLEnc(text string) (string, error)

func SHA512File

func SHA512File(path string) ([]byte, error)

func SHA512FileBase64RawStdEnc

func SHA512FileBase64RawStdEnc(path string) (string, error)

func SHA512FileBase64RawURLEnc

func SHA512FileBase64RawURLEnc(path string) (string, error)

func SHA512FileBase64StdEnc

func SHA512FileBase64StdEnc(path string) (string, error)

func SHA512FileBase64URLEnc

func SHA512FileBase64URLEnc(path string) (string, error)

func SHA512FileHex

func SHA512FileHex(path string) (string, error)

func SHA512Hex

func SHA512Hex(text string) (string, error)

Types

type Algorithm

type Algorithm string

Algorithm represents the type of hashing algorithms supported by this package.

type Encoding

type Encoding string

An Encoding is a radix 64 encoding/decoding scheme, defined by a 64-character alphabet.

const (
	Hex    Encoding = "hex"
	Base64          = "base64"
)

type ExtHash

type ExtHash interface {
	HashText(text string) (string, error)
	HashFile(path string) (string, error)
	HashFiles(paths ...string) (map[string]string, error)
	// HashDir(path string) (string, error)
	HashPath(path string) (string, error)
}

type ExtHashBuilder

type ExtHashBuilder interface {
	Algorithm(Algorithm) ExtHashBuilder
	Encoding(Encoding) ExtHashBuilder
	Build() ExtHash
}

func New

func New() ExtHashBuilder

Jump to

Keyboard shortcuts

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