HashWithSalt
Mon 01 January 2018Syntax
HashWithSalt(cleartext_string [, &salt_string] [, hash_type] [, disallow_emptystring])
Description
Use the HashWithSalt function to generate a hashed (or âsaltedâ) string. The output is Base64 encoded. For example, use the HashWithSalt function to generate a password for storage in the database. Because the HashWithSalt function generates output from the clear text password and a randomly generated salt value, it provides more secure hashing than the Hash function.
Important! When you store a hashed password generated by HashWithSalt in PSOPRDEFN.OPERPSWD, you must also store the salt string used in PSOPRDEFN.OPERPSWDSALT.
To compare a clear text input value with an hashed value, use either the VerifyOprPassword function (for hashed and stored passwords) or the VerifyHash function for other salted strings.
Parameters
Field or Control |
Definition |
---|---|
cleartext_string |
Specifies the string, such as a password, to be hashed. |
&salt_string |
Specifies the randomly generated salt value as a string value. Important! If the supplied salt value is a null value, then the HashWithSalt function will generate a salt value that will be returned as the value of this variable or record field. |
hash_type |
Specifies the hashing algorithm to be used as a quoted literal string:
|
disallow_emptystring |
Specifies a Boolean value indicating whether to disallow an empty string as the text to be hashed. Note: The default value is False. |
Returns
A String value.