directory
Version:
v1.0.34
Opens a new window with list of versions in this module.
Published: Jan 25, 2022
License: Apache-2.0
Opens a new window with license information.
README
¶
crypto
基于官方库 crypto 封装的加密组件,目前实现如下功能
-
hash 算法 md5
- Md5String(str1) 字符串生成 md5
- Md5File(file) 文件生成 md5
- Md5FileByBytes 如果文件很大,可以通过文件大小,生成 md5
-
hash 算法 sha512
- Sha512String(str1) 字符串生成 sha512
- Sha512File(file) 文件生成 sha512
- Sha512FileByBytes 如果文件很大,可以通过文件大小,生成 sha512
-
对称加密算法 (aes 算法 cfb 模式)
import (
"git.xiewo.net/go/common/crypto/aes"
)
a := NewAesCfb("01234567890123456789012345678912") // 初始化,传入一个 key(只能 16,24,32 位)
clipher, _ := a.EnCrypter("hello, mr laojia! ") // 加密
plain, _ := a.DeCrypter("MYPiWPfQyW32s3fmkLnE6L5luO+jcqc2uFGFrRDgyrnWuA==") // 解密
Directories
¶
Click to show internal directories.
Click to hide internal directories.