Skip to content

IGR_Calculate_SHA1

IGR_Calculate_SHA1 will calculate the SHA1 hash of an input stream for unique document identification.

Prototype

IGR_LONG IGR_Calculate_SHA1(
    IGR_Stream *Stream,
    IGR_UCS2* Name,
    Error_Control_Block* ISYSError);

Parameters

Stream: IGR_Stream **

An open IGR_Stream.

Name: Unicode string (UCS2)

A buffer to receive the null-terminated SHA1 hash (as a Unicode string). Must be allocated by the caller and be able to hold at least 41 UCS2 characters.

ISYSError: Pointer to Error_Control_Block

Returns error details if the call fails.

Return value

Success: IGR_LONG

Returns IGR_OK.

Failure: IGR_LONG

Returns one of the possible IGR_E error codes.

Sample code

IGR_UCS2 strHexOut[ISYS_SZ_SHA1_HEX_LEN];
Error_Control_Block ISYSError;

IGR_LONG RC = IGR_Calculate_SHA1(pStream, strHexOut, &ISYSError);

if (RC == IGR_OK)
    // strHexOut will now contain a SHA1 hash for the stream expressed as
    // hexadecimal characters

Additional information

The stream must be created by one of the IGR stream creation functions or a custom IGR stream that has been opened.