C++ – How to Calculate the MD5 and SHA checksum of a huge file

cchecksumiomd5sha

I want to calculate the MD5 and SHA checksum of a series of huge files.
Each file is about 1GB, so I wish to be as fast as possible.

Could anyone help to recommend some efficient C++ library?

BTW,

When reading file, fread( buffer, sizeof(char), BUFFER_SIZE, fin ), what size of BUFFER_SIZE is reasonable?

Best Answer

You could use Openssl. Search for Mysticial answer about MD5 large file How to create a md5 hash of a string in C? When you look into Openssl SHA docs you will see that MD5 and SHA ways of using these functions are the same. SHA Openssl Docs