Sample code for 30+ languages & platforms
Unicode C

MD4 Hash a String

See more Encryption Examples

MD4 hash a string.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkCrypt2W.h>

void ChilkatSample(void)
    {
    HCkCrypt2W crypt;
    const wchar_t *content;
    const wchar_t *hashStr;

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

    crypt = CkCrypt2W_Create();

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

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

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

    hashStr = CkCrypt2W_hashStringENC(crypt,content);

    wprintf(L"%s\n",hashStr);

    // The output is:
    // 1BEE69A46BA811185C194762ABAEAE9


    CkCrypt2W_Dispose(crypt);

    }