I am working a software that uses Qt and has existing methods to encrypt/decrypt checksum values in hex. Currently, I’ve encountered some checksum values that are in base 64. Instead of reinventing the wheel to do the same stuff for base64 checksum, I was wondering if there is a way to convert a base64 value to a hex value using Qt or KDE libs . This way I’d save myself from writing semi duplicate code to do the almost similar task.
Here is how it should work:
Input: VO2S9pgCq1lqgTFTKssVj6amn0npNdagtjI8ziDtiRQ=
Output: 54ed92f69802ab596a8131532acb158fa6a69f49e935d6a0b6323cce20ed8914
The input is contained in a QString.
Also in case there is no built in support in Qt/KDE can you suggest me a method in C++ ?
This is what I tried right now:
Probably there’s a more correct way to do it, but I’m too sleepy right now, sorry.
As a function:
or simply..
Edit 1: with Qt5 you should use
QString::toLatin1()instead ofQString::toAscii().