本文摘自网络,作者,侵删。
- base64 & aes 加密
base64.StdEncoding.DecodedLen
returns the maximum length in bytes of the decoded data 导致密文长度异常解密失败
// base64编码
cipherTextBase64 := make([]byte, base64.StdEncoding.EncodedLen(len(cipherText)))
base64.StdEncoding.Encode(cipherTextBase64, cipherText)
// base64解码
cipherText := make([]byte, base64.StdEncoding.DecodedLen(len(cipherTextWithBase64)))
_, err := base64.StdEncoding.Decode(cipherText, cipherTextWithBase64)
// 如何解决
n, err := base64.StdEncoding.Decode(cipherText, cipherTextWithBase64)
cipherText[:n]
本文来自:简书
感谢作者:见云开
查看原文:golang
相关阅读 >>
Golang1.4bootstrap无法直接在aarch64编译
更多相关阅读请进入《Go》频道 >>

Go语言101
一个与时俱进的Go编程知识库。