Chinaunix首页 | 论坛 | 博客
  • 博客访问: 84912
  • 博文数量: 3
  • 博客积分: 195
  • 博客等级: 入伍新兵
  • 技术积分: 40
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-03 18:55
文章分类

全部博文(3)

文章存档

2011年(2)

2010年(1)

分类: C/C++

2011-08-30 13:01:34

  1. #include <QByteArray>
  2. #include <QFile>
  3. #include <QCryptographicHash>
  4. #include <QDebug>
  5. int main(int argc, char **argv)
  6. {
  7.     QString filePath = argv[1];
  8.     QFile theFile(filePath);
  9.     theFile.open(QIODevice::ReadOnly);
  10.     QByteArray ba = QCryptographicHash::hash(theFile.readAll(),QCryptographicHash::Md5);
  11.     theFile.close();
  12.     qDebug() << ba.toHex().constData();
  13. }

注:argv[1]就是要计算MD5的文件路径。

阅读(4598) | 评论(0) | 转发(0) |
0

上一篇:博客已升级,请注意变更地址

下一篇:没有了

给主人留下些什么吧!~~