Cinder block, that has no dependancies, for simple SHA1 hashing.
- add exception throwing on any errors (especially when trying to checksum non existing file)
Cinder comes with Boost which has
boost/uuid/sha1.hpp and of course it works, but we find this small helper class more attractive for quick checksumming files downloaded from interwebs.
fs::path pathToFile = getAssetPath("file.ext"); SHA1 mySha1; string checkSum; checkSum = mySha1.from_file( pathToFile.string() ); cinder::app::console() << "file checksum: " << checkSum << endl;
Found randomly in interwebs, located in pushover repo. All credit goes to as stated below.
============ SHA-1 in C++ ============ 100% Public Domain. Original C Code -- Steve Reid <email@example.com> Small changes to fit into bglibs -- Bruce Guenter <firstname.lastname@example.org> Translation to simpler C++ Code -- Volker Grabsch <email@example.com>