Compare an MD5 hash with the hash stored in an MD5 file. */
| 345 | /** Compare an MD5 hash with the hash stored in an MD5 file. |
| 346 | */ |
| 347 | static bool checkMD5(const std::string& md5Hash, const std::string& md5File) |
| 348 | { |
| 349 | std::ifstream fstream; |
| 350 | fstream.open(md5File.c_str(), std::ios::in); |
| 351 | if (fstream.fail()) |
| 352 | { |
| 353 | std::cerr << "Failed to open file: " << md5File << "\n"; |
| 354 | return false; |
| 355 | } |
| 356 | std::string str((std::istreambuf_iterator<char>(fstream)), |
| 357 | std::istreambuf_iterator<char>()); |
| 358 | fstream.close(); |
| 359 | |
| 360 | return str == md5Hash; |
| 361 | } |
| 362 | |
| 363 | #ifdef WIN32 |
| 364 | /** Open windows file dialog.\n |