加密
基本定义
封装了go内置加密算法,将复杂的细节封装,提供友好的调用接口。
案例
https://github.com/wike2019/wike_go/tree/main/%E6%A1%88%E4%BE%8B/%E5%8A%A0%E5%AF%86
AesEncryptCBC加密
package main
import (
"encoding/base64"
"encoding/hex"
"fmt"
"github.com/wike2019/wike_go/src/util/Crypto"
)
func main() {
crypto := Crypto.New()
origData := []byte("Hello World 11111233") // 待加密的数据
fmt.Println("原文:", string(origData))
decrypted := crypto.AesDecryptCBC(encrypted)
fmt.Println("解密结果:", string(decrypted))
}
Md5加密
Sha256加密
生成非对称加密秘钥
使用非对称加密
最后更新于
这有帮助吗?