VerifyHash function
Syntax
VerifyHash(cleartext_string, salt_string, hashed_string)
Description
Use the VerifyHash function to verify that the combination of an input clear text string plus salt string generates a hashed value that is the same as a hashed string generated by the HashWithSalt function.
The VerifyHash function is general purpose, in that it can be used for any clear text string that has been hashed with the HashWithSalt function. Use the VerifyOprPassword function instead when the input clear text is a user’s password that has been stored in the database as a hashed value.
Parameters
| Parameter | Description |
|---|---|
|
cleartext_string |
Specifies the string to be verified as a string value. |
|
salt_string |
Specifies the salt value as a string value. Important: The salt value must be exactly the same as the randomly generated salt value used to hash the original string. |
|
hashed_string |
Specifies the hashed value to be compared to the output of the hash algorithm. |
Returns
A Boolean value: True if the input string plus salt value generate the hashed text, False otherwise.
Example
Local array of string &salt;
&salt = SecureRandomGen();
&hashedtext = HashWithSalt(&cleartext, &salt [1]);
MY_REC.MY_HTEXT = &hashedtext;
MY_REC.MY_SALT = &salt [1];
/*** other processing ***/
If Not VerifyHash(&cleartext, MY_REC.MY_SALT, MY_REC.MY_HTEXT) Then
rem they don't match, throw error;
Error MsgGet(10001, 1, "Message not found");
End-If;