src/wrbuf_sha1.c
static void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
{
    unsigned i;
    unsigned char finalcount[8];
    unsigned char c;

    for (i = 0; i < 8; i++) {
        finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
         >> ((3-(i & 3)) * 8) ) & 255);  /* Endian independent */
    }
    c = 0200;
    SHA1Update(context, &c, 1);
    while ((context->count[0] & 504) != 448) {
	c = 0000;
        SHA1Update(context, &c, 1);
    }
    SHA1Update(context, finalcount, 8);  /* Should cause a SHA1Transform() */
    for (i = 0; i < 20; i++) {
        digest[i] = (unsigned char)
         ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
    }
    /* Wipe variables */
    memset(context, '\0', sizeof(*context));
    memset(&finalcount, '\0', sizeof(finalcount));
}
/* Add padding and return the message digest. */
Add padding and return the message digest.
Add padding and return the message digest .
static void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
{
    unsigned i;
    unsigned char finalcount[8];
    unsigned char c;
    for (i = 0; i < 8; i++) {
        finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
         >> ((3-(i & 3)) * 8) ) & 255);  
    }
    c = 0200;
    SHA1Update(context, &c, 1);
    while ((context->count[0] & 504) != 448) {
	c = 0000;
        SHA1Update(context, &c, 1);
    }
    SHA1Update(context, finalcount, 8);  
    for (i = 0; i < 20; i++) {
        digest[i] = (unsigned char)
         ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
    }
    memset(context, '\0', sizeof(*context));
    memset(&finalcount, '\0', sizeof(finalcount));
}
static void SHA1Final ( unsigned char digest [ 20 ] , SHA1_CTX * context ) { unsigned i ; unsigned char finalcount [ 8 ] ; unsigned char c ; for ( i = 0 ; i < 8 ; i ++ ) { finalcount [ i ] = ( unsigned char ) ( ( context -> count [ ( i >= 4 ? 0 : 1 ) ] >> ( ( 3 - ( i & 3 ) ) * 8 ) ) & 255 ) ; } c = 0200 ; SHA1Update ( context , & c , 1 ) ; while ( ( context -> count [ 0 ] & 504 ) != 448 ) { c = 0000 ; SHA1Update ( context , & c , 1 ) ; } SHA1Update ( context , finalcount , 8 ) ; for ( i = 0 ; i < 20 ; i ++ ) { digest [ i ] = ( unsigned char ) ( ( context -> state [ i >> 2 ] >> ( ( 3 - ( i & 3 ) ) * 8 ) ) & 255 ) ; } memset ( context , ' \0 ' , sizeof ( * context ) ) ; memset ( & finalcount , ' \0 ' , sizeof ( finalcount ) ) ; }
Add padding and return the message digest.
Add padding and return the message digest .
/* Endian independent */ /* Should cause a SHA1Transform() */ /* Wipe variables */