diff --git a/des.c b/des.c index ada929c..04285c8 100644 --- a/des.c +++ b/des.c @@ -150,8 +150,11 @@ void generate_sub_keys(unsigned char* main_key, key_set* key_sets) { int shift_size; unsigned char shift_byte, first_shift_bits, second_shift_bits, third_shift_bits, fourth_shift_bits; - for (i=0; i<8; i++) { - key_sets[0].k[i] = 0; + for (i = 1; i < 17; i++) { + // Initialize the round subkey to 0 before filling it + for (int x = 0; x < 8; x++) { + key_sets[i].k[x] = 0; + } } for (i=0; i<56; i++) {