crypto

package
v0.0.0-...-0fa8407 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PwdKey = []byte("[email protected]")

Functions

func AesDeCryptCBC

func AesDeCryptCBC(cypted []byte, key []byte) ([]byte, error)

实现AES-CBC解密

func AesDecryptGCM

func AesDecryptGCM(cipherText []byte, key []byte) ([]byte, error)

实现AES-GCM解密

func AesEncryptCBC

func AesEncryptCBC(origData []byte, key []byte) ([]byte, error)

实现AES-CBC加密

func AesEncryptGCM

func AesEncryptGCM(plainText []byte, key []byte) ([]byte, error)

实现AES-GCM加密

func Base64DecodeString

func Base64DecodeString(content string) ([]byte, error)

func Base64EncodeToString

func Base64EncodeToString(content []byte) string

func CalculateFileXxHash

func CalculateFileXxHash(filePath string) (uint64, int64, error)

CalculateFileHash 计算文件的 xxhash 哈希值

func CompareBcryptPasswd

func CompareBcryptPasswd(password, storedHash string) bool

CompareBcryptPasswd 验证bcrypt加密的密码

func DePwdCodeUseKey

func DePwdCodeUseKey(pwd string, pwdKey []byte) ([]byte, error)

解密(自定义key)

func EnPwdCodeUseKey

func EnPwdCodeUseKey(pwd []byte, pwdKey []byte) (string, error)

加密base64(使用自定义Key)

func GenerateAESKey

func GenerateAESKey(num int) ([]byte, error)

长度32字节(256比特)的切片长度 对应AES-256,密钥16字节对用AES-128,密钥24字节对用AES-192,

func GetMd5FromFile

func GetMd5FromFile(path string) (string, error)

获取文件的 md5

func GetMd5FromString

func GetMd5FromString(data string) string

字符串 md5

func GetMd5FromString2

func GetMd5FromString2(passwd string) string

func GetPasswdWithBcrypt

func GetPasswdWithBcrypt(password string) (string, error)

GetPasswdWithBcrypt 得到由bcrypt加密的密码

func GetSHA256FromFile

func GetSHA256FromFile(path string) (string, error)

文件的 SHA256

func GetSHA256FromString

func GetSHA256FromString(data string) string

字符串 SHA-256 的校验

func GetStrSha256

func GetStrSha256(s string) string

1、GetStrSha256(s string) string 得到字符串的sha256 2、GetStrSha512(s string) string 得到字符串的sha512

func GetStrSha512

func GetStrSha512(s string) string

func SliceItemSwap

func SliceItemSwap(s []byte, i, j int)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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