Documentation
¶
Index ¶
- func AESDecrypt(ciphertext, key []byte) ([]byte, error)
- func AESDecryptString(ciphertext, key string) (string, error)
- func AESEncrypt(plaintext, key []byte) ([]byte, error)
- func AESEncryptString(plaintext, key string) (string, error)
- func Base64Decode(encoded string) ([]byte, error)
- func Base64Encode(data []byte) string
- func Base64URLDecode(encoded string) ([]byte, error)
- func Base64URLEncode(data []byte) string
- func CheckPassword(password, hash string) bool
- func DeriveKey(password, salt string, keyLen int) []byte
- func GenerateHexKey(length int) (string, error)
- func GenerateKey(length int) ([]byte, error)
- func GenerateSalt(length int) (string, error)
- func GetMD5ByStr(str string) string
- func GetMD5FromFile(filePath string) (string, error)
- func HMACSHA256(message, secret string) string
- func HMACSHA512(message, secret string) string
- func HashPassword(password string) (string, error)
- func HashPasswordWithCost(password string, cost int) (string, error)
- func MD5(text string) string
- func MD5Bytes(data []byte) string
- func MD5File(filepath string) (string, error)
- func MaskString(s string, visibleStart, visibleEnd int) string
- func PadPKCS7(data []byte, blockSize int) []byte
- func SHA256(text string) string
- func SHA256Bytes(data []byte) string
- func SHA256File(filepath string) (string, error)
- func SHA512(text string) string
- func SecureCompare(a, b string) bool
- func UnpadPKCS7(data []byte) ([]byte, error)
- func VerifyHMAC(message, secret, signature string) bool
- func XOR(a, b []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESDecryptString ¶
AESDecryptString 解密 Base64 编码的密文
func AESEncryptString ¶
AESEncryptString 加密字符串并返回 Base64 编码
func Base64URLDecode ¶
Base64URLDecode URL 安全的 Base64 解码
func GetMD5FromFile ¶
GetMD5FromFile 获取文件的 MD5 哈希 - CasaOS 兼容别名
func HashPasswordWithCost ¶
HashPasswordWithCost 使用指定强度哈希密码
func MaskString ¶
MaskString 遮掩字符串(如密码、密钥)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.