static void init(void) { DES_std_init(); #if DES_BS DES_bs_init(0); DES_std_set_salt(0); DES_count = 1; #else current_salt = -1; #endif }
static void set_key(char *key, int index) { char *ptr, *chr; int pos, word; unsigned ARCH_WORD block[2]; union { double dummy; DES_binary binary; } aligned; char chars[8]; #if DES_BS char *final = key; #endif DES_std_set_key(key); for (pos = 0, ptr = key; pos < 8 && *ptr; pos++, ptr++); block[1] = block[0] = 0; while (*ptr) { ptr -= 8; for (word = 0; word < 2; word++) for (pos = 0; pos < 4; pos++) block[word] ^= (ARCH_WORD)*ptr++ << (1 + (pos << 3)); #if !DES_BS if (current_salt) DES_std_set_salt(current_salt = 0); DES_count = 1; #endif DES_std_set_block(block[0], block[1]); DES_std_crypt(DES_KS_current, aligned.binary); DES_std_get_block(aligned.binary, block); chr = chars; for (word = 0; word < 2; word++) for (pos = 0; pos < 4; pos++) { *chr++ = 0x80 | ((block[word] >> (1 + (pos << 3))) ^ *ptr); if (*ptr) ptr++; } #if DES_BS final = chars; if (*ptr) #endif DES_raw_set_key(chars); }
static void init(struct fmt_main *self) { DES_std_init(); #if DES_BS DES_bs_init(0, (DES_bs_cpt + 28) / 29); #if DES_bs_mt fmt_BSDI.params.min_keys_per_crypt = DES_bs_min_kpc; fmt_BSDI.params.max_keys_per_crypt = DES_bs_max_kpc; #endif DES_std_set_salt(0); DES_count = 1; #else current_salt = -1; #endif buffer = mem_alloc_tiny( sizeof(*buffer) * fmt_BSDI.params.max_keys_per_crypt, MEM_ALIGN_CACHE); }
static void set_salt(void *salt) { DES_std_set_salt(*(ARCH_WORD *)salt); }