src/lib/sha1.c
int SHA1Final(SHA1Context *context,
              uint8_t Message_Digest[SHA1HashSize])
{
    int i;

    if (!context || !Message_Digest) {
        return shaNull;
    }

    if (context->Corrupted) {
        return context->Corrupted;
    }

    if (!context->Computed) {
        SHA1PadMessage(context);
        for(i=0; i<64; ++i) {
            /* message may be sensitive, clear it out */
            context->Message_Block[i] = 0;
        }
        context->Length_Low = 0;    /* and clear length */
        context->Length_High = 0;
        context->Computed = 1;

    }

    for(i = 0; i < SHA1HashSize; ++i) {
        Message_Digest[i] = context->Intermediate_Hash[i>>2]
                            >> 8 * ( 3 - ( i & 0x03 ) );
    }

    return shaSuccess;
}
/*
 *  SHA1Final
 *
 *  Description:
 *      This function will return the 160-bit message digest into the
 *      Message_Digest array  provided by the caller.
 *      NOTE: The first octet of hash is stored in the 0th element,
 *            the last octet of hash in the 19th element.
 *
 *  Parameters:
 *      context: [in/out]
 *          The context to use to calculate the SHA-1 hash.
 *      Message_Digest: [out]
 *          Where the digest is returned.
 *
 *  Returns:
 *      sha Error Code.
 *
 */
SHA1Final
Description:
This function will return the 160-bit message digest into the
Message_Digest array  provided by the caller.
NOTE: The first octet of hash is stored in the 0th element,
the last octet of hash in the 19th element.

[in/out]
The context to use to calculate the SHA-1 hash.
Message_Digest: [out]
Where the digest is returned.

sha Error Code.
SHA1Final Description : This function will return the 160 - bit message digest into the Message_Digest array provided by the caller . NOTE : The first octet of hash is stored in the 0th element the last octet of hash in the 19th element . [ in / out ] The context to use to calculate the SHA - 1 hash . Message_Digest : [ out ] Where the digest is returned . sha Error Code .
int SHA1Final(SHA1Context *context,
              uint8_t Message_Digest[SHA1HashSize])
{
    int i;
    if (!context || !Message_Digest) {
        return shaNull;
    }
    if (context->Corrupted) {
        return context->Corrupted;
    }
    if (!context->Computed) {
        SHA1PadMessage(context);
        for(i=0; i<64; ++i) {
            context->Message_Block[i] = 0;
        }
        context->Length_Low = 0;    
        context->Length_High = 0;
        context->Computed = 1;
    }
    for(i = 0; i < SHA1HashSize; ++i) {
        Message_Digest[i] = context->Intermediate_Hash[i>>2]
                            >> 8 * ( 3 - ( i & 0x03 ) );
    }
    return shaSuccess;
}
int SHA1Final ( SHA1Context * context , uint8_t Message_Digest [ SHA1HashSize ] ) { int i ; if ( ! context || ! Message_Digest ) { return shaNull ; } if ( context -> Corrupted ) { return context -> Corrupted ; } if ( ! context -> Computed ) { SHA1PadMessage ( context ) ; for ( i = 0 ; i < 64 ; ++ i ) { context -> Message_Block [ i ] = 0 ; } context -> Length_Low = 0 ; context -> Length_High = 0 ; context -> Computed = 1 ; } for ( i = 0 ; i < SHA1HashSize ; ++ i ) { Message_Digest [ i ] = context -> Intermediate_Hash [ i >> 2 ] >> 8 * ( 3 - ( i & 0x03 ) ) ; } return shaSuccess ; }
SHA1Final
  Description:
      This function will return the 160-bit message digest into the
      Message_Digest array  provided by the caller.
SHA1Final Description : This function will return the 160 - bit message digest into the Message_Digest array provided by the caller .
/* message may be sensitive, clear it out */ /* and clear length */