hasher

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHasher

func GetHasher(ht HashType) hash.Hash

func HashBytes

func HashBytes(b []byte, ht HashType) string

HashBytes returns hash of []byte b

func HashFile

func HashFile(file fsw.IFileReader, ht HashType, bl int) (hashed string, err error)

HashFile uses buffer with specified length to read and hash file as []byte

bl is the number of bytes for HashFile to create reading buffer. If provided 0, it will be set for 1024 (1KB)

func HashFilePath

func HashFilePath(path string, ht HashType, bl int) (hashed string, err error)

HashFilePath opens specified file and calls to HashFile

bl is the number of bytes for HashFile to create reading buffer. If provided 0, it will be set for 1024 (1KB)

func HashString

func HashString(s string, ht HashType) string

HashString returns hash of string s

Types

type HashType

type HashType int
const (
	MD5 HashType
	SHA1
	SHA256
	SHA512
)

Legal hash types

func (HashType) CheckType

func (t HashType) CheckType() bool

CheckType returns false if t has illegal hash type

func (HashType) String

func (t HashType) String() string

String returns name for hash type or "illegal" if it is wrong

Jump to

Keyboard shortcuts

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