Documentation ¶
Overview ¶
Package hashutil provide some util for quickly generate hash
Index ¶
- Constants
- func Base32Bytes(algo string, src any) []byte
- func Base64Bytes(algo string, src any) []byte
- func Hash(algo string, src any) string
- func Hash32(algo string, src any) string
- func Hash64(algo string, src any) string
- func HashPasswd(pwd, key string) string
- func HashSum(algo string, src any) []byte
- func HexBytes(algo string, src any) []byte
- func MD5(src any) string
- func NewHash(algo string) hash.Hash
- func ShortMD5(src any) string
- func VerifyPasswd(wantPwd, pwd, key string) bool
Constants ¶
View Source
const ( AlgoCRC32 = "crc32" AlgoCRC64 = "crc64" AlgoMD5 = "md5" AlgoSHA1 = "sha1" AlgoSHA224 = "sha224" AlgoSHA256 = "sha256" AlgoSHA384 = "sha384" AlgoSHA512 = "sha512" )
hash algorithm names
Variables ¶
This section is empty.
Functions ¶
func Base32Bytes ¶
Base32Bytes generate base32 hash bytes by given algorithm
func Base64Bytes ¶
Base64Bytes generate base64 hash bytes by given algorithm
func HashPasswd ¶
HashPasswd for quick hash an input password string, use sha256.
func NewHash ¶
NewHash create hash.Hash instance
algo: crc32, crc64, md5, sha1, sha224, sha256, sha384, sha512, sha512_224, sha512_256
func ShortMD5 ¶
ShortMD5 Generate a 16-bit md5 bytes. remove first 8 and last 8 bytes from 32-bit md5.
func VerifyPasswd ¶
VerifyPasswd for quick verify input password is valid
- wantPwd from db or config, generated by EncryptPasswd()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.