Crypto++ Setup in Linux

Download Crypto++ library source from

Unzip it and put it in a convenient location

Go inside the directory and run

make install

It will install the library in default location

Write the program as shown below to calculate MD5sum

#include <ctime>
#include <iostream>
#include "cryptopp565/modes.h"
#include "cryptopp565/md5.h"
#include "cryptopp565/hex.h"
using namespace std;

string getMD5Hash(string message){
	CryptoPP::Weak::MD5 hash;
	byte digest[ CryptoPP::Weak::MD5::DIGESTSIZE ];

	hash.CalculateDigest( digest, (byte*) message.c_str(), message.length() );

	CryptoPP::HexEncoder encoder;
	string output;
	encoder.Attach( new CryptoPP::StringSink( output ) );
	encoder.Put( digest, sizeof(digest) );

	cout << "Calculated MD5 Hash. Mesage: " << message << " | hash: " << output << endl;

	return output;

int main()
	cout << getMD5Hash("Hello World!") << endl;

	return 0;

Then we can compile it using -L/usr/local/lib -lcryptopp flag.

g++ -std=c++11 main.cpp -L/usr/local/lib -lcryptopp

Crypto++ library is very vast. This is a simple example of finding MD5sum.