static void crypt_all(int count) { int index; for (index = 0; index < count; index++) DES_std_crypt(buffer[index].aligned.data.KS, buffer[index].aligned.data.binary); }
static int crypt_all(int *pcount, struct db_salt *salt) { int count = *pcount; int index; for (index = 0; index < count; index++) DES_std_crypt(buffer[index].aligned.data.KS, buffer[index].aligned.data.binary); return count; }
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); }