MyChat Scripts Engine: HMAC_SHA1
Function to obtain a hash code based on the key using HMAC method and SHA1 hashing algorithm.
Syntax
function HMAC_SHA1(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_SHA1(sMessage, sKey)), 'HMAC-SHA1');
end.
Script work result
[23:01:10] (Log "HMAC_SHA1"): Original message: Have a nice day!
[23:01:10] (Log "HMAC_SHA1"): Secret key: trololo
[23:01:11] (Log "HMAC_SHA1"): [HMAC-SHA1] d61c43b1fa53b48078e0bc33d6edabd573718d30
[23:01:11] (Run "HMAC_SHA1"): Script operation time: 7 ms
[23:01:11] (Run "HMAC_SHA1"): Script done successfully.