Kernel 8.0 APIs Banner
Office of Information and Technology (OIT) Banner
[skip navigation]

$$SHAHASH^XUSHSH(): Returns SHA Hash for a String Entry

Reference Type: Supported, Category: Data Security, ICR#: 6189

Description

The $$SHAHASH^XUSHSH extrinsic function returns the Secure Hash Algorithm (SHA) hash for a string entry. It uses an input variable to specify the length in bits of the desired hash.

NOTE: This API was released with Kernel Patch XU*8.0*655.

Format

  $$SHAHASH^XUSHSH(n,x[,flag])

Input Parameters

n:

(required) Length in bits of the desired hash:

  • 160 (SHA-1)

  • 224 (SHA-224)

  • 256 (SHA-256)

  • 384 (SHA-384)

  • 512 (SHA-512)
x: (required) String to be hashed.
flag:

(optional) Flag to control format of hash:

  • H—Hexadecimal (default)

  • B—Base64 Encoded

Output

returns:

Returns SHA hash for a string entry.

Examples

Example 1

>W $$SHAHASH^XUSHSH(256,"This is a test")
C7BE1ED902FB8DD4D48997C6452F5D7E509FBCDBE2808B16BCF4EDCE4C07D14E

Example 2

>W $$SHAHASH^XUSHSH(256,"This is a test","B")
x74e2QL7jdTUiZfGRS9dflCfvNvigIsWvPTtzkwH0U4=