| 211 | } |
| 212 | |
| 213 | bool save_file(const std::vector<patch_byte> &pvec, std::string fname) |
| 214 | { |
| 215 | FILE *f = fopen(fname.c_str(), "wb"); |
| 216 | if (!f) |
| 217 | { |
| 218 | cerr << "Cannot open file: " << fname << endl; |
| 219 | return false; |
| 220 | } |
| 221 | |
| 222 | size_t cnt = fwrite(pvec.data(), 1, pvec.size(), f); |
| 223 | fclose(f); |
| 224 | |
| 225 | return cnt == pvec.size(); |
| 226 | } |
| 227 | |
| 228 | std::string compute_hash(const std::vector<patch_byte> &pvec) |
| 229 | { |