C
C
Compute Glacier SHA256 Linear Hash of a File
See more Amazon Glacier Examples
Computes the Amazon Glacier SHA256 linear hash for a file.Chilkat C Downloads
#include <C_CkCrypt2.h>
void ChilkatSample(void)
{
HCkCrypt2 crypt;
const char *linearHashHex;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
crypt = CkCrypt2_Create();
// The "linear hash" is simply the SHA256 hash of the file bytes.
CkCrypt2_putHashAlgorithm(crypt,"sha256");
// Return the hash in lowercase hexidecimal format.
CkCrypt2_putEncodingMode(crypt,"hexlower");
linearHashHex = CkCrypt2_hashFileENC(crypt,"qa_data/jpg/penguins.jpg");
printf("SHA256 linear hash = %s\n",linearHashHex);
CkCrypt2_Dispose(crypt);
}