diff -x -Naur srcoriginal/DES_bs_b.c srcfinal/DES_bs_b.c 1440a1441,1467 > #if DES_bs_mt > static MAYBE_INLINE void DES_bs_finalize_keys_Oracle(int t) > #else > static MAYBE_INLINE void DES_bs_finalize_keys_Oracle(void) > #endif > { > #if DES_BS_VECTOR_LOOPS_K > int depth; > #endif > > for_each_depth_k() { > DES_bs_vector *kp = (DES_bs_vector *)&DES_bs_all.K[0] DEPTH_K; > int ic; > for (ic = 0; ic < 8; ic++) { > DES_bs_vector *vp = > (DES_bs_vector *)&DES_bs_all.xkeys.v[ic][0] DEPTH_K; > LOAD_V > FINALIZE_NEXT_KEY_BIT_0 > FINALIZE_NEXT_KEY_BIT_1 > FINALIZE_NEXT_KEY_BIT_2 > FINALIZE_NEXT_KEY_BIT_3 > FINALIZE_NEXT_KEY_BIT_4 > FINALIZE_NEXT_KEY_BIT_5 > FINALIZE_NEXT_KEY_BIT_6 > } > } > } 1453a1481,1622 > > #define set_block(i,j,k,l,m,n,o,p,q)\ > DES_bs_set_block_8(i,bit[j],bit[k],bit[l],bit[m],bit[n],bit[o],bit[p],bit[q]);\ > > void DES_bs_crypt_Oracle(int keys_count,ARCH_WORD *binary_plain_salt_mix) > { > #if DES_bs_mt > int t, n = (keys_count + (DES_BS_DEPTH - 1)) / DES_BS_DEPTH; > #endif > int i; > ARCH_WORD temp_binary_plain_salt_mix[64]; > vtype bit[64]; > > for(i=0;i<64;i++) > temp_binary_plain_salt_mix[i]=0; > > > static unsigned char DES_IP[64]={ > 57, 49, 41, 33, 25, 17, 9, 1, > 59, 51, 43, 35, 27, 19, 11, 3, > 61, 53, 45, 37, 29, 21, 13, 5, > 63, 55, 47, 39, 31, 23, 15, 7, > 56, 48, 40, 32, 24, 16, 8, 0, > 58, 50, 42, 34, 26, 18, 10, 2, > 60, 52, 44, 36, 28, 20, 12, 4, > 62, 54, 46, 38, 30, 22, 14, 6 > }; > > > #ifdef _OPENMP > #pragma omp parallel for default(none) private(t) shared(n, DES_bs_all_p, keys_count) > #endif > for_each_t(n) { > ARCH_WORD **k; > int rounds,dst; > #if DES_BS_VECTOR_LOOPS > int depth; > #endif > > for (dst = 0; dst < 64; dst++) { > int src = DES_IP[dst ^ 0x20]; > temp_binary_plain_salt_mix[dst]=binary_plain_salt_mix[src]; > > if(temp_binary_plain_salt_mix[dst]==0) > bit[dst]=vzero; > else > bit[dst]=vones; > } > > { > set_block( 0, 0, 1, 2, 3, 4, 5, 6, 7); > set_block( 8, 8, 9,10,11,12,13,14,15); > set_block(16,16,17,18,19,20,21,22,23); > set_block(24,24,25,26,27,28,29,30,31); > set_block(32,32,33,34,35,36,37,38,39); > set_block(40,40,41,42,43,44,45,46,47); > set_block(48,48,49,50,51,52,53,54,55); > set_block(56,56,57,58,59,60,61,62,63); > } > > > > #if DES_bs_mt > DES_bs_finalize_keys_Oracle(t); > #else > DES_bs_finalize_keys_Oracle(); > #endif > > k = DES_bs_all.KS.p; > rounds = 8; > > do { > for_each_depth() > s1(y(31, 0), y(0, 1), y(1, 2), > y(2, 3), y(3, 4), y(4, 5), > z(40), z(48), z(54), z(62)); > for_each_depth() > s2(y(3, 6), y(4, 7), y(5, 8), > y(6, 9), y(7, 10), y(8, 11), > z(44), z(59), z(33), z(49)); > for_each_depth() > s3(y(7, 12), y(8, 13), y(9, 14), > y(10, 15), y(11, 16), y(12, 17), > z(55), z(47), z(61), z(37)); > for_each_depth() > s4(y(11, 18), y(12, 19), y(13, 20), > y(14, 21), y(15, 22), y(16, 23), > z(57), z(51), z(41), z(32)); > for_each_depth() > s5(y(15, 24), y(16, 25), y(17, 26), > y(18, 27), y(19, 28), y(20, 29), > z(39), z(45), z(56), z(34)); > for_each_depth() > s6(y(19, 30), y(20, 31), y(21, 32), > y(22, 33), y(23, 34), y(24, 35), > z(35), z(60), z(42), z(50)); > for_each_depth() > s7(y(23, 36), y(24, 37), y(25, 38), > y(26, 39), y(27, 40), y(28, 41), > z(63), z(43), z(53), z(38)); > for_each_depth() > s8(y(27, 42), y(28, 43), y(29, 44), > y(30, 45), y(31, 46), y(0, 47), > z(36), z(58), z(46), z(52)); > > for_each_depth() > s1(y(63, 48), y(32, 49), y(33, 50), > y(34, 51), y(35, 52), y(36, 53), > z(8), z(16), z(22), z(30)); > for_each_depth() > s2(y(35, 54), y(36, 55), y(37, 56), > y(38, 57), y(39, 58), y(40, 59), > z(12), z(27), z(1), z(17)); > for_each_depth() > s3(y(39, 60), y(40, 61), y(41, 62), > y(42, 63), y(43, 64), y(44, 65), > z(23), z(15), z(29), z(5)); > for_each_depth() > s4(y(43, 66), y(44, 67), y(45, 68), > y(46, 69), y(47, 70), y(48, 71), > z(25), z(19), z(9), z(0)); > for_each_depth() > s5(y(47, 72), y(48, 73), y(49, 74), > y(50, 75), y(51, 76), y(52, 77), > z(7), z(13), z(24), z(2)); > for_each_depth() > s6(y(51, 78), y(52, 79), y(53, 80), > y(54, 81), y(55, 82), y(56, 83), > z(3), z(28), z(10), z(18)); > for_each_depth() > s7(y(55, 84), y(56, 85), y(57, 86), > y(58, 87), y(59, 88), y(60, 89), > z(31), z(11), z(21), z(6)); > for_each_depth() > s8(y(59, 90), y(60, 91), y(61, 92), > y(62, 93), y(63, 94), y(32, 95), > z(4), z(26), z(14), z(20)); > > k += 96; > } while (--rounds); > } > } Only in srcfinal: DES_bs_b.c~ diff -x -Naur srcoriginal/DES_bs.c srcfinal/DES_bs.c 120c120 < if (LM) bit = DES_LM_KP[bit]; --- > if (LM==1) bit = DES_LM_KP[bit]; 133c133 < if (LM) { --- > if(LM==1) { 143c143 < } else { --- > } else if(LM==0) { 309a310,325 > ARCH_WORD *DES_bs_get_binary_Oracle(char *ciphertext) > { > ARCH_WORD block[2], value; > int l, h; > int index; > > block[0] = block[1] = 0; > for (index = 0; index < 16; index += 2) { > l = atoi16[ARCH_INDEX(ciphertext[index])]; > h = atoi16[ARCH_INDEX(ciphertext[index + 1])]; > value = DES_LM_reverse[l] | (DES_LM_reverse[h] << 4); > block[index >> 3] |= value << ((index << 2) & 0x18); > } > > return DES_bs_get_binary_raw(DES_do_IP(block), 1); > } 320a337 > 329c346 < #else --- > #else 496a514,515 > > Only in srcfinal: DES_bs.c~ diff -x -Naur srcoriginal/DES_bs.h srcfinal/DES_bs.h 45c45 < union { --- > union{ 147a148,153 > > extern void DES_bs_crypt_Oracle(int keys_count,ARCH_WORD *binary_plain_salt_mix); > > /* > * Another special-case version: a non-zero IV, no salts, no iterations. > */ 159a166,171 > > /* > * Similarly, for Oracle hashes. > */ > > extern ARCH_WORD *DES_bs_get_binary_Oracle(char *ciphertext); Only in srcfinal: DES_bs.h~ Only in srcfinal: DES_fmt.c~ Only in srcfinal: formats.c~ Only in srcfinal: LM_fmt.c~ Only in srcfinal: Makefile~ diff -x -Naur srcoriginal/oracle_fmt_plug.c srcfinal/oracle_fmt_plug.c 2,5c2,3 < * Copyright (c) 2004 Simon Marechal < * simon.marechal at thales-security.com < * < * UTF-8 support by magnum 2011, no rights reserved --- > * This file is part of John the Ripper password cracker, > * Copyright (c) 1996-2001,2005,2010,2011 by Solar Designer 9d6 < #include 12a10,11 > #include "memory.h" > #include "DES_bs.h" 15d13 < #include "unicode.h" 18c16 < #define FORMAT_NAME "Oracle" --- > #define FORMAT_NAME "Oracle BS" 20a19 > 24,27c23 < #define PLAINTEXT_LENGTH 120 // worst case UTF-8 is 40 characters of Unicode, that'll do < < #define BINARY_SIZE 8 < #define SALT_SIZE (32 + 4) // also contain the NULL --- > #define PLAINTEXT_LENGTH 120 30,31c26,27 < #define MIN_KEYS_PER_CRYPT 1 < #define MAX_KEYS_PER_CRYPT 1 --- > #define BINARY_SIZE ARCH_SIZE > #define SALT_SIZE 8 33c29,30 < //#define DEBUG_ORACLE --- > #define MIN_KEYS_PER_CRYPT DES_BS_DEPTH > #define MAX_KEYS_PER_CRYPT DES_BS_DEPTH 35,62c32 < static struct fmt_tests oracle_tests[] = { < {"O$SYSTEM#9EEDFA0AD26C6D52", "THALES" }, < {"O$SIMON#4F8BC1809CB2AF77", "A"}, < {"O$SIMON#183D72325548EF11", "THALES2" }, < {"O$SIMON#C4EB3152E17F24A4", "TST" }, < {"O$BOB#b02c8e79ed2e7f46", "LAPIN" }, < {"O$BOB#6bb4e95898c88011", "LAPINE" }, < {"O$BOB#cdc6b483874b875b", "GLOUGLOU" }, < {"O$BOB#ef1f9139db2d5279", "GLOUGLOUTER" }, < {"O$BOB#c0ee5107c9a080c1", "AZERTYUIOP" }, < {"O$BOB#99e8b231d33772f9", "CANARDWC" }, < {"O$BOB#da3224126a67c8ed", "COUCOU_COUCOU" }, < {"O$BOB#ec8147abb3373d53", "LONG_MOT_DE_PASSE_OUI" }, < < {"9EEDFA0AD26C6D52", "THALES", {"SYSTEM"} }, < {"4F8BC1809CB2AF77", "A", {"SIMON"} }, < {"183D72325548EF11", "THALES2", {"SIMON"} }, < {"C4EB3152E17F24A4", "TST", {"SIMON"} }, < {"b02c8e79ed2e7f46", "LAPIN", {"BOB"} }, < {"6bb4e95898c88011", "LAPINE", {"BOB"} }, < {"cdc6b483874b875b", "GLOUGLOU", {"bob"} }, // put some low case in there, to make SURE the up case conversion works. < {"ef1f9139db2d5279", "GLOUGLOUTER", {"bob"} }, // also these 2 make sure lower cased passwords 'match' the 'get_key' method in the format tests. < {"c0ee5107c9a080c1", "AZERTYUIOP", {"BOB"} }, < {"99e8b231d33772f9", "CANARDWC", {"BOB"} }, < {"da3224126a67c8ed", "COUCOU_COUCOU", {"BOB"} }, < {"ec8147abb3373d53", "LONG_MOT_DE_PASSE_OUI", {"BOB"} }, < {NULL} < }; --- > #if DES_BS_VECTOR 64,66c34,40 < #if ARCH_LITTLE_ENDIAN < #define ENDIAN_SHIFT_L << 8 < #define ENDIAN_SHIFT_R >> 8 --- > #define DEPTH [depth] > #define START [0] > #define init_depth() \ > depth = index >> ARCH_BITS_LOG; \ > index &= (ARCH_BITS - 1); > #define for_each_depth() \ > for (depth = 0; depth < DES_BS_VECTOR; depth++) 68,69c42,45 < #define ENDIAN_SHIFT_L < #define ENDIAN_SHIFT_R --- > #define DEPTH > #define START > #define init_depth() > #define for_each_depth() 72c48,58 < static ARCH_WORD_32 crypt_key[2]; --- > #define parity_key(i,j,k,l,m,n,o,p)\ > parity_drop_key[i]=(64*enc_bit[j]+32*enc_bit[k]+16*enc_bit[l]+8*enc_bit[m]+4*enc_bit[n]+2*enc_bit[o]+1*enc_bit[p]);\ > > > static struct fmt_tests oracle_tests[]= { > {"O$SIMON#4F8BC1809CB2AF77", "A"}, > {"O$SIMON#C4EB3152E17F24A4", "TST" }, > {"O$SYS#C648972D2BE43FA4", "H4X0R"}, > {"O$BOB#b02c8e79ed2e7f46", "LAPIN" }, > {NULL} > }; 74,75c60,69 < static UTF16 cur_salt[SALT_SIZE / 2 + PLAINTEXT_LENGTH]; < static UTF16 cur_key[PLAINTEXT_LENGTH + 1]; --- > unsigned char inv_ip[64] = { > 39, 7, 47, 15, 55, 23, 63, 31, > 38, 6, 46, 14, 54, 22, 62, 30, > 37, 5, 45, 13, 53, 21, 61, 29, > 36, 4, 44, 12, 52, 20, 60, 28, > 35, 3, 43, 11, 51, 19, 59, 27, > 34, 2, 42, 10, 50, 18, 58, 26, > 33, 1, 41, 9, 49, 17, 57, 25, > 32, 0, 40, 8, 48, 16, 56, 24, > }; 77,78c71,75 < static DES_key_schedule desschedule1; < static DES_key_schedule desschedule2; --- > unsigned long binary_plain_salt_mix[128]; > static unsigned char (*saved_plain)[PLAINTEXT_LENGTH + 1]; > static int (*saved_len); > static char username[32]; > static char *password; 80,82c77,92 < static int salt_length; < static int key_length; < static char *plain_key; --- > #if DES_bs_mt > struct fmt_main fmt_Oracle; > #endif > static void oracle_init(struct fmt_main *pFmt) > { > > #if DES_bs_mt > fmt_Oracle.params.min_keys_per_crypt = DES_bs_min_kpc; > fmt_Oracle.params.max_keys_per_crypt = DES_bs_max_kpc; > > > #endif > saved_plain = mem_calloc_tiny(sizeof(*saved_plain) * pFmt->params.max_keys_per_crypt, MEM_ALIGN_NONE); > saved_len = mem_calloc_tiny(sizeof(*saved_len) * pFmt->params.max_keys_per_crypt, MEM_ALIGN_WORD); > DES_bs_init(2, DES_bs_cpt); > } 86,87c96 < int i; < int l; --- > int i,l; 119c128,132 < char *cp; --- > if (!valid(split_fields[1], pFmt) && > split_fields[2] && valid(split_fields[2], pFmt)) > return split_fields[2]; > return split_fields[1]; > } 121,157c134,150 < if (!strncmp(split_fields[1], "O$", 2)) < return split_fields[1]; < if (!split_fields[0]) < return split_fields[1]; < cp = mem_alloc(strlen(split_fields[0]) + strlen(split_fields[1]) + 4); < sprintf (cp, "O$%s#%s", split_fields[0], split_fields[1]); < if (valid(cp, pFmt)) < { < UTF8 tmp8[16*3+1]; < UTF16 tmp16[17]; < int utf8len, utf16len; < < // we no longer need this. It was just used for valid(). We will recompute < // all lengths, after we do an upcase, since upcase can change the length of the < // utf8 string. < MEM_FREE(cp); < < // Upcase user name, --encoding aware < utf8len = enc_uc(tmp8, 16*3, (unsigned char*)split_fields[0], strlen(split_fields[0])); < < if (utf8len <= 0 && split_fields[0][0]) < return split_fields[1]; < < // make sure this 'fits' into 16 unicode's < utf16len = enc_to_utf16(tmp16, 16, tmp8, utf8len); < if (utf16len <= 0) < return split_fields[1]; < < cp = mem_alloc_tiny(utf8len + strlen(split_fields[1]) + 4, MEM_ALIGN_NONE); < sprintf (cp, "O$%s#%s", tmp8, split_fields[1]); < #ifdef DEBUG_ORACLE < printf ("tmp8 : %s\n", tmp8); < #endif < return cp; < } < MEM_FREE(cp); < return split_fields[1]; --- > static void oracle_set_key(char *key, int index) { > saved_len[index] = strlen(key); > memcpy(saved_plain[index], key, saved_len[index] + 1); > password=key; > } > > static void *oracle_binary(char *ciphertext) > { > int l,i,j=0; > static char out[16]; > > l = strlen(ciphertext) - CIPHERTEXT_LENGTH; > for (i = l; i < l + CIPHERTEXT_LENGTH; i++,j++){ > out[j]=ciphertext[i]; > } > strlwr(out); > return DES_bs_get_binary_Oracle(out); 160c153 < static void oracle_init(struct fmt_main *pFmt) --- > static void * oracle_get_salt(char * ciphertext) 162,175c155,167 < unsigned char deskey[8]; < < initUnicode(UNICODE_UNICODE); < < deskey[0] = 0x01; < deskey[1] = 0x23; < deskey[2] = 0x45; < deskey[3] = 0x67; < deskey[4] = 0x89; < deskey[5] = 0xab; < deskey[6] = 0xcd; < deskey[7] = 0xef; < < DES_set_key((DES_cblock *)deskey, &desschedule1); --- > char salt[8]; > int l=2; > > while( ciphertext[l] && (ciphertext[l]!='#') ) > { > salt[l-2] = ciphertext[l]; > l++; > if (l-2 >= SALT_SIZE-2) break; > } > salt[l-2] = 0; > for(l=0;l username[l]=salt[l]; > return ciphertext; 178,180c170,195 < static void oracle_set_salt(void *salt) { < salt_length = ((unsigned short *)salt)[0]; < memcpy(cur_salt, &((unsigned short *)salt)[1], salt_length); --- > /* > *Multibyte storage format i.e ASCII characters high byte set to 0x00 > */ > unsigned long *salt_binary(unsigned char *user_pass_mix) > { > unsigned long mix,temp_mix1[64],temp_mix2[64]; > int i,j=0,s=0,l = strlen(user_pass_mix); > > mix=(ARCH_INDEX(user_pass_mix[0])&0xff); > for(i=1;i mix =(mix<<8)|(ARCH_INDEX(user_pass_mix[i])&0xff); > for(i=0;i temp_mix1[i]=(mix>>i)&1; > for(i=(l*8)-1;i>=0;i--,j++) > temp_mix2[j]=temp_mix1[i]; > for(i=j;i<64;i++) > temp_mix2[i]=0; > l=j=0; > for(i=0;i<128;i++){ > if(i==8||i==24||i==40||i==56||i==72||i==88||i==104||i==120) > for(j=0+s;j<8+s;j++,i++) > binary_plain_salt_mix[i]=temp_mix2[j]; > binary_plain_salt_mix[i]=0; > s=j; > } > return binary_plain_salt_mix; 183,213c198,200 < static void oracle_set_key(char *key, int index) { < UTF16 cur_key_mixedcase[PLAINTEXT_LENGTH+1]; < #if ARCH_LITTLE_ENDIAN < UTF16 *c; < #endif < < plain_key = key; < // Can't use enc_to_utf16_be() because we need to do utf16_uc later < key_length = enc_to_utf16((UTF16 *)cur_key_mixedcase, PLAINTEXT_LENGTH, (unsigned char*)key, strlen(key)); < < if (key_length <= 0) < key_length = strlen16(cur_key_mixedcase); < < // We convert and uppercase in one shot < key_length = utf16_uc((UTF16 *)cur_key, PLAINTEXT_LENGTH, cur_key_mixedcase, key_length); < // we have no way to 'undo' here, since the expansion is due to single-2-multi expansion in the upcase, < // and we can not 'fix' our password. We simply have to 'not' properly decrypt this one, but protect ourselves. < if (key_length < 0) < key_length *= -1; < < // This must be byte-swapped on LE systems only (odd!?) < #if ARCH_LITTLE_ENDIAN < c = cur_key; < while((*c = *c << 8 | *c >> 8)) < c++; < #endif < key_length *= sizeof(UTF16); < < #ifdef DEBUG_ORACLE < dump_stuff_msg("cur_key ", (unsigned char*)&cur_key[0], key_length); < #endif --- > static void setup_des_key(unsigned char key[], int index) > { > DES_bs_set_key((char*)key, index); 216,236c203,212 < static char *oracle_get_key(int index) { < static UTF8 UC_Key[PLAINTEXT_LENGTH*3*3+1]; < // Calling this will ONLY upcase characters 'valid' in the code page. There are MANY < // code pages which mssql WILL upcase the letter (in UCS-2), but there is no upper case value < // in the code page. Thus we MUST keep the lower cased letter in this case. < enc_uc(UC_Key, PLAINTEXT_LENGTH*3*3, (UTF8*)plain_key, strlen(plain_key)); < return (char*)UC_Key; < } < < static void oracle_crypt_all(int count) < { < unsigned char buf[sizeof(cur_salt)]; < unsigned int l; < < l = salt_length + key_length; < crypt_key[0] = 0; < crypt_key[1] = 0; < memcpy((char *)cur_salt + salt_length, cur_key, key_length); < < #ifdef DEBUG_ORACLE < dump_stuff_msg("cur_salt ", (unsigned char*)&cur_salt[0], salt_length+key_length); --- > /* > *To extract bits from block after encryption > */ > static long *DES_bs_get_block(int index) > { > static long enc_bit[64],temp1[64]; > int bit,dst,src; > DES_bs_vector *b; > #if !ARCH_LITTLE_ENDIAN || DES_BS_VECTOR > int depth; 237a214,266 > init_t(); > init_depth(); > b = (DES_bs_vector *)&DES_bs_all.B[0] DEPTH; > for (bit =0; bit<64; bit++) > temp1[bit]=(((unsigned ARCH_WORD)b[(bit)] START >> index) & 1); > for (dst = 0; dst < 64; dst++) { > src = inv_ip[dst]; > enc_bit[dst]=temp1[src]; > } > return enc_bit; > } > > static void oracle_crypt_all(int index){ > int i,len=0,j=0; > static long plain_salt_1[64],plain_salt_2[64],cryptkey[64]; > static long *enc_bit; > unsigned char parity_drop_key[8],*key,user_pass_mix[8],temp_user_pass_mix[32]; > > sprintf(temp_user_pass_mix,"%s%s",username,password); > > while(username[len]!='\0') > len++; > for(i=0;i username[i]='\0'; > for(i=0;i<8;i++) > user_pass_mix[i]=temp_user_pass_mix[i]; > > salt_binary(user_pass_mix); > > for(i=0;i<64;i++) > plain_salt_1[i]=binary_plain_salt_mix[i]; > > for(i=64;i<128;i++,j++) > plain_salt_2[j]=binary_plain_salt_mix[i]; > /* > *Magic Key > */ > key="\x80\x11\x22\x33\x44\x55\x66\x77"; > > for(i=0; i setup_des_key(key, i); > /* > *First Encrytion > */ > DES_bs_crypt_Oracle(index,plain_salt_1); > enc_bit=DES_bs_get_block(index-1); > for(i=0;i<64;i++) > cryptkey[i]=(plain_salt_2[i]&1)^(enc_bit[i]&1); > /* > *Second Encrytion > */ > DES_bs_crypt_Oracle(index,cryptkey); > enc_bit=DES_bs_get_block(index-1); 239,247c268,289 < DES_ncbc_encrypt((unsigned char *)cur_salt, buf, l, &desschedule1, (DES_cblock *) crypt_key, DES_ENCRYPT); < DES_set_key((DES_cblock *)crypt_key, &desschedule2); < crypt_key[0] = 0; < crypt_key[1] = 0; < DES_ncbc_encrypt((unsigned char *)cur_salt, buf, l, &desschedule2, (DES_cblock *) crypt_key, DES_ENCRYPT); < < #ifdef DEBUG_ORACLE < dump_stuff_msg(" crypt_key ", (unsigned char*)&crypt_key[0], 8); < #endif --- > parity_key(0, 0, 1, 2, 3, 4, 5, 6); > parity_key(1, 8, 9,10,11,12,13,14); > parity_key(2,16,17,18,19,20,21,22); > parity_key(3,24,25,26,27,28,29,30); > parity_key(4,32,33,34,35,36,37,38); > parity_key(5,40,41,42,43,44,45,46); > parity_key(6,48,49,50,51,52,53,54); > parity_key(7,56,57,58,59,60,61,62); > > for(i=0; i setup_des_key(parity_drop_key, i); > /* > *Third Encrytion > */ > DES_bs_crypt_Oracle(index,plain_salt_1); > enc_bit=DES_bs_get_block(index-1); > for(i=0;i<64;i++) > cryptkey[i]=(plain_salt_2[i]&1)^(enc_bit[i]&1); > /* > *Fourth Encrytion > */ > DES_bs_crypt_Oracle(index,cryptkey); 249,250c291,292 < < static void * oracle_binary(char *ciphertext) --- > > static int binary_hash_0(void *binary) 252,264c294 < static unsigned char *out3; < int l; < int i; < < if (!out3) out3 = mem_alloc_tiny(BINARY_SIZE, MEM_ALIGN_WORD); < < l = strlen(ciphertext) - CIPHERTEXT_LENGTH; < for(i=0;i return *(ARCH_WORD *)binary & 0xF; 267c297 < static void * oracle_get_salt(char * ciphertext) --- > static int binary_hash_1(void *binary) 269,287c299,300 < static UTF16 *out; < UTF8 salt[SALT_SIZE + 1]; < int l; < < if (!out) out = mem_alloc_tiny(SALT_SIZE+2, MEM_ALIGN_WORD); < l = 2; < while( ciphertext[l] && (ciphertext[l]!='#') ) < { < salt[l-2] = ciphertext[l]; < l++; < if (l-2 >= SALT_SIZE-2) break; < } < salt[l-2] = 0; < < // we now upcase the user name in the prepare() function. < // So we are going back to 'simple' plain->utf16 convert only. < l = enc_to_utf16_be(&out[1], 16, (UTF8 *)salt, l-2); < if (l <= 0) < l = strlen16(&out[1]); --- > return *(ARCH_WORD *)binary & 0xFF; > } 289,290c302,304 < out[0] = (l<<1); < return out; --- > static int binary_hash_2(void *binary) > { > return *(ARCH_WORD *)binary & 0xFFF; 293,294c307 < // Public domain hash function by DJ Bernstein (salt is a username) < static int salt_hash(void *salt) --- > static int binary_hash_3(void *binary) 296,297c309,310 < UTF16 *s = ((UTF16*)salt) + 1; < unsigned int hash = 5381; --- > return *(ARCH_WORD *)binary & 0xFFFF; > } 299,300c312,315 < while (*s) < hash = ((hash << 5) + hash) ^ *s++; --- > static int binary_hash_4(void *binary) > { > return *(ARCH_WORD *)binary & 0xFFFFF; > } 302c317,319 < return hash & (SALT_HASH_SIZE - 1); --- > static int binary_hash_5(void *binary) > { > return *(ARCH_WORD *)binary & 0xFFFFFF; 305,309c322,325 < static int binary_hash0(void * binary) { return (((ARCH_WORD_32 *)binary)[0] & 0xf); } < static int binary_hash1(void * binary) { return (((ARCH_WORD_32 *)binary)[0] & 0xff); } < static int binary_hash2(void * binary) { return (((ARCH_WORD_32 *)binary)[0] & 0xfff); } < static int binary_hash3(void * binary) { return (((ARCH_WORD_32 *)binary)[0] & 0xffff); } < static int binary_hash4(void * binary) { return (((ARCH_WORD_32 *)binary)[0] & 0xfffff); } --- > static int binary_hash_6(void *binary) > { > return *(ARCH_WORD *)binary & 0x7FFFFFF; > } 311,315c327,330 < static int get_hash0(int index) { return crypt_key[0] & 0xf; } < static int get_hash1(int index) { return crypt_key[0] & 0xff; } < static int get_hash2(int index) { return crypt_key[0] & 0xfff; } < static int get_hash3(int index) { return crypt_key[0] & 0xffff; } < static int get_hash4(int index) { return crypt_key[0] & 0xfffff; } --- > static int cmp_one(void *binary, int index) > { > return DES_bs_cmp_one((ARCH_WORD *)binary, 32, index); > } 317,318c332,334 < static int oracle_cmp_all(void *binary, int index) { < return !memcmp(binary, crypt_key, sizeof(crypt_key)); --- > static int cmp_exact(char *source, int index) > { > return DES_bs_cmp_one(oracle_binary(source), 64, index); 321,322c337,339 < static int oracle_cmp_exact(char *source, int count) { < return 1; --- > static char *get_key(int index) > { > return (char *)saved_plain[index]; 337c354,357 < FMT_8_BIT | FMT_UNICODE | FMT_UTF8, --- > #if DES_bs_mt > FMT_OMP | > #endif > FMT_8_BIT | FMT_BS | FMT_SPLIT_UNIFIES_CASE, 347,351c367,373 < binary_hash0, < binary_hash1, < binary_hash2, < binary_hash3, < binary_hash4 --- > binary_hash_0, > binary_hash_1, > binary_hash_2, > binary_hash_3, > binary_hash_4, > binary_hash_5, > binary_hash_6 353,354c375,376 < salt_hash, < oracle_set_salt, --- > fmt_default_salt_hash, > fmt_default_set_salt, 356c378 < oracle_get_key, --- > get_key, 360,364c382,388 < get_hash0, < get_hash1, < get_hash2, < get_hash3, < get_hash4 --- > DES_bs_get_hash_0, > DES_bs_get_hash_1, > DES_bs_get_hash_2, > DES_bs_get_hash_3, > DES_bs_get_hash_4, > DES_bs_get_hash_5, > DES_bs_get_hash_6 366,368c390,392 < oracle_cmp_all, < oracle_cmp_all, < oracle_cmp_exact --- > (int (*)(void *, int))DES_bs_cmp_all, > cmp_one, > cmp_exact 370a395,407 > > > > > > > > > > > > > Only in srcfinal: oracle_fmt_plug.c~ Only in srcfinal: unicode.c~