We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AES 加解密的时候,key的长度是有要求的,不然随便一个key可能会有问题,加解密出的结果不对应,可以考虑增加参数校验或则增加错误输出,不然使用者无感知得到一个错误的结果(空字符串)
另外,文档readme中对AES解密的demo是有问题的,应该是 dongle.Decrypt.FromString 而不是 dongle.Encrypt.FromString
dongle.Decrypt.FromString
dongle.Encrypt.FromString
The text was updated successfully, but these errors were encountered:
感谢你的反馈,欢迎一块完善
Sorry, something went wrong.
这里已经对key进行了校验,判断Error是否为nil即可
如果是参考readme的链式调用到最后的ToString就感知不到错误
ToString
加上encrypt不是指针,所以调用的时候要写的很严谨才行,比如下边这样调用也不能获取到错误
e := dongle.Encrypt e.FromString(text).ByAes(cipher) if e.Error != nil { return "", e.Error } return e.ToString(), nil
下边这样才能感知到错误
e := dongle.Encrypt.FromString(text).ByAes(cipher) if e.Error != nil { return "", e.Error } return e.ToString(), nil
不过问题不大,我已经能按照你上边说的用法处理了错误了,谢谢。
No branches or pull requests
Feature Request
AES 加解密的时候,key的长度是有要求的,不然随便一个key可能会有问题,加解密出的结果不对应,可以考虑增加参数校验或则增加错误输出,不然使用者无感知得到一个错误的结果(空字符串)
另外,文档readme中对AES解密的demo是有问题的,应该是
dongle.Decrypt.FromString
而不是dongle.Encrypt.FromString
The text was updated successfully, but these errors were encountered: