hash

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Md5 added in v0.6.0

func Md5(data string) string

Md5 computes the MD5 hash of the input string and returns a hex-encoded string. WARNING: MD5 is cryptographically broken and should not be used for security purposes. Use it only for non-security purposes like checksums.

func Md5Bytes added in v0.6.0

func Md5Bytes(data []byte) string

Md5Bytes computes the MD5 hash of the input bytes and returns a hex-encoded string.

func Md5Hmac added in v0.6.0

func Md5Hmac(key, data []byte) string

Md5Hmac computes the HMAC-MD5 of the input data with the given key. WARNING: MD5 is cryptographically broken. Use Sha256Hmac instead.

func Sha1 added in v0.6.0

func Sha1(data string) string

Sha1 computes the SHA-1 hash of the input string and returns a hex-encoded string. WARNING: SHA-1 is cryptographically broken and should not be used for security purposes. Consider using Sha256 or Sha512 instead.

func Sha1Bytes added in v0.6.0

func Sha1Bytes(data []byte) string

Sha1Bytes computes the SHA-1 hash of the input bytes and returns a hex-encoded string.

func Sha1Hmac added in v0.6.0

func Sha1Hmac(key, data []byte) string

Sha1Hmac computes the HMAC-SHA1 of the input data with the given key. WARNING: SHA-1 is cryptographically weak. Use Sha256Hmac instead.

func Sha256 added in v0.6.0

func Sha256(data string) string

Sha256 computes the SHA-256 hash of the input string and returns a hex-encoded string. This is the recommended hash function for most use cases.

func Sha256Bytes added in v0.6.0

func Sha256Bytes(data []byte) string

Sha256Bytes computes the SHA-256 hash of the input bytes and returns a hex-encoded string.

func Sha256Hmac added in v0.6.0

func Sha256Hmac(key, data []byte) string

Sha256Hmac computes the HMAC-SHA256 of the input data with the given key. This is the recommended HMAC function for most use cases.

func Sha512 added in v0.6.0

func Sha512(data string) string

Sha512 computes the SHA-512 hash of the input string and returns a hex-encoded string.

func Sha512Bytes added in v0.6.0

func Sha512Bytes(data []byte) string

Sha512Bytes computes the SHA-512 hash of the input bytes and returns a hex-encoded string.

func Sha512Hmac added in v0.6.0

func Sha512Hmac(key, data []byte) string

Sha512Hmac computes the HMAC-SHA512 of the input data with the given key.

func Sm3 added in v0.6.0

func Sm3(data string) string

Sm3 computes the SM3 hash of the input string and returns a hex-encoded string. SM3 is a cryptographic hash function used in Chinese National Standard (国密算法).

func Sm3Bytes added in v0.6.0

func Sm3Bytes(data []byte) string

Sm3Bytes computes the SM3 hash of the input bytes and returns a hex-encoded string.

func Sm3Hmac added in v0.6.0

func Sm3Hmac(key, data []byte) string

Sm3Hmac computes the HMAC-SM3 of the input data with the given key (国密算法).

Types

This section is empty.

Jump to

Keyboard shortcuts

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