
相关加密
Go语言相关 相关加密
liyuan丶
爱好学习
展开
-
Golang 华为SAAS hmac-sha256 加密 AK/SK
背景:接入华为SAAS相关接口废话不多说,直接上代码package saasimport ( "crypto/hmac" "crypto/sha256" "encoding/base64" "git.myscrm.cn/golang/stark/v4" "github.com/go-resty/resty/v2" "github.com/google/uuid" "time")type Sass struct { url string accessKe原创 2021-11-16 14:32:58 · 1303 阅读 · 0 评论 -
Golang AES-128/GCM + BASE64 加密
需求背景:接入网络游戏防沉迷系统,其中请求体body需要进行加密废话不多说,就直接上源码func GCMEncrypt(secretKey, originalText string) (string, error) { // 密钥需要解码 key, _ := hex.DecodeString(secretKey) block, err := aes.NewCipher(key) if err != nil { return "", err } aesGcm, err := cipher原创 2021-03-15 10:40:25 · 3530 阅读 · 6 评论