find ... -exec sha1sumnot sure on the reason why. However, since I had problems figuring out how to do it I figure I'll post a basic sha1sum program that I made with the help of people on the Crypto++ Mailing List.
Include's are mangled due to blogger filtering
#include < cryptopp/sha.h >
#include < cryptopp/hex.h >
#include < cryptopp/files.h >
#include < string >
#include < iostream >
using namespace std;
int main(int argc, char *argv)
char *file = argv;
CryptoPP::FileSource( ( file ),true,
hash, new CryptoPP::HexEncoder(
new CryptoPP::StringSink(result), false)
cout << result << endl;
it can be built with.
g++ sha1.cpp -lcryptopp -o sha1sum
and tested with
It's not meant to be a exactly compatible implementation of sha1sum. it doesn't output the filename, it isn't capable of handling more than one file argument, and if no argument is provided it crashes. I know I haven't actually explained how the crypo++ code works, but I hope just posting this here will help someone in the future.