Function to obtain a hash code of a string based on the key, using HMAC method and MD5 hashing algorithm.

 

Syntax

function HMAC_MD5(sData, sKey: string): string;

 

Parameters and return values

Parameter

Type

Value

sData

string

source string;

sKey

string

key.

 

Function result

Text string, hash value.

 

Example


const
  sMessage = 'Have a nice day!';
  sKey     = 'trololo';
begin
  mLogScript('Original message: ' + sMessage, '');
  mLogScript('Secret key: ' + sKey, '');
  mLogScript(StrToHex(HMAC_MD5(sMessage, sKey)), 'HMAC-MD5');
end.


Script work result

[22:53:18] (Log "HMAC_MD5"): Original message: Have a nice day!

[22:53:18] (Log "HMAC_MD5"): Secret key: trololo

[22:53:18] (Log "HMAC_MD5"): [HMAC-MD5] 94f51d68bd28eb9c12fde9b12c44c4cc

[22:53:18] (Run "HMAC_MD5"): Script operation time: 7 ms

[22:53:18] (Run "HMAC_MD5"): Script done successfully.
 

See also

mLogScript

StrToHex