assistance-engine/docs/developer.avapframework.com/appendices_8.md

1.2 KiB

encodeSHA256()

The encodeSHA256() command generates a SHA-256 hash of the provided string and stores the result in a target variable. SHA-256 is a cryptographic hash function that produces a 256-bit value (64 hexadecimal characters), offering greater security compared to MD5.

Parameters

  • SourceVariable Type: var Description: The variable containing the text string to be encoded in SHA-256. It can be a direct value or a variable storing the input string.
  • TargetVariable Type: var Description: The variable in which the resulting SHA-256 hash will be stored. Unlike the SourceVariable parameter, this must be a variable and not a direct value.

Usage Example

// Direct call with values:
encodeSHA256('example_string', sha256Hash)

// Call using variables:
text = 'example_string'
hashVariable = 'sha256Hash'
encodeSHA256(text, hashVariable)

In the first example, a SHA-256 hash is generated from the string 'example_string' and stored in the sha256Hash variable. In the second example, a variable text is used to define the input string, and another variable hashVariable is used to store the resulting SHA-256 hash.