@@ -27,10 +27,19 @@ typedef struct {
2727 uint32_t start ; // starting candidate (inclusive)
2828 uint32_t end ; // ending candidate (exclusive)
2929 int key_mode ; // 0 to 3 (i.e. brute force segment 1-4 as 0-indexed)
30- unsigned char init_ciphertext [BLOCK_SIZE ];
31- unsigned char prev_ciphertext [BLOCK_SIZE ]; // "IV" of ciphertext for CBC mode in reader mode
32- unsigned char ciphertext [BLOCK_SIZE ];
33- unsigned char base_key [KEY_SIZE ]; // the 3DES base key provided by the user
30+ union {
31+ unsigned char init_ciphertext [BLOCK_SIZE ];
32+ uint64_t init_ciphertext_u64 ;
33+ };
34+ union {
35+ unsigned char prev_ciphertext [BLOCK_SIZE ]; // "IV" of ciphertext for CBC mode in reader mode
36+ uint64_t prev_ciphertext_u64 ;
37+ };
38+ union {
39+ unsigned char ciphertext [BLOCK_SIZE ];
40+ uint64_t ciphertext_u64 ;
41+ };
42+ unsigned char base_key [KEY_SIZE ]; // the 3DES base key provided by the user
3443 int thread_id ;
3544 lfsr_t lfsr_type ;
3645 bool is_reader_mode ; // true for -r mode, false for -c mode
@@ -189,7 +198,7 @@ static void *worker(void *arg) {
189198 & fixed_schedule , & candidate_schedule , & fixed_schedule , DES_DECRYPT );
190199 }
191200 // Apply XOR block to the second decrypted block (for CBC mode)
192- out ^= * ( uint64_t * ) targs -> prev_ciphertext ;
201+ out ^= targs -> prev_ciphertext_u64 ;
193202
194203 // Check if out is 8-bit (1-byte) left rotated version of init_out
195204 // Need to convert to big-endian for byte rotation, then back to little-endian
0 commit comments