Sample code for 30+ languages & platforms
C

MD4 Hash a String

See more Encryption Examples

MD4 hash a string.

Chilkat C Downloads

C
#include <C_CkCrypt2.h>

void ChilkatSample(void)
    {
    HCkCrypt2 crypt;
    const char *content;
    const char *hashStr;

    //  This example assumes the Chilkat API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.

    crypt = CkCrypt2_Create();

    content = "The quick brown fox jumps over the lazy dog";

    //  The desired output is a hexidecimal string:
    CkCrypt2_putEncodingMode(crypt,"hex");

    //  Set the hash algorithm:
    CkCrypt2_putHashAlgorithm(crypt,"md4");

    hashStr = CkCrypt2_hashStringENC(crypt,content);

    printf("%s\n",hashStr);

    //  The output is:
    //  1BEE69A46BA811185C194762ABAEAE90


    CkCrypt2_Dispose(crypt);

    }