Having trouble decrypting a well-formed cipher text using Crypto++

后端 未结 2 1688
醉话见心
醉话见心 2020-12-12 02:02

Background

I\'ve been struggling with decrypting an apparently well-formed cipher text for about a day. Assume we\'ve got the following hex-encoded cipher text whi

2条回答
  •  自闭症患者
    2020-12-12 02:51

    The hexEncode function seems to misbehave:

    QString CryptoUtils::hexEncode(QString text)
    {
        byte *bytearray = (byte *) text.toLatin1().data();
        int length = text.toLatin1().length();
    
        return hexEncode(bytearray, length);
    }
    

    Should be replaced with:

    QString CryptoUtils::hexEncode(QString text)
    {
        byte *bytearray = (byte *) text.toStdString().data();
        int length = text.length();
    
        return hexEncode(bytearray, length);
    }
    

提交回复
热议问题