Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sqlite qcryptographicshash::Md5和bash md5sum_Sqlite_Qt_Md5sum - Fatal编程技术网

Sqlite qcryptographicshash::Md5和bash md5sum

Sqlite qcryptographicshash::Md5和bash md5sum,sqlite,qt,md5sum,Sqlite,Qt,Md5sum,我需要将sqlite数据库与唯一的外部文件链接在一起。为了确保这一点,我创建了一个存储文件哈希的表,并遇到了以下问题-QCryptographicshash::Md5 result与bash md5sum result不同。谁能说我做错了什么?我的代码: int main(int argc, char *argv[]) { QFile file(argv[0]); if (!file.open(QIODevice::ReadOnly)) return -1; Q

我需要将sqlite数据库与唯一的外部文件链接在一起。为了确保这一点,我创建了一个存储文件哈希的表,并遇到了以下问题-QCryptographicshash::Md5 result与bash md5sum result不同。谁能说我做错了什么?我的代码:

int main(int argc, char *argv[]) {

     QFile file(argv[0]);

     if (!file.open(QIODevice::ReadOnly)) return -1;
     QByteArray byteArray = file.readAll();

     QByteArray md5=QCryptographicHash::hash(byteArray,QCryptographicHash::Md5);

     qDebug()<<md5.toHex();

     return 0;
 }
intmain(intargc,char*argv[]){
QFile文件(argv[0]);
如果(!file.open(QIODevice::ReadOnly))返回-1;
QByteArray byteArray=file.readAll();
QByteArray md5=QCryptographicHash::hash(byteArray,QCryptographicHash::md5);

qDebug()在我的机器上,该代码似乎给出了与md5sum相同的结果。是否总是发生这种情况…例如,在一个只包含字母“a”的文件中?(对于这样一个只包含“a”和换行符的两字节文件,我得到了
bf072e9119077b4e76437a93986787ef
)Ops,你是对的,我给了一个错误的输入链接。无论如何,谢谢