lib/keccak.c
uint8_t round_constant(uint8_t t) {
    if (t % 255 == 0)
        return (uint8_t)1;

    uint64_t r = 10000000U;
    for (int i = 1; i <= t % 255; i++) {
        r = 0 | r;
        r = set_bit(r, 0, get_bit(r, 0) ^ get_bit(r, 8));
        r = set_bit(r, 4, get_bit(r, 4) ^ get_bit(r, 8));
        r = set_bit(r, 5, get_bit(r, 5) ^ get_bit(r, 8));
        r = set_bit(r, 6, get_bit(r, 6) ^ get_bit(r, 8));
    }
    return get_bit(r, 0);
}
// Generate the round constant using a linear feedback shift register
Generate the round constant using a linear feedback shift register
Generate the round constant using a linear feedback shift register
uint8_t round_constant(uint8_t t) {
    if (t % 255 == 0)
        return (uint8_t)1;
    uint64_t r = 10000000U;
    for (int i = 1; i <= t % 255; i++) {
        r = 0 | r;
        r = set_bit(r, 0, get_bit(r, 0) ^ get_bit(r, 8));
        r = set_bit(r, 4, get_bit(r, 4) ^ get_bit(r, 8));
        r = set_bit(r, 5, get_bit(r, 5) ^ get_bit(r, 8));
        r = set_bit(r, 6, get_bit(r, 6) ^ get_bit(r, 8));
    }
    return get_bit(r, 0);
}
uint8_t round_constant ( uint8_t t ) { if ( t % 255 == 0 ) return ( uint8_t ) 1 ; uint64_t r = 10000000U ; for ( int i = 1 ; i <= t % 255 ; i ++ ) { r = 0 | r ; r = set_bit ( r , 0 , get_bit ( r , 0 ) ^ get_bit ( r , 8 ) ) ; r = set_bit ( r , 4 , get_bit ( r , 4 ) ^ get_bit ( r , 8 ) ) ; r = set_bit ( r , 5 , get_bit ( r , 5 ) ^ get_bit ( r , 8 ) ) ; r = set_bit ( r , 6 , get_bit ( r , 6 ) ^ get_bit ( r , 8 ) ) ; } return get_bit ( r , 0 ) ; }
Generate the round constant using a linear feedback shift register
Generate the round constant using a linear feedback shift register