xpam/bnethash.cpp
/*
 * Fill 16 elements of the array of 32 bit values with the bytes from
 * dst up to count in little endian order. Fill left over space with
 * zeros. In case of SHA1 hash variant a binary 1 is appended after
 * the actual data.
 */
Fill 16 elements of the array of 32 bit values with the bytes from
dst up to count in little endian order. Fill left over space with
zeros. In case of SHA1 hash variant a binary 1 is appended after
the actual data.
Fill 16 elements of the array of 32 bit values with the bytes from dst up to count in little endian order . Fill left over space with zeros . In case of SHA1 hash variant a binary 1 is appended after the actual data .
void Bnethash::hash_set_16(uint32_t * dst, unsigned char const * src, unsigned int count,
                             t_hash_variant hash_variant) {
    unsigned int i;
    unsigned int pos;
    for (pos=0,i=0; i<16; i++) {
        dst[i] = 0;
        if (hash_variant == do_blizzard_hash) {
            if (pos<count)
                dst[i] |= ((uint32_t)src[pos]);
        }
        else {
            if (pos<count)
                dst[i] |= ((uint32_t)src[pos])<<24;
            else if (pos==count)
                dst[i] |= ((uint32_t)0x80000000);
        }
        pos++;
        if (hash_variant == do_blizzard_hash) {
            if (pos<count)
                dst[i] |= ((uint32_t)src[pos])<<8;
        }
        else {
            if (pos<count)
                dst[i] |= ((uint32_t)src[pos])<<16;
            else if (pos==count)
                dst[i] |= ((uint32_t)0x800000);
        }
        pos++;
        if (hash_variant == do_blizzard_hash) {
            if (pos<count)
                dst[i] |= ((uint32_t)src[pos])<<16;
        }
        else {
            if (pos<count)
                dst[i] |= ((uint32_t)src[pos])<<8;
            else if (pos==count)
                dst[i] |= ((uint32_t)0x8000);
        }
        pos++;
        if (hash_variant == do_blizzard_hash) {
            if (pos<count)
                dst[i] |= ((uint32_t)src[pos])<<24;
        }
        else {
            if (pos<count)
                dst[i] |= ((uint32_t)src[pos]);
            else if (pos==count)
                dst[i] |= ((uint32_t)0x80);
        }
        pos++;
    }
}
void Bnethash :: hash_set_16 ( uint32_t * dst , unsigned char const * src , unsigned int count , t_hash_variant hash_variant ) { unsigned int i ; unsigned int pos ; for ( pos = 0 , i = 0 ; i < 16 ; i ++ ) { dst [ i ] = 0 ; if ( hash_variant == do_blizzard_hash ) { if ( pos < count ) dst [ i ] |= ( ( uint32_t ) src [ pos ] ) ; } else { if ( pos < count ) dst [ i ] |= ( ( uint32_t ) src [ pos ] ) << 24 ; else if ( pos == count ) dst [ i ] |= ( ( uint32_t ) 0x80000000 ) ; } pos ++ ; if ( hash_variant == do_blizzard_hash ) { if ( pos < count ) dst [ i ] |= ( ( uint32_t ) src [ pos ] ) << 8 ; } else { if ( pos < count ) dst [ i ] |= ( ( uint32_t ) src [ pos ] ) << 16 ; else if ( pos == count ) dst [ i ] |= ( ( uint32_t ) 0x800000 ) ; } pos ++ ; if ( hash_variant == do_blizzard_hash ) { if ( pos < count ) dst [ i ] |= ( ( uint32_t ) src [ pos ] ) << 16 ; } else { if ( pos < count ) dst [ i ] |= ( ( uint32_t ) src [ pos ] ) << 8 ; else if ( pos == count ) dst [ i ] |= ( ( uint32_t ) 0x8000 ) ; } pos ++ ; if ( hash_variant == do_blizzard_hash ) { if ( pos < count ) dst [ i ] |= ( ( uint32_t ) src [ pos ] ) << 24 ; } else { if ( pos < count ) dst [ i ] |= ( ( uint32_t ) src [ pos ] ) ; else if ( pos == count ) dst [ i ] |= ( ( uint32_t ) 0x80 ) ; } pos ++ ; } }
Fill 16 elements of the array of 32 bit values with the bytes from
 dst up to count in little endian order.
Fill 16 elements of the array of 32 bit values with the bytes from dst up to count in little endian order .