I have code, which generate md5 for strings. Now I want to add generation md5 for files. It work's with txt files(xml, html, txt etc), but when I try to do it with binary file(zip, bin, apk, etc) I see wrong result. How can I correctly read bin file in (char*) in order to generate valid hash?
I tried to use TextStream, but result is not valid
QFile file(fileName);
file.open(QIODevice::ReadOnly);
QTextStream in(&file);
QString t = in.readAll();
file.close();
string res = md5(t.toStdString());
Also I tried to use QByteArray and after that convert byteArray to char* But it doesn't work correctly too. How can I fix it?