9

I'm trying to find a good (and well documented) hashing library to use with my C++ program, I only need to generate two hashes from a string.

I've tried with crypto++ and mhash and I didn't manage to make them work, also with http://www.zedwood.com/article/121/cpp-md5-function

I would be glad if this library is cross-platform.

dalle
  • 18,057
  • 5
  • 57
  • 81
0x77D
  • 1,564
  • 2
  • 18
  • 17
  • 2
    possible duplicate of [What is the best encryption library in C/C++?](http://stackoverflow.com/questions/180870/what-is-the-best-encryption-library-in-c-c) – Greg Hewgill Jan 13 '11 at 09:41

3 Answers3

7

Try this open source library http://hashlib2plus.sourceforge.net/

programmer
  • 878
  • 5
  • 8
4

Search before ask, there is already question: What is the best encryption library in C/C++?

Solutions like OpenSSL and Crypto++ are cross-platform, if you "didn't manage to make them work", you should have been more specific like: I use OS xyz version xyz, compiler xyz version xyz, IDE xyz version xyz, trying to get work library xyz version xyz from http://xyz, and it does not work, because xyz errors.

Community
  • 1
  • 1
peenut
  • 3,366
  • 23
  • 24
2

see my answer here. The original sample is taken from here, and operates on std::string rather than on std::istream. There are many good samples on cryptopp wiki, I'll try to look for some I used.

here's a sample from my code:

#include <cryptopp/md5.h>

byte digest[AES::BLOCKSIZE];
MD5().CalculateDigest(digest, (byte*)input.data(), input.size());

Here's the list of cryptopp samples on their wiki. Look at HashFunctions and HashFilter.

Community
  • 1
  • 1
davka
  • 13,974
  • 11
  • 61
  • 86