security.Digest.CreateDigestString

Creates a SHA1 digest from the given string.

Syntax

security.Digest.CreateDigestString(
   password STRING,
   randBase64 STRING )
  RETURNING result STRING
  1. password is the password to be digested.
  2. randBase64 is a random string in Base64.
  3. result is a base64 encoded string.

Usage

Computes the SHA1 digest from a password value and an optional randBase64 random Base64 form string, and returns it into a string encoded in Base64 form.

The random value must be a valid Base64 String. You typically generate this value with the security.RandomGenerator.CreateRandomString() method.

In case of error, the method throws an exception and sets the STATUS variable. Depending on the error, a human-readable description of the problem is available in the SQLCA.SQLERRM register. See Error handling in GWS calls (STATUS).

Example

DEFINE password, digest STRING
...
LET digest =
    security.Digest.CreateDigestString(
       password,
       security.RandomGenerator.CreateRandomString(16) )