Cryptopp BCD与字符互转

来自泡泡学习笔记
跳到导航 跳到搜索
std::string fromHex(const std::string &from) {
    std::string to;
    CryptoPP::StringSource hexStringSource(from, true,
                                           new CryptoPP::HexDecoder(new CryptoPP::StringSink(to))); 

    return to;
}


std::string toHex(const std::string &from) {
    std::string to;
    CryptoPP::StringSource hexStringSource(from, true,
                                           new CryptoPP::HexEncoder(new CryptoPP::StringSink(to))); 

    return to;
}