07-31-2022, 10:48 AM
I found another md5 calc ,so that it is easier to calc 262144 bytes.
Please correct me if I am wrong
Please correct me if I am wrong
Code:
std::string MD5_262144_File(const Path filename) {
std::ifstream is(filename.c_str(), std::ifstream::binary);
md5_context c;
md5_starts(&c);
char buf[256];
// 256 * 1024 = 262144 byte
for (size_t i = 0; i < 1024; ++i) {
is.read(buf, sizeof(buf));
md5_update(&c, (unsigned char*)buf, is.gcount());
}
unsigned char out[16];
md5_finish(&c, out);
std::string res;
for (size_t i = 0; i < 16; ++i) {
res.push_back(hb2hex(out[i] >> 4));
res.push_back(hb2hex(out[i]));
}
return res;
}
I want to be a crash fixer
PM me if you want to me look a game
PM me if you want to me look a game

