当前位置:网站首页>QT large file generation MD5 check code
QT large file generation MD5 check code
2022-06-27 21:52:00 【Oriental forgetfulness】
Common types
enumeration QCryptographicHash::Algorithm:
QCryptographicHash::Md4 0 Generate a MD4 hash
QCryptographicHash::Md5 1 Generate a MD5 hash
QCryptographicHash::Sha1 2 Generate a SHA-1 hash
QCryptographicHash::Sha224 3 Generate a SHA-224 hash (SHA-2)
QCryptographicHash::Sha256 4 Generate a SHA-256 hash (SHA-2)
QCryptographicHash::Sha384 5 Generate a SHA-384 hash (SHA-2)
QCryptographicHash::Sha512 6 Generate a SHA-512 hash (SHA-2)
QCryptographicHash::Sha3_224 7 Generate a SHA3-224 hash
QCryptographicHash::Sha3_256 8 Generate a SHA3-256 hash
QCryptographicHash::Sha3_384 9 Generate a SHA3-384 hash
QCryptographicHash::Sha3_512 10 Generate a SHA3-512 hash
QString MakeMd5(const QString &sourceFilePath)
{
QFile sourceFile(sourceFilePath);
qint64 fileSize = sourceFile.size();
const qint64 bufferSize = 1024*10;
if (sourceFile.open(QIODevice::ReadOnly)) {
char buffer[bufferSize];
int bytesRead;
int readSize = qMin(fileSize, bufferSize);
QCryptographicHash hash(QCryptographicHash::Md5);
while (readSize > 0 && (bytesRead = sourceFile.read(buffer, readSize)) > 0) {
fileSize -= bytesRead;
hash.addData(buffer, bytesRead);
readSize = qMin(fileSize, bufferSize);
}
sourceFile.close();
return QString(hash.result().toHex());
}
return QString();
}
边栏推荐
- 快速excel导出
- Yu Wenwen, Hu Xia and other stars take you to play with the party. Pipi app ignites your summer
- "Apprendre cette image" apparaît sur le Bureau win11 comment supprimer
- Go from introduction to practice - Interface (notes)
- [LeetCode]513. Find the value in the lower left corner of the tree
- [LeetCode]508. 出現次數最多的子樹元素和
- 猜拳游戏专题训练
- Acwing周赛57-最长连续子序列-(二分or树状数组)
- [LeetCode]572. A subtree of another tree
- [LeetCode]572. 另一棵树的子树
猜你喜欢
Codeforces Round #719 (Div. 3)
Special training of guessing game
流程控制任务
Go从入门到实战——依赖管理(笔记)
Simulink导出FMU模型文件方法
What is the core competitiveness of front-line R & D personnel aged 35~40 in this position?
Yu Wenwen, Hu Xia and other stars take you to play with the party. Pipi app ignites your summer
At 19:00 on Tuesday evening, the 8th live broadcast of battle code Pioneer - how to participate in openharmony's open source contribution in multiple directions
Interval DP of Changyou dynamic programming
CEPH distributed storage
随机推荐
win11桌面出现“了解此图片”如何删除
Quick excel export
Quick excel export according to customized excel Title Template
qt base64加解密
SQL必需掌握的100个重要知识点:过滤数据
Yu Wenwen, Hu Xia and other stars take you to play with the party. Pipi app ignites your summer
SQL必需掌握的100个重要知识点:用通配符进行过滤
GBase 8a OLAP函数group by grouping sets的使用样例
空指针异常
关于异常处理的知识整理
gomock mockgen : unknown embedded interface
qt 大文件生成md5校验码
SQL必需掌握的100个重要知识点:创建计算字段
Go from starting to Real - Interface (note)
vmware虚拟机PE启动
Knowledge sorting of exception handling
matlab查找某一行或者某一列在矩阵中的位置
[LeetCode]515. 在每个树行中找最大值
创建对象时JVM内存结构
Go from introduction to actual combat - all tasks completed (notes)