QCryptographicHash::Md5 return a different value then md5sum linux command
-
wrote on 6 Dec 2017, 12:15 last edited by
I'm playing with some script and building an server with socat to share some informations with QT client.
Currently, I'm using:
QByteArray d; d.append("BUSNUM=" + match.captured(4) + ";DEVNUM=" + match.captured(5) + ";ACTION=" + match.captured(6) + ";ID_VENDOR_ENC=" + match.captured(7)); QString md5 = QString(QCryptographicHash::hash(d,QCryptographicHash::Md5).toHex());
Unfortunately, this value is different the one returned by md5sum linux command.
For computing this value, is there something that should be written in a different way ?
-
@mrjj Seems the same, but, when building the payload, I'm already using a redirection like:
md5sum <<< payload
Lifetime Qt Championwrote on 6 Dec 2017, 12:46 last edited by mrjj 12 Jun 2017, 13:22But the good news it should give same result if presented with same input so
So check you
QByteArray d;
against your payload. -
@mrjj Seems the same, but, when building the payload, I'm already using a redirection like:
md5sum <<< payload
wrote on 6 Dec 2017, 12:58 last edited by@Catalin-O Just guessing, but because md5sum <<< payload is the same as
md5sum <Enter> payload <Enter>
i.e. it never checks for a file called payload or anything inside it, it only md5sums those 7 letters and a linefeed.
Maybe
md5sum payload
is what you want, it sums the contents of the file. -
But the good news it should give same result if presented with same input so
So check you
QByteArray d;
against your payload.wrote on 6 Dec 2017, 13:05 last edited by Catalin.O 12 Jun 2017, 13:08@mrjj said in QCryptographicHash::Md5 return a different value then md5sum linux command:
against your payload.
Thank you for support
I managed to find the issue.
The problem is the redirection that I made.
md5sum <<< text
you right
1/6