hash

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 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

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

func MD5Bytes(data []byte) string

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

func MD5Hmac

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

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

func SHA1Bytes(data []byte) string

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

func SHA1Hmac

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

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

func SHA256Bytes(data []byte) string

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

func SHA256Hmac

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

func SHA512(data string) string

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

func SHA512Bytes

func SHA512Bytes(data []byte) string

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

func SHA512Hmac

func SHA512Hmac(key, data []byte) string

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

func SM3

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

func SM3Bytes(data []byte) string

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

func SM3Hmac

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