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

$$LSHAN^XLFSHAN: Returns SHA Hash for a Long Message

Reference Type: Supported, Category: Data Security, Integration Agreement: 6157

Description

This extrinsic function returns the SHA hash of a message that is too long to be passed as a single string. The message is passed in ^TMP($J,MSUB). The message should be broken into blocks that are exactly 64 bytes/characters long except for the last one. ^TMP($J,MSG,N) is the Nth block of the message; where N runs from 1 to NBLOCKS.

NOTE: This API was released with Kernel patch XU*8.0*657.

Format

$$LSHAN^XLFSHAN(hashlen,msub,nblocks)

Input Parameters

hashlen (required) The hash length in bits:
  • 160 (SHA-1)
  • 224 (SHA-224)
  • 256 (SHA-256)
  • 384 (SHA-384)
  • 512 (SHA-512)
msub (required) The ^TMP($J,msub) subscript in which the message is passed.
nblocks (required) The number of blocks in the message.

Output

Output
  • SHA hash if successful.
  • Zero (0) - If there is an error.

 

Example

>S ^TMP($J,"MSG",1)="test line one"
>S ^TMP($J,"MSG",2)="test line two"
>W $$LSHAN^XLFSHAN(224,"MSG",2)
42E2C4B559757087BFA5834F43C2C50740984766910C1B4EEC79A350