diff -x '*~' -Naur srcoriginal/DES_bs_b.c srcfinal/DES_bs_b.c --- srcoriginal/DES_bs_b.c 2011-11-19 08:27:47.000000000 +0530 +++ srcfinal/DES_bs_b.c 2012-06-17 23:04:19.000000000 +0530 @@ -1438,6 +1438,33 @@ } } +#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 + } + } +} #undef v1 #undef v2 #undef v3 @@ -1452,6 +1479,145 @@ #define kd [0] #endif +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; + } + + { + DES_bs_set_block_8(0, bit[0],bit[1],bit[2],bit[3],bit[4],bit[5],bit[6],bit[7]); + DES_bs_set_block_8(8, bit[8],bit[9],bit[10],bit[11],bit[12],bit[13],bit[14],bit[15]); + DES_bs_set_block_8(16,bit[16],bit[17],bit[18],bit[19],bit[20],bit[21],bit[22],bit[23]); + DES_bs_set_block_8(24,bit[24],bit[25],bit[26],bit[27],bit[28],bit[29],bit[30],bit[31]); + DES_bs_set_block_8(32,bit[32],bit[33],bit[34],bit[35],bit[36],bit[37],bit[38],bit[39]); + DES_bs_set_block_8(40,bit[40],bit[41],bit[42],bit[43],bit[44],bit[45],bit[46],bit[47]); + DES_bs_set_block_8(48,bit[48],bit[49],bit[50],bit[51],bit[52],bit[53],bit[54],bit[55]); + DES_bs_set_block_8(56,bit[56],bit[57],bit[58],bit[59],bit[60],bit[61],bit[62],bit[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); + } +} + void DES_bs_crypt_LM(int keys_count) { #if DES_bs_mt diff -x '*~' -Naur srcoriginal/DES_bs.c srcfinal/DES_bs.c --- srcoriginal/DES_bs.c 2011-12-16 02:27:19.000000000 +0530 +++ srcfinal/DES_bs.c 2012-06-17 19:07:07.000000000 +0530 @@ -117,7 +117,7 @@ bit ^= 070; bit -= bit >> 3; bit = 55 - bit; - if (LM) bit = DES_LM_KP[bit]; + if (LM==1) bit = DES_LM_KP[bit]; *k++ = &DES_bs_all.K[bit] START; } } @@ -130,7 +130,7 @@ DES_bs_all.pxkeys[index] = &DES_bs_all.xkeys.c[0][index & 7][index >> 3]; - if (LM) { + if(LM==1) { for (c = 0; c < 0x100; c++) #ifdef BENCH_BUILD if (c >= 'a' && c <= 'z') @@ -140,7 +140,7 @@ #else DES_bs_all.E.u[c] = CP_up[c]; #endif - } else { + } else if(LM==0) { for (index = 0; index < 48; index++) DES_bs_all.Ens[index] = &DES_bs_all.B[DES_E[index]]; @@ -307,8 +307,26 @@ return DES_bs_get_binary_raw(DES_do_IP(block), 1); } +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); +} static MAYBE_INLINE int DES_bs_get_hash(int index, int count) { + +//printf("Inside hash..%d\n",index); int result; DES_bs_vector *b; #if !ARCH_LITTLE_ENDIAN || DES_BS_VECTOR @@ -318,6 +336,7 @@ init_t(); #if ARCH_LITTLE_ENDIAN + /* * This is merely an optimization. Nothing will break if this check for * little-endian archs is removed, even if the arch is in fact little-endian. @@ -326,7 +345,7 @@ b = (DES_bs_vector *)&DES_bs_all.B[0] DEPTH; #define GET_BIT(bit) \ (((unsigned ARCH_WORD)b[(bit)] START >> index) & 1) -#else +#else depth = index >> 3; index &= 7; b = (DES_bs_vector *)((unsigned char *)&DES_bs_all.B[0] START + depth); @@ -494,3 +513,5 @@ return 1; } + + diff -x '*~' -Naur srcoriginal/DES_bs.h srcfinal/DES_bs.h --- srcoriginal/DES_bs.h 2011-11-23 12:24:50.000000000 +0530 +++ srcfinal/DES_bs.h 2012-06-15 21:31:31.000000000 +0530 @@ -42,7 +42,7 @@ #if DES_BS_EXPAND ARCH_WORD *KSp[0x300]; /* Initial key schedule (key bit pointers) */ #endif - union { + union{ ARCH_WORD *p[0x300]; /* Key bit pointers */ #if DES_BS_EXPAND DES_bs_vector v[0x300]; /* Key bit values */ @@ -145,6 +145,12 @@ /* * Another special-case version: a non-zero IV, no salts, no iterations. */ + +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. + */ extern void DES_bs_crypt_LM(int keys_count); /* @@ -159,6 +165,12 @@ extern ARCH_WORD *DES_bs_get_binary_LM(char *ciphertext); /* + * Similarly, for Oracle hashes. + */ + +extern ARCH_WORD *DES_bs_get_binary_Oracle(char *ciphertext); + +/* * Calculate a hash for a DES_bs_crypt() output. */ extern int DES_bs_get_hash_0(int index); diff -x '*~' -Naur srcoriginal/oracle_fmt_plug.c srcfinal/oracle_fmt_plug.c --- srcoriginal/oracle_fmt_plug.c 2011-12-15 05:30:00.000000000 +0530 +++ srcfinal/oracle_fmt_plug.c 2012-06-17 23:03:08.000000000 +0530 @@ -1,90 +1,98 @@ /* - * 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 */ #include -#include #include "arch.h" #include "misc.h" +#include "memory.h" +#include "DES_bs.h" #include "common.h" #include "formats.h" -#include "unicode.h" #define FORMAT_LABEL "oracle" -#define FORMAT_NAME "Oracle" +#define FORMAT_NAME "Oracle BS" #define ALGORITHM_NAME "oracle" + #define BENCHMARK_COMMENT "" #define BENCHMARK_LENGTH -1 -#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 #define CIPHERTEXT_LENGTH 16 -#define MIN_KEYS_PER_CRYPT 1 -#define MAX_KEYS_PER_CRYPT 1 +#define BINARY_SIZE ARCH_SIZE +#define SALT_SIZE 8 -//#define DEBUG_ORACLE - -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} -}; +#define MIN_KEYS_PER_CRYPT DES_BS_DEPTH +#define MAX_KEYS_PER_CRYPT DES_BS_DEPTH -#if ARCH_LITTLE_ENDIAN -#define ENDIAN_SHIFT_L << 8 -#define ENDIAN_SHIFT_R >> 8 +#if DES_BS_VECTOR +#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++) #else -#define ENDIAN_SHIFT_L -#define ENDIAN_SHIFT_R +#define DEPTH +#define START +#define init_depth() +#define for_each_depth() #endif -static ARCH_WORD_32 crypt_key[2]; -static UTF16 cur_salt[SALT_SIZE / 2 + PLAINTEXT_LENGTH]; -static UTF16 cur_key[PLAINTEXT_LENGTH + 1]; -static DES_key_schedule desschedule1; -static DES_key_schedule desschedule2; -static int salt_length; -static int key_length; -static char *plain_key; +static struct fmt_tests oracle_tests[]= { + {"O$SIMON#4F8BC1809CB2AF77", "A"}, + {"O$SIMON#C4EB3152E17F24A4", "TST" }, + {"O$SYS#C648972D2BE43FA4", "H4X0R"}, + {"O$BOB#b02c8e79ed2e7f46", "LAPIN" }, + {NULL} +}; + +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, + }; + +int out1[64]; +unsigned long outtemp2[128]; +static unsigned char (*saved_plain)[PLAINTEXT_LENGTH + 1]; +static int (*saved_len); +static char temp_salt[32]; +static char *temp_plain; + +#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); +} static int valid(char *ciphertext, struct fmt_main *pFmt) { - int i; - int l; + int i,l; /* * 2 cases @@ -116,210 +124,260 @@ static char *prepare(char *split_fields[10], struct fmt_main *pFmt) { - char *cp; + if (!valid(split_fields[1], pFmt) && + split_fields[2] && valid(split_fields[2], pFmt)) + return split_fields[2]; + return split_fields[1]; +} - 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; +static void oracle_set_key(char *key, int index) { + saved_len[index] = strlen(key); + memcpy(saved_plain[index], key, saved_len[index] + 1); + temp_plain=key; +} + +static void *oracle_binary(char *ciphertext) +{ + + int l,i,j; + static char out[16]; + + j=0; + 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); +} + +static void * oracle_get_salt(char * ciphertext) +{ + char salt[8]; + int l; + l=2; + + while( ciphertext[l] && (ciphertext[l]!='#') ) + { + salt[l-2] = ciphertext[l]; + l++; + if (l-2 >= SALT_SIZE-2) break; } - MEM_FREE(cp); - return split_fields[1]; + salt[l-2] = 0; + for(l=0;l>i)&1; + + for(i=(l*8)-1;i>=0;i--,j++) + out1[j]=outtemp1[i]; + i=0; + for(i=j;i<64;i++) + out1[i]=0; + l=0; + 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++) + outtemp2[i]=out1[j]; + } + outtemp2[i]=0; + s=j; + } + return outtemp2; - DES_set_key((DES_cblock *)deskey, &desschedule1); } -static void oracle_set_salt(void *salt) { - salt_length = ((unsigned short *)salt)[0]; - memcpy(cur_salt, &((unsigned short *)salt)[1], salt_length); +static void setup_des_key(unsigned char key[], int index) +{ + DES_bs_set_key((char*)key, index); } -static void oracle_set_key(char *key, int index) { - UTF16 cur_key_mixedcase[PLAINTEXT_LENGTH+1]; -#if ARCH_LITTLE_ENDIAN - UTF16 *c; -#endif +/* + *To extract bits from block after encryption + */ +static long *DES_bs_get_block(int index) +{ +static long temp2[64],temp1[64]; +int bit,dst,src; - 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++; + DES_bs_vector *b; +#if !ARCH_LITTLE_ENDIAN || DES_BS_VECTOR + int depth; #endif - key_length *= sizeof(UTF16); -#ifdef DEBUG_ORACLE - dump_stuff_msg("cur_key ", (unsigned char*)&cur_key[0], key_length); -#endif -} + init_t(); -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); + 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); -#ifdef DEBUG_ORACLE - dump_stuff_msg("cur_salt ", (unsigned char*)&cur_salt[0], salt_length+key_length); -#endif - 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); + for (dst = 0; dst < 64; dst++) { + src = inv_ip[dst]; + temp2[dst]=temp1[src]; + } + +return temp2; -#ifdef DEBUG_ORACLE - dump_stuff_msg(" crypt_key ", (unsigned char*)&crypt_key[0], 8); -#endif } -static void * oracle_binary(char *ciphertext) -{ - 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= SALT_SIZE-2) break; - } - salt[l-2] = 0; + while(temp_salt[len]!='\0') + len++; + for(i=0;iutf16 convert only. - l = enc_to_utf16_be(&out[1], 16, (UTF8 *)salt, l-2); - if (l <= 0) - l = strlen16(&out[1]); + for(i=0;i<8;i++) + newarr[i]=tempsalt[i]; + + binary_plain_salt_mix=salt_binary(newarr); - out[0] = (l<<1); - return out; + for(i=0;i<64;i++) + plain_salt_1[i]=binary_plain_salt_mix[i]; + j=0; + for(i=64;i<128;i++,j++) + plain_salt_2[j]=binary_plain_salt_mix[i]; + + key="\x80\x11\x22\x33\x44\x55\x66\x77"; + for(i=0; i