hmac(string Content, int Size, string Secret, int Mode): string

Generates a cryptographic hash from the string Content with an optional Secret for authentication purposes.

Parameters:

Content - Message or data to be hashed.
Size - Content size in bytes, or 0 for using the string length of Content.
Secret - Secret string for generating a cryptographic hash, or 0 for a simple SHA512 or SHA256 hash.
Mode - 512 for a HMAC512 hash, 256 for a HMAC256 hash. +64 when Secret is base64 encoded.

Returns:

Hash string of the given Content, or 0 when something was wrong.

Remarks:

Example:

char Header[1024]M
strcpy(Header,"Content-Type:application/json");
strcat(Header,"\nAccept:application/json");
strcat(Header,"\nApi-Key: ");
strcat(Header,MyKey);
strcat(Header,"\nApi-Signature: ");
strcat(Header,hmac(MyContent,0,MySecret,512));

See also:

HTTP functions, FTP functions ► latest version online