MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / checkMD5

Method checkMD5

Utilities/FileSystem.h:347–361  ·  view source on GitHub ↗

Compare an MD5 hash with the hash stored in an MD5 file. */

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

failMethod · 0.80
openMethod · 0.45
c_strMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected