#include #include #include "Crypto.h" using namespace craftlab::fakeraid; Crypto::Crypto() { } void Crypto::Compute(const std::string& dir, FileAndSum& file) { if (file.isDir) return; const std::string path = dir + "/" + file.fileName; QFile f(path.c_str()); if (!f.open(QFile::ReadOnly)) throw std::runtime_error("Cannot open file for reading: " + path); QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); if (!hash.addData(&f)) throw std::runtime_error("Cannot read file: " + path); file.checksum = hash.result().toHex(); }