问题描述
我在使用 cyrptopp::hex 时遇到了编码和解码问题。
我有一个字符串,我想在保存在数据库中时对其进行编码,并在从数据库中加载一些数据时对其进行解码。我已阅读 https://www.cryptopp.com/wiki/HexEncoder 和 https://www.cryptopp.com/wiki/HexDecoder 中的文档,请遵循附加 BufferedTransformation。但是没有结果。
我的功能是:
string hexEncoder(string message){
char const* decoded = message.c_str();
string encoded;
HexEncoder encoder;
encoder.Attach(new StringSink(encoded));
encoder.Put((decoded,sizeof(decoded)));
encoder.MessageEnd();
return encoded;
}
string hexDecoder(string message){
string decoded;
HexDecoder decoder;
decoder.Attach(new StringSink(decoded));
decoder.Put(((byte*)message.data(),message.size()));
decoder.MessageEnd();
return decoded;
}
我是如何解决这个问题的。提前致谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)