encrypt

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BcryptCheck

func BcryptCheck(password, hashed string) bool

BcryptCheck 使用 bcrypt 加密算法校验密码

  • password: 明文密码
  • hashed: 加密后的密码
  • bool: 校验结果

func BcryptEncode

func BcryptEncode(password string) (encoded string, err error)

BcryptEncode 使用 bcrypt 加密算法加密密码

  • password: 明文密码
  • encoded: 加密后的密码
  • err: 错误信息

没有出错重试机制,出错直接返回 err

func DecryptMessageWithAES

func DecryptMessageWithAES(encrypted string, secret string) (decrypted string, err error)

DecryptMessageWithAES 使用 AES 加密算法解密消息

  • encrypted: 加密后的消息
  • secret: 密钥,长度必须是 16、24 或 32 位
  • decrypted: 解密后的消息
  • err: 错误信息

没有出错重试机制,出错直接返回 err

func EncryptMessageWithAES

func EncryptMessageWithAES(message string, secret string) (encrypted string, err error)

EncryptMessageWithAES 使用 AES 加密算法加密消息

  • message: 明文消息
  • secret: 密钥,长度必须是 16、24 或 32 位
  • encrypted: 加密后的消息
  • err: 错误信息

没有出错重试机制,出错直接返回 err

func HashEntryMD5

func HashEntryMD5[T any](entry T) string

HashEntryMD5 使用 MD5 算法计算结构体的哈希值

func HashMD5

func HashMD5(message string) string

HashMD5 使用 MD5 算法计算消息的哈希值

Types

This section is empty.

Jump to

Keyboard shortcuts

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