Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 82400 Details for
Bug 122435
New version: johntheripper-1.7
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
john-1.7.0.1-banquise-to-bigpatch-18.patch
john-1.7.0.1-banquise-to-bigpatch-18.patch (text/plain), 266.88 KB, created by
Beech Horn
on 2006-03-17 10:35:56 UTC
(
hide
)
Description:
john-1.7.0.1-banquise-to-bigpatch-18.patch
Filename:
MIME Type:
Creator:
Beech Horn
Created:
2006-03-17 10:35:56 UTC
Size:
266.88 KB
patch
obsolete
>diff -ruN john-1.7.0.1/doc/JOHN-BIGPATCH-FAQ john-1.7.0.1-banquise-to-bigpatch-18/doc/JOHN-BIGPATCH-FAQ >--- john-1.7.0.1/doc/JOHN-BIGPATCH-FAQ 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/doc/JOHN-BIGPATCH-FAQ 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,54 @@ >+ >+Q: What's this? >+A: It's a patch to Solar Designer's "john the ripper" password cracker. >+ >+Q: What's it good for, then? >+A: It enables cracking of many different hashes. The list includes: >+ - Kerberos AFS DES >+ - Eggdrop Blowfish >+ - OpenBSD Blowfish >+ - BSDI DES >+ - Traditional DES >+ - NT LM DES >+ - Lotus V5 web password >+ - Apache MD5 >+ - FreeBSD MD5 >+ - MS Cache Hash >+ - MYSQL >+ - Netscape LDAP SHA >+ - NTHASH (md4) >+ - Raw MD5 >+ - Raw SHA1 >+ - Oracle >+ >+Q: Who made this? >+A: The original patches are from the /contrib/ directory of john the ripper. >+Their respective authors are shown on the john page, except: >+ - Domino v5 by Jeff Fay >+ - mscash, raw-md5, raw-sha1, hmac-md5, oracle >+ by Bartavelle@bandecon.com >+ >+Q: How do I install it? >+A: I assume you are able to install john from a source distribution, >+ if you are not, PLEASE read john's documentation before e-mailing me. >+ To install run 'gunzip -c john-1.6.37-bigpatch.x.ge | patch -p0' from the >+ directory containing john and then run 'make (your-system-type-here)' to >+ build john. >+ >+Q: NT hash support is broken! >+A: NT hash support works with file whose format is: >+USERNAME:$NT$A04B60AC43771EB386B94FEBAC779BBC >+if your file looks that way: >+USERNAME:A04B60AC43771EB386B94FEBAC779BBC >+use the "-format:NT" option. >+ >+Q: It doesn't work! >+A: This big patch has not been extensively tested. It should work most of the >+time on all architectures. Please send all questions to bartavelle@bandecon.com >+ >+Thanks to: >+Solar Designer for john and the advises >+Arnaud Pilon for the MS Cash algorithm and the CacheDump tool >+Moof (from thinko.net) for the macintosh shell >+HP for their testdrive systems, and the fact they allow me to use john on their >+servers. >diff -ruN john-1.7.0.1/doc/JOHN-NTLM-FAQ john-1.7.0.1-banquise-to-bigpatch-18/doc/JOHN-NTLM-FAQ >--- john-1.7.0.1/doc/JOHN-NTLM-FAQ 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/doc/JOHN-NTLM-FAQ 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,29 @@ >+ >+Q: What's this? >+A: It's a patch to Solar Designer's "john the ripper" password cracker. >+ >+Q: What's it good for, then? >+A: It enables cracking of Windows NT/2000 MD4 (case-sensitive) password hashes. >+ >+Q: Who made this? >+A: This patch was thrown together on a boring Sunday by Olle Segerdahl. >+ It uses Andrew Tridgell's NTLM and MD4 code stolen from samba-2.0.7 . >+ >+Q: How do I install it? >+A: I assume you are able to install john from a source distribution, >+ if you are not, PLEASE read john's documentation before e-mailing me. >+ To install run 'patch < john-ntlm-v02.diff' from the john "src" directory >+ and then run 'make (your-system-type-here)' to build john. >+ >+Q: How do I use john to crack NT password hashes? >+A: Use pwdump2 or L0phtcrack to dump the password hashes into a file, >+ then run 'john pwfile -format:NT' to start cracking! >+ >+Q: I get all kinds of compile errors! >+A: This patch was made against john-1.6.36, lots of stuff might have broken >+ source compatibility since then... Use something closer to john-1.6.36. >+ >+Q: I have a question not covered by this FAQ! >+A: Make sure you have read all there is to read about john, then >+ mail me at olle@nxs.se with "JOHN-NTLM" in the subject. >+ >diff -ruN john-1.7.0.1/run/john.conf.rej john-1.7.0.1-banquise-to-bigpatch-18/run/john.conf.rej >--- john-1.7.0.1/run/john.conf.rej 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/run/john.conf.rej 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,15 @@ >+*************** >+*** 1,6 **** >+ # >+ # This file is part of John the Ripper password cracker, >+- # Copyright (c) 1996-2004 by Solar Designer >+ # >+ >+ [Options] >+--- 1,6 ---- >+ # >+ # This file is part of John the Ripper password cracker, >++ # Copyright (c) 1996-2003 by Solar Designer >+ # >+ >+ [Options] >diff -ruN john-1.7.0.1/src/BFEgg_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/BFEgg_fmt.c >--- john-1.7.0.1/src/BFEgg_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/BFEgg_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,125 @@ >+/* >+ * This file is part of Eggdrop blowfish patch for John The Ripper. >+ * Copyright (c) 2002 by Sun-Zero <sun-zero@freemail.hu> >+ * This is a free software distributable under terms of the GNU GPL. >+ */ >+ >+#include <string.h> >+ >+#include "misc.h" >+#include "formats.h" >+#include "common.h" >+#include "blowfish.c" >+ >+#define FORMAT_LABEL "bfegg" >+#define FORMAT_NAME "Eggdrop" >+#define ALG_NAME "blowfish" >+ >+#define BENCHMARK_COMMENT "" >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 31 >+#define CIPHERTEXT_LENGTH 33 >+ >+#define BINARY_SIZE 13 >+#define SALT_SIZE 0 >+ >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+ >+static struct fmt_tests tests[] = { >+ {"+9F93o1OxwgK1", "123456"}, >+ {"+C/.8o.Wuph9.", "qwerty"}, >+ {"+EEHgy/MBLDd0", "walkman"}, >+ {"+vPBrs07OTXE/", "tesztuser"}, >+ {"+zIvO/1nDsd9.", "654321"}, >+ {NULL} >+}; >+ >+int zerolengthkey = 0; >+ >+static char crypt_key[BINARY_SIZE + 1]; //changed by bartavelle so that it works on alpha >+static char saved_key[PLAINTEXT_LENGTH + 1]; >+ >+static int valid(char *ciphertext) { >+ if (strncmp(ciphertext, "+", 1) != 0) return 0; >+ if (strlen(ciphertext) != 13) return 0; >+ >+ return 1; >+} >+ >+void init() { >+ blowfish_first_init(); >+} >+ >+ >+static void set_key(char *key, int index) { >+ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1); >+} >+ >+static char *get_key(int index) { >+ return saved_key; >+} >+ >+static int cmp_all(void *binary, int index) { >+ if (zerolengthkey) return 0; >+ return !memcmp(binary, crypt_key, BINARY_SIZE); >+} >+ >+static int cmp_exact(char *source, int index) { >+ return 1; >+} >+ >+static void set_salt(void *salt) { } >+ >+static void crypt_all(int count) { >+ if (saved_key[0] == '\0') { >+ zerolengthkey = 1; >+ } else { >+ zerolengthkey = 0; >+ blowfish_encrypt_pass(saved_key, crypt_key); >+ } >+} >+ >+struct fmt_main fmt_BFEgg = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALG_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ tests >+ }, { >+ init, >+ valid, >+ fmt_default_split, >+ fmt_default_binary, >+ fmt_default_salt, >+ { >+ fmt_default_binary_hash, >+ fmt_default_binary_hash, >+ fmt_default_binary_hash, >+ }, >+ fmt_default_salt_hash, >+ set_salt, >+ set_key, >+ get_key, >+ fmt_default_clear_keys, >+ crypt_all, >+ { >+ fmt_default_get_hash, >+ fmt_default_get_hash, >+ fmt_default_get_hash, >+ }, >+ cmp_all, >+ cmp_all, >+ cmp_exact >+ } >+}; >+ >diff -ruN john-1.7.0.1/src/MD5_apache_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/MD5_apache_fmt.c >--- john-1.7.0.1/src/MD5_apache_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/MD5_apache_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,201 @@ >+/* >+ Modified by Sun-Zero <sun-zero@freemail.hu> >+ 2004. 07. 26. >+ >+ Now, its work with md5 hash of apache. >+ The original john patch came from >+ http://lists.jammed.com/pen-test/2001/11/0134.html by >+ Kostas Evangelinos (kos@bastard.net) >+*/ >+ >+/* >+ * This file is part of John the Ripper password cracker, >+ * Copyright (c) 1996-2001 by Solar Designer >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "misc.h" >+#include "MD5_std.h" >+#include "common.h" >+#include "formats.h" >+ >+#define FORMAT_LABEL "md5a" >+#define FORMAT_NAME "Apache MD5" >+ >+#define BENCHMARK_COMMENT "" >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 15 >+#define CIPHERTEXT_LENGTH 22 >+ >+#define BINARY_SIZE 4 >+#define SALT_SIZE 8 >+ >+#define MIN_KEYS_PER_CRYPT MD5_N >+#define MAX_KEYS_PER_CRYPT MD5_N >+ >+ >+static struct fmt_tests tests[] = { >+ {"$apr1$Q6ZYh...$RV6ft2bZ8j.NGrxLYaJt9.", "test"}, >+ {"$apr1$rBXqc...$NlXxN9myBOk95T0AyLAsJ0", "john"}, >+ {"$apr1$Grpld/..$qp5GyjwM2dnA5Cdej9b411", "the"}, >+ {"$apr1$GBx.D/..$yfVeeYFCIiEXInfRhBRpy/", "ripper"}, >+ {NULL} >+}; >+ >+static char saved_key[MD5_N][PLAINTEXT_LENGTH + 1]; >+ >+static int valid(char *ciphertext) >+{ >+ char *pos, *start; >+ >+ if (strncmp(ciphertext, "$apr1$", 6)) return 0; >+ >+ /* magic string */ >+ start = &ciphertext[1]; >+ for (pos = start; *pos && *pos != '$'; pos++); >+ if (!*pos || pos < start+1 || pos > start+MD5_MAGIC_LENGTH+1) >+ return 0; >+ >+ /* salt */ >+ start = ++pos; >+ for (pos = start; *pos && *pos != '$'; pos++); >+ if (!*pos || pos < start || pos > start+8) >+ return 0; >+ >+ >+ start = ++pos; >+ while (atoi64[ARCH_INDEX(*pos)] != 0x7F) pos++; >+ if (*pos || pos - start != CIPHERTEXT_LENGTH) return 0; >+ >+ if (atoi64[ARCH_INDEX(*(pos - 1))] & 0x3C) return 0; >+ >+ return 1; >+} >+ >+static int binary_hash_0(void *binary) >+{ >+ return *(MD5_word *)binary & 0xF; >+} >+ >+static int binary_hash_1(void *binary) >+{ >+ return *(MD5_word *)binary & 0xFF; >+} >+ >+static int binary_hash_2(void *binary) >+{ >+ return *(MD5_word *)binary & 0xFFF; >+} >+ >+static int get_hash_0(int index) >+{ >+ return MD5_out[index][0] & 0xF; >+} >+ >+static int get_hash_1(int index) >+{ >+ return MD5_out[index][0] & 0xFF; >+} >+ >+static int get_hash_2(int index) >+{ >+ return MD5_out[index][0] & 0xFFF; >+} >+ >+static int salt_hash(void *salt) >+{ >+ return >+ ((int)atoi64[ARCH_INDEX(((char *)salt)[0])] | >+ ((int)atoi64[ARCH_INDEX(((char *)salt)[1])] << 6)) & 0x3FF; >+} >+ >+static void set_key(char *key, int index) >+{ >+ MD5_std_set_key(key, index); >+ >+ strnfcpy(saved_key[index], key, PLAINTEXT_LENGTH); >+} >+ >+static char *get_key(int index) >+{ >+ saved_key[index][PLAINTEXT_LENGTH] = 0; >+ >+ return saved_key[index]; >+} >+ >+static int cmp_all(void *binary, int index) >+{ >+ >+#if MD5_X2 >+ return *(MD5_word *)binary == MD5_out[0][0] || >+ *(MD5_word *)binary == MD5_out[1][0]; >+#else >+ return *(MD5_word *)binary == MD5_out[0][0]; >+#endif >+} >+ >+ >+static int cmp_exact(char *source, int index) >+{ >+ return !memcmp(MD5_std_get_binary(source, MD5_TYPE_APACHE), MD5_out[index], >+ sizeof(MD5_binary)); >+} >+ >+ >+static void crypt_all(int count) { >+ MD5_std_crypt(MD5_TYPE_APACHE); >+} >+ >+static void *get_salt(char *ciphertext) { >+ return MD5_std_get_salt(ciphertext, MD5_TYPE_APACHE); >+} >+ >+static void *get_binary(char *ciphertext) { >+ return MD5_std_get_binary(ciphertext, MD5_TYPE_APACHE); >+} >+ >+ >+struct fmt_main fmt_MD5_apache = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ MD5_ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ tests >+ }, { >+ MD5_std_init, >+ valid, >+ fmt_default_split, >+ get_binary, //(void *(*)(char *))MD5_std_get_binary, >+ get_salt, //(void *(*)(char *))MD5_std_get_salt, >+ { >+ binary_hash_0, >+ binary_hash_1, >+ binary_hash_2 >+ }, >+ salt_hash, >+ (void (*)(void *))MD5_std_set_salt, >+ set_key, >+ get_key, >+ fmt_default_clear_keys, >+ crypt_all, //(void (*)(int))MD5_std_crypt, >+ { >+ get_hash_0, >+ get_hash_1, >+ get_hash_2 >+ }, >+ cmp_all, >+ cmp_all, >+ cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/MD5_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/MD5_fmt.c >--- john-1.7.0.1/src/MD5_fmt.c 2003-08-21 04:04:45.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/MD5_fmt.c 2006-03-16 03:53:15.000000000 +0000 >@@ -117,10 +117,22 @@ > > static int cmp_exact(char *source, int index) > { >- return !memcmp(MD5_std_get_binary(source), MD5_out[index], >+ return !memcmp(MD5_std_get_binary(source, MD5_TYPE_STD), MD5_out[index], > sizeof(MD5_binary)); > } > >+static void crypt_all(int count) { >+ MD5_std_crypt(MD5_TYPE_STD); >+} >+ >+static void *get_salt(char *ciphertext) { >+ return MD5_std_get_salt(ciphertext, MD5_TYPE_STD); >+} >+ >+static void *get_binary(char *ciphertext) { >+ return MD5_std_get_binary(ciphertext, MD5_TYPE_STD); >+} >+ > struct fmt_main fmt_MD5 = { > { > FORMAT_LABEL, >@@ -139,8 +151,8 @@ > MD5_std_init, > valid, > fmt_default_split, >- (void *(*)(char *))MD5_std_get_binary, >- (void *(*)(char *))MD5_std_get_salt, >+ get_binary, /* (void *(*)(char *))MD5_std_get_binary, */ >+ get_salt, /* (void *(*)(char *))MD5_std_get_salt, */ > { > binary_hash_0, > binary_hash_1, >@@ -151,7 +163,7 @@ > set_key, > get_key, > fmt_default_clear_keys, >- (void (*)(int))MD5_std_crypt, >+ crypt_all, /* (void (*)(int))MD5_std_crypt, */ > { > get_hash_0, > get_hash_1, >diff -ruN john-1.7.0.1/src/MD5_std.c john-1.7.0.1-banquise-to-bigpatch-18/src/MD5_std.c >--- john-1.7.0.1/src/MD5_std.c 2005-01-06 00:10:18.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/MD5_std.c 2006-03-16 04:40:23.000000000 +0000 >@@ -400,7 +400,7 @@ > order[19][index].length = current->l.pp; > } > >-void MD5_std_crypt(void) >+void MD5_std_crypt(int md5_type) > { > int length, index, mask; > MD5_pattern *line; >@@ -483,11 +483,19 @@ > for (index = 0, key = pool; index < MD5_N; index++, key++) { > #endif > memcpy(&block[index], key->o.p.b, key->l.p); >- memcpy(&block[index].b[key->l.p], "$1$", 3); >- memcpy(&block[index].b[key->l.p + 3], key->s, key->l.s); >- memcpy(&block[index].b[key->l.ps + 3], >- MD5_out[index], key->l.p); >- length = key->l.psp + 3; >+ if (md5_type == MD5_TYPE_APACHE) { >+ memcpy(&block[index].b[key->l.p], "$apr1$", 6); >+ memcpy(&block[index].b[key->l.p + 6], key->s, key->l.s); >+ memcpy(&block[index].b[key->l.ps + 6], >+ MD5_out[index], key->l.p); >+ length = key->l.psp + 6; >+ } else { >+ memcpy(&block[index].b[key->l.p], "$1$", 3); >+ memcpy(&block[index].b[key->l.p + 3], key->s, key->l.s); >+ memcpy(&block[index].b[key->l.ps + 3], >+ MD5_out[index], key->l.p); >+ length = key->l.psp + 3; >+ } > if ((mask = key->l.p)) > do { > block[index].b[length++] = >@@ -853,13 +861,26 @@ > > #endif > >-char *MD5_std_get_salt(char *ciphertext) >+char *MD5_std_get_salt(char *ciphertext, int md5_type) > { > static char out[9]; > int length; >+ char *pos; >+ char *start; >+ >+ start = &ciphertext[1]; >+ if (md5_type == MD5_TYPE_APACHE) { >+ for (pos = start; *pos && *pos != '$'; pos++); >+ start = ++pos; >+ } > >- for (length = 0; length < 8; length++) >- if ((out[length] = ciphertext[3 + length]) == '$') break; >+ for (length = 0; length < 8; length++) { >+ if (md5_type == MD5_TYPE_APACHE) { >+ if ((out[length] = start[length]) == '$') break; >+ } else { >+ if ((out[length] = ciphertext[3 + length]) == '$') break; >+ } >+ } > out[length] = 0; > > return out; >@@ -876,7 +897,7 @@ > out.b[b2] = value >> 8; \ > out.b[b3] = value; > >-MD5_word *MD5_std_get_binary(char *ciphertext) >+MD5_word *MD5_std_get_binary(char *ciphertext, int md5_type) > { > static union { > MD5_binary w; >@@ -885,7 +906,16 @@ > char *pos; > MD5_word value; > >- pos = ciphertext + 3; while (*pos++ != '$'); >+ char *start; >+ if (md5_type == MD5_TYPE_APACHE) { >+ start = &ciphertext[1]; >+ for (pos = start; *pos && *pos != '$'; pos++); >+ if (!*pos || pos < start+1 || pos > start+MD5_MAGIC_LENGTH+1) return 0; >+ pos++; >+ while (*pos++ != '$'); >+ } else { >+ pos = ciphertext + 3; while (*pos++ != '$'); >+ } > > TO_BINARY(0, 6, 12); > TO_BINARY(1, 7, 13); >diff -ruN john-1.7.0.1/src/MD5_std.h john-1.7.0.1-banquise-to-bigpatch-18/src/MD5_std.h >--- john-1.7.0.1/src/MD5_std.h 2003-12-03 10:16:02.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/MD5_std.h 2006-03-16 03:36:10.000000000 +0000 >@@ -13,6 +13,9 @@ > #include "arch.h" > #include "common.h" > >+#define MD5_TYPE_STD 0 >+#define MD5_TYPE_APACHE 1 >+ > typedef ARCH_WORD_32 MD5_word; > > /* >@@ -88,6 +91,8 @@ > #define MD5_ALGORITHM_NAME "32/" ARCH_BITS_STR > #endif > >+#define MD5_MAGIC_LENGTH 10 >+ > /* > * Initializes the internal structures. > */ >@@ -107,16 +112,16 @@ > /* > * Main encryption routine, sets MD5_out. > */ >-extern void MD5_std_crypt(void); >+extern void MD5_std_crypt(int md5_type); > > /* > * Returns the salt for MD5_std_set_salt(). > */ >-extern char *MD5_std_get_salt(char *ciphertext); >+extern char *MD5_std_get_salt(char *ciphertext, int md5_type); > > /* > * Converts an ASCII ciphertext to binary. > */ >-extern MD5_word *MD5_std_get_binary(char *ciphertext); >+extern MD5_word *MD5_std_get_binary(char *ciphertext, int md5_type); > > #endif >diff -ruN john-1.7.0.1/src/MYSQL_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/MYSQL_fmt.c >--- john-1.7.0.1/src/MYSQL_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/MYSQL_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,251 @@ >+//////////////////////////////////////////////////////////////// >+// MySQL password cracker - v1.0 - 16.1.2003 >+// >+// by Andrew Hintz <http://guh.nu> drew@overt.org >+// >+// This production has been brought to you by >+// 4tphi <http://4tphi.net> and violating <http://violating.us> >+// >+// This file is an add-on to John the Ripper <http://www.openwall.com/john/> >+// >+// Part of this code is based on the MySQL brute password cracker >+// mysqlpassword.c by Chris Given >+// This program executes about 75% faster than mysqlpassword.c >+// John the ripper also performs sophisticated password guessing. >+// >+// John the Ripper will expect the MySQL password file to be >+// in the following format (without the leading // ): >+// dumb_user:5d2e19393cc5ef67 >+// another_luser:28ff8d49159ffbaf >+// >+// performance enhancements by bartavelle@bandecon.com >+ >+#include <string.h> >+#include <stdio.h> >+#include <stdlib.h> >+#include <math.h> >+ >+// johntr includes >+#include "arch.h" >+#include "misc.h" >+#include "formats.h" >+#include "common.h" >+ >+//johntr defines >+#define FORMAT_LABEL "mysql" >+#define FORMAT_NAME "mysql" >+#define ALGORITHM_NAME "mysql" >+ >+#define BENCHMARK_COMMENT "" >+#define BENCHMARK_LENGTH -1 >+ >+// Increase the PLAINTEXT_LENGTH value for longer passwords. >+// You can also set it to 8 when using MySQL systems that truncate >+// the password to only 8 characters. >+#define PLAINTEXT_LENGTH 32 >+ >+#define CIPHERTEXT_LENGTH 16 >+ >+#define BINARY_SIZE 16 >+#define SALT_SIZE 0 >+ >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+ >+ >+//used for mysql scramble function >+struct rand_struct { >+ unsigned long seed1,seed2,max_value; >+ double max_value_dbl; >+}; >+ >+ >+void make_scrambled_password(char *,const char *); >+char *scramble(char *,const char *,const char *, int); >+ >+//test cases >+static struct fmt_tests mysql_tests[] = { >+ {"30f098972cc8924d", "http://guh.nu"}, >+ {"3fc56f6037218993", "Andrew Hintz"}, >+ {"697a7de87c5390b2", "drew"}, >+ {"1eb71cf460712b3e", "http://4tphi.net"}, >+ {"28ff8d49159ffbaf", "http://violating.us"}, >+ {"5d2e19393cc5ef67", "password"}, >+ {NULL} >+}; >+ >+ >+//stores the ciphertext for value currently being tested >+static char crypt_key[BINARY_SIZE+1]; >+ >+//used by set_key >+static char saved_key[PLAINTEXT_LENGTH + 1]; >+ >+static int mysql_valid(char *ciphertext) { //returns 0 for invalid ciphertexts >+ >+ int i; //used as counter in loop >+ >+ //ciphertext is 16 characters >+ if (strlen(ciphertext) != 16) return 0; >+ >+ //ciphertext is ASCII representation of hex digits >+ for (i = 0; i < 16; i++){ >+ if (!( ((48 <= ciphertext[i])&&(ciphertext[i] <= 57)) || >+ ((97 <= ciphertext[i])&&(ciphertext[i] <= 102)) )) >+ return 0; >+ } >+ >+ return 1; >+} >+ >+static void mysql_set_salt(void *salt) { } >+ >+static void mysql_set_key(char *key, int index) { >+ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1); >+} >+ >+static char *mysql_get_key(int index) { >+ return saved_key; >+} >+ >+static int mysql_cmp_all(void *binary, int index) { //also is mysql_cmp_one >+ int i = 0; >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+ return 1; >+} >+ >+static int mysql_cmp_exact(char *source, int count){ >+ return (1); // mysql_cmp_all fallthrough? >+} >+ >+static void mysql_crypt_all(int count) { >+ // get plaintext input in saved_key put it into ciphertext crypt_key >+ make_scrambled_password(crypt_key,saved_key); >+} >+ >+//////////////////////////////////////////////////////////////// >+//begin mysql code >+// This code was copied from mysqlpassword.c by Chris Given >+// He probably copied it from password.c in the MySQL source >+// The code is GPLed >+ >+void randominit(struct rand_struct *rand_st,unsigned long seed1, unsigned long seed2) { >+ rand_st->max_value= 0x3FFFFFFFL; >+ rand_st->max_value_dbl=(double) rand_st->max_value; >+ rand_st->seed1=seed1%rand_st->max_value ; >+ rand_st->seed2=seed2%rand_st->max_value; >+} >+static void old_randominit(struct rand_struct *rand_st,unsigned long seed1) { >+ rand_st->max_value= 0x01FFFFFFL; >+ rand_st->max_value_dbl=(double) rand_st->max_value; >+ seed1%=rand_st->max_value; >+ rand_st->seed1=seed1 ; rand_st->seed2=seed1/2; >+} >+double rnd(struct rand_struct *rand_st) { >+ rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % >+ rand_st->max_value; >+ rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % >+ rand_st->max_value; >+ return(((double) rand_st->seed1)/rand_st->max_value_dbl); >+} >+void hash_password(unsigned long *result, const char *password) { >+ unsigned long nr=1345345333L, add=7, nr2=0x12345671L; >+ unsigned long tmp; >+ for (; *password ; password++) { >+ if (*password == ' ' || *password == '\t') >+ continue; >+ //tmp= (unsigned long) (unsigned char) *password; >+ tmp= (unsigned long) (*password & 0xFF); >+ nr^= (((nr & 63)+add)*tmp)+ (nr << 8); >+ nr2+=(nr2 << 8) ^ nr; >+ add+=tmp; >+ } >+ result[0]=nr & (((unsigned long) 1L << 31) -1L); /* Don't use sign bit >+ (str2int) */; >+ result[1]=nr2 & (((unsigned long) 1L << 31) -1L); >+ return; >+} >+void make_scrambled_password(char *to,const char *password) { >+ unsigned long hash_res[2]; >+ hash_password(hash_res,password); >+ sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]); >+} >+static inline unsigned int char_val(char X) { >+ return (unsigned int) (X >= '0' && X <= '9' ? X-'0' : X >= 'A' && X <= 'Z' ? >+ X-'A'+10 : X-'a'+10); >+} >+char *scramble(char *to,const char *message,const char *password, int >+ old_ver) { >+ struct rand_struct rand_st; >+ unsigned long hash_pass[2],hash_message[2]; >+ if(password && password[0]) { >+ char *to_start=to; >+ hash_password(hash_pass,password); >+ hash_password(hash_message,message); >+ if (old_ver) >+ old_randominit(&rand_st,hash_pass[0] ^ >+ hash_message[0]); >+ else >+ randominit(&rand_st,hash_pass[0] ^ hash_message[0], >+ hash_pass[1] ^ hash_message[1]); >+ while (*message++) >+ *to++= (char) (floor(rnd(&rand_st)*31)+64); >+ if (!old_ver) { >+ char extra=(char) (floor(rnd(&rand_st)*31)); >+ while(to_start != to) >+ *(to_start++)^=extra; >+ } >+ } >+ *to=0; >+ return to; >+} >+ >+//end mysql code >+//////////////////////////////////////////////////////////////// >+ >+struct fmt_main fmt_MYSQL = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ mysql_tests >+ }, { >+ fmt_default_init, >+ mysql_valid, >+ fmt_default_split, >+ fmt_default_binary, >+ fmt_default_salt, >+ { >+ fmt_default_binary_hash, >+ fmt_default_binary_hash, >+ fmt_default_binary_hash >+ }, >+ fmt_default_salt_hash, >+ mysql_set_salt, >+ mysql_set_key, >+ mysql_get_key, >+ fmt_default_clear_keys, >+ mysql_crypt_all, >+ { >+ fmt_default_get_hash, >+ fmt_default_get_hash, >+ fmt_default_get_hash >+ }, >+ mysql_cmp_all, >+ mysql_cmp_all, //should it be the same as cmp_all or same as cmp_exact? >+ mysql_cmp_exact //fallthrough >+ } >+}; >diff -ruN john-1.7.0.1/src/Makefile john-1.7.0.1-banquise-to-bigpatch-18/src/Makefile >--- john-1.7.0.1/src/Makefile 2006-01-12 02:30:50.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/Makefile 2006-03-16 03:51:47.000000000 +0000 >@@ -20,6 +20,7 @@ > LDFLAGS = -s > OPT_NORMAL = -funroll-loops > OPT_INLINE = -finline-functions >+LIBS = > > JOHN_OBJS_MINIMAL = \ > DES_fmt.o DES_std.o DES_bs.o \ >@@ -28,12 +29,29 @@ > BF_fmt.o BF_std.o \ > AFS_fmt.o \ > LM_fmt.o \ >+ des.o \ >+ MD5_apache_fmt.o \ >+ BFEgg_fmt.o \ >+ lotus5_fmt.o \ >+ md5.o \ >+ NSLDAP_fmt.o sha1.o base64.o \ >+ MYSQL_fmt.o \ >+ NT_fmt.o \ >+ md4.o smbencrypt.o \ >+ rawMD5_fmt.o \ >+ rawSHA1_fmt.o \ >+ mssql_fmt.o \ >+ hmacMD5_fmt.o \ >+ WPAPSK_fmt.o \ >+ mscash_fmt.o \ >+ oracle_fmt.o \ > batch.o bench.o charset.o common.o compiler.o config.o cracker.o \ > crc32.o external.o formats.o getopt.o idle.o inc.o john.o list.o \ > loader.o logger.o math.o memory.o misc.o options.o params.o path.o \ > recovery.o rpp.o rules.o signals.o single.o status.o tty.o wordlist.o \ > unshadow.o \ > unafs.o \ >+ undrop.o \ > unique.o > > JOHN_OBJS_ORIG = \ >@@ -66,17 +84,18 @@ > bench.o best.o common.o config.o formats.o math.o memory.o miscnl.o \ > params.o path.o signals.o tty.o > >-PROJ = ../run/john ../run/unshadow ../run/unafs ../run/unique >+PROJ = ../run/john ../run/unshadow ../run/unafs ../run/unique ../run/undrop > PROJ_DOS = ../run/john.bin ../run/john.com \ >- ../run/unshadow.com ../run/unafs.com ../run/unique.com >+ ../run/unshadow.com ../run/unafs.com ../run/unique.com ../run/undrop.com > PROJ_WIN32 = ../run/john.exe \ >- ../run/unshadow.exe ../run/unafs.exe ../run/unique.exe >+ ../run/unshadow.exe ../run/unafs.exe ../run/unique.exe ../run/undrop.exe > > default: > @echo "To build John the Ripper, type:" > @echo " make clean SYSTEM" > @echo "where SYSTEM can be one of the following:" > @echo "linux-x86-mmx Linux, x86 with MMX (best)" >+ @echo "linux-x86-sse2 Linux, x86 with SSE2, ELF binaries" > @echo "linux-x86-any Linux, x86" > @echo "linux-x86-any-a.out Linux, x86, a.out binaries (obsolete)" > @echo "linux-x86-64 Linux, AMD x86-64, 64-bit native" >@@ -127,6 +146,7 @@ > @echo "dos-djgpp-x86-mmx DOS, DJGPP 2.x, x86 with MMX (best)" > @echo "dos-djgpp-x86-any DOS, DJGPP 2.x, x86" > @echo "win32-cygwin-x86-mmx Win32, Cygwin, x86 with MMX (best)" >+ @echo "win32-cygwin-x86-sse2 Win32, Cygwin, x86 with SSE2" > @echo "win32-cygwin-x86-any Win32, Cygwin, x86" > @echo "beos-x86-mmx BeOS, x86 with MMX" > @echo "beos-x86-any BeOS, x86" >@@ -135,7 +155,12 @@ > linux-x86-mmx: > $(LN) x86-mmx.h arch.h > $(MAKE) $(PROJ) \ >- JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o" >+ JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o md4-mmx.o NTmmx_fmt.o md5-mmx.o sha1-mmx.o" >+ >+linux-x86-sse2: >+ $(LN) x86-sse2.h arch.h >+ $(MAKE) $(PROJ) \ >+ JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o md4-sse2.o NTmmx_fmt.o md5-mmx.o sha1-mmx.o" > > linux-x86-any: > $(LN) x86-any.h arch.h >@@ -156,7 +181,7 @@ > linux-x86-64-mmx: > $(LN) x86-mmx.h arch.h > $(MAKE) $(PROJ) \ >- JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o" \ >+ JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o md4-mmx.o NTmmx_fmt.o" \ > CFLAGS="$(CFLAGS) -m32" \ > ASFLAGS="$(ASFLAGS) -m32" \ > LDFLAGS="$(LDFLAGS) -m32" >@@ -236,7 +261,7 @@ > openbsd-x86-mmx: > $(LN) x86-mmx.h arch.h > $(MAKE) $(PROJ) \ >- JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o" \ >+ JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o md4-mmx.o NTmmx_fmt.o" \ > ASFLAGS="$(ASFLAGS) -DBSD" > > openbsd-x86-any: >@@ -541,7 +566,7 @@ > dos-djgpp-x86-mmx: > copy x86-mmx.h arch.h > $(MAKE) $(PROJ_DOS) \ >- JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o" \ >+ JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o md4-mmx.o NTmmx_fmt.o" \ > CFLAGS="$(CFLAGS) -mpreferred-stack-boundary=2" \ > ASFLAGS="$(ASFLAGS) -DUNDERSCORES -DALIGN_LOG" > >@@ -555,7 +580,14 @@ > win32-cygwin-x86-mmx: > $(CP) x86-mmx.h arch.h > $(MAKE) $(PROJ_WIN32) \ >- JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o" \ >+ JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o md4-mmx.o NTmmx_fmt.o md5_mmx.o sha1-mmx.o" \ >+ CFLAGS="$(CFLAGS) -mpreferred-stack-boundary=2" \ >+ ASFLAGS="$(ASFLAGS) -DUNDERSCORES" >+ >+win32-cygwin-x86-sse2: >+ $(CP) x86-sse2.h arch.h >+ $(MAKE) $(PROJ_WIN32) \ >+ JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o md4-sse2.o NTmmx_fmt.o md5_mmx.o sha1-mmx.o" \ > CFLAGS="$(CFLAGS) -mpreferred-stack-boundary=2" \ > ASFLAGS="$(ASFLAGS) -DUNDERSCORES" > >@@ -569,7 +601,7 @@ > beos-x86-mmx: > $(LN) x86-mmx.h arch.h > $(MAKE) $(PROJ) \ >- JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o" >+ JOHN_OBJS="$(JOHN_OBJS_MINIMAL) x86.o x86-mmx.o md4-mmx.o NTmmx_fmt.o" > > beos-x86-any: > $(LN) x86-any.h arch.h >@@ -595,7 +627,7 @@ > $(LD) $(LDFLAGS) $(BENCH_OBJS) -o bench > > ../run/john: $(JOHN_OBJS) >- $(LD) $(LDFLAGS) $(JOHN_OBJS) -o ../run/john >+ $(LD) $(LDFLAGS) $(JOHN_OBJS) -o ../run/john ${LIBS} > > ../run/unshadow: ../run/john > $(RM) ../run/unshadow >@@ -605,6 +637,10 @@ > $(RM) ../run/unafs > ln -s john ../run/unafs > >+../run/undrop: ../run/john >+ $(RM) ../run/undrop >+ ln -s john ../run/undrop >+ > ../run/unique: ../run/john > $(RM) ../run/unique > ln -s john ../run/unique >@@ -623,6 +659,9 @@ > ../run/unafs.com: john.com > copy john.com ..\run\unafs.com > >+../run/undrop.com: john.com >+ copy john.com ..\run\undrop.com >+ > ../run/unique.com: john.com > copy john.com ..\run\unique.com > >@@ -641,6 +680,10 @@ > $(CC) symlink.c -o ../run/unafs.exe > strip ../run/unafs.exe > >+../run/undrop.exe: symlink.c >+ $(CC) symlink.c -o ../run/undrop.exe >+ strip ../run/undrop.exe >+ > ../run/unique.exe: symlink.c > $(CC) symlink.c -o ../run/unique.exe > strip ../run/unique.exe >diff -ruN john-1.7.0.1/src/NSLDAP_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/NSLDAP_fmt.c >--- john-1.7.0.1/src/NSLDAP_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/NSLDAP_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,259 @@ >+// Fix for john the ripper 1.6.37 by Sun-Zero, 2004. 07. 26. >+/* >+ * This file is part of John the Ripper password cracker, >+ * Copyright (c) 1996-98 by Solar Designer >+ * >+ * Minor performance enhancement by bartavelle@bandecon.com >+ */ >+ >+#include <string.h> >+ >+#include "misc.h" >+#include "formats.h" >+#include "common.h" >+ >+#include "sha.h" >+#include "base64.h" >+ >+#define FORMAT_LABEL "nsldap" >+#define FORMAT_NAME "Netscape LDAP SHA" >+#define SHA_TYPE "SHA1" >+ >+#ifdef MMX_TYPE >+#define BENCHMARK_COMMENT MMX_TYPE >+#else >+#define BENCHMARK_COMMENT "" >+#endif >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 32 >+#define CIPHERTEXT_LENGTH 33 >+ >+#define BINARY_SIZE 20 >+#define SALT_SIZE 0 >+ >+#ifdef MMX_COEF >+#define MIN_KEYS_PER_CRYPT MMX_COEF >+#define MAX_KEYS_PER_CRYPT MMX_COEF >+#define GETPOS(i, index) ( (index)*4 + (i& (0xffffffff-3) )*MMX_COEF + (3-((i)&3)) ) >+#else >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+#endif >+ >+#define NSLDAP_MAGIC "{sha}" >+#define NSLDAP_MAGIC_LENGTH 5 >+ >+static struct fmt_tests tests[] = { >+ {"{SHA}cMiB1KJphN3OeV9vcYF8nPRIDnk=", "aaaa"}, >+ {"{SHA}iu0TIuVFC62weOH7YKgXod8loso=", "bbbb"}, >+ {"{SHA}0ijZPTcJXMa+t2XnEbEwSOkvQu0=", "ccccccccc"}, >+ {"{SHA}vNR9eUfJfcKmdkLDqNoKagho+qU=", "dddddddddd"}, >+ {NULL} >+}; >+ >+#ifdef MMX_COEF >+static char crypt_key[BINARY_SIZE*MMX_COEF]; >+static char saved_key[(PLAINTEXT_LENGTH+1)*MMX_COEF]; >+unsigned long total_len; >+unsigned char buffer[80*4*MMX_COEF] __attribute__ ((aligned(8*MMX_COEF))); >+unsigned char out[PLAINTEXT_LENGTH]; >+#else >+static char crypt_key[BINARY_SIZE]; >+static char saved_key[PLAINTEXT_LENGTH + 1]; >+#endif >+ >+static void * >+binary(char *ciphertext) { >+ static char realcipher[BINARY_SIZE + 9]; >+ >+ /* stupid overflows */ >+ memset(realcipher, 0, BINARY_SIZE + 9); >+ base64_decode(NSLDAP_MAGIC_LENGTH+ciphertext, CIPHERTEXT_LENGTH, realcipher); >+ return (void *)realcipher; >+} >+ >+static int >+valid(char *ciphertext) >+{ >+ if(ciphertext && strlen(ciphertext) == CIPHERTEXT_LENGTH) >+ return !strncasecmp(ciphertext, NSLDAP_MAGIC, NSLDAP_MAGIC_LENGTH); >+ return 0; >+} >+ >+static int binary_hash_0(void *binary) >+{ >+ return ((int *)binary)[0] & 0xF; >+} >+ >+static int binary_hash_1(void *binary) >+{ >+ return ((int *)binary)[0] & 0xFF; >+} >+ >+static int binary_hash_2(void *binary) >+{ >+ return ((int *)binary)[0] & 0xFFF; >+} >+ >+static int get_hash_0(int index) >+{ >+ return ((int *)crypt_key)[index] & 0xF; >+} >+ >+static int get_hash_1(int index) >+{ >+ return ((int *)crypt_key)[index] & 0xFF; >+} >+ >+static int get_hash_2(int index) >+{ >+ return ((int *)crypt_key)[index] & 0xFFF; >+} >+ >+static void set_key(char *key, int index) >+{ >+#ifdef MMX_COEF >+ int len; >+ int i; >+ >+ if(index==0) >+ { >+ total_len = 0; >+ memset(saved_key, 0, PLAINTEXT_LENGTH*MMX_COEF); >+ } >+ len = strlen(key); >+ if(len>PLAINTEXT_LENGTH) >+ len = PLAINTEXT_LENGTH; >+ >+ total_len += len << ( ( (32/MMX_COEF) * index ) ); >+ for(i=0;i<len;i++) >+ saved_key[GETPOS(i, index)] = key[i]; >+ >+ saved_key[GETPOS(i, index)] = 0x80; >+#else >+ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1); >+#endif >+} >+ >+static char *get_key(int index) >+{ >+#ifdef MMX_COEF >+ unsigned int i,s; >+ >+ s = (total_len >> (((32/MMX_COEF)*(index)))) & 0xff; >+ for(i=0;i<s;i++) >+ out[i] = saved_key[ GETPOS(i, index) ]; >+ out[i] = 0; >+ return out; >+#else >+ return saved_key; >+#endif >+} >+ >+static int >+cmp_all(void *binary, int index) >+{ >+ int i = 0; >+#ifdef MMX_COEF >+ while(i< (BINARY_SIZE/4) ) >+ { >+ if ( >+ ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+1]) >+#if (MMX_COEF > 3) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+2]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+3]) >+#endif >+ ) >+ return 0; >+ i++; >+ } >+#else >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+#endif >+ return 1; >+} >+ >+static int >+cmp_exact(char *source, int index) >+{ >+ return 1; >+} >+ >+static int cmp_one(void * binary, int index) >+{ >+#ifdef MMX_COEF >+ int i = 0; >+ for(i=0;i<(BINARY_SIZE/4);i++) >+ if ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+index] ) >+ return 0; >+ return 1; >+#else >+ return cmp_all(binary, index); >+#endif >+} >+ >+static void set_salt(void *salt) { >+} >+ >+static void >+crypt_all(int count) { >+#ifdef MMX_COEF >+ memcpy(buffer, saved_key, 32*MMX_COEF); >+ shammx(crypt_key, buffer, total_len); >+#else >+ static SHA_CTX ctx; >+ SHA1_Init(&ctx); >+ SHA1_Update(&ctx, saved_key, strlen(saved_key)); >+ SHA1_Final(crypt_key, &ctx); >+#endif >+} >+ >+struct fmt_main fmt_NSLDAP = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ SHA_TYPE, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ tests >+ }, { >+ fmt_default_init, >+ valid, >+ fmt_default_split, >+ binary, >+ fmt_default_salt, >+ { >+ binary_hash_0, >+ binary_hash_1, >+ binary_hash_2 >+ }, >+ fmt_default_salt_hash, >+ set_salt, >+ set_key, >+ get_key, >+ fmt_default_clear_keys, >+ crypt_all, >+ { >+ get_hash_0, >+ get_hash_1, >+ get_hash_2 >+ }, >+ cmp_all, >+ cmp_one, >+ cmp_exact >+ } >+}; >+ >diff -ruN john-1.7.0.1/src/NT_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/NT_fmt.c >--- john-1.7.0.1/src/NT_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/NT_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,194 @@ >+/* >+ * NTLM patch for john version 0.3 >+ * >+ * (C) 2001 Olle Segerdahl <olle@nxs.se> >+ * >+ * license: GPL <http://www.gnu.org/licenses/gpl.html> >+ * >+ * This file is based on code from John the Ripper, >+ * Copyright (c) 1996-99 by Solar Designer >+ * >+ * performance enhancements by bartavelle@bandecon.com >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "memory.h" >+#include "common.h" >+#include "formats.h" >+ >+#ifndef uchar >+#define uchar unsigned char >+#endif >+ >+#define FORMAT_LABEL "nt" >+#define FORMAT_NAME "NT MD4" >+ >+#define BENCHMARK_COMMENT "" >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 54 >+#define CIPHERTEXT_LENGTH 36 >+ >+ >+static struct fmt_tests tests[] = { >+ {"$NT$b7e4b9022cd45f275334bbdb83bb5be5", "John the Ripper"}, >+ {"$NT$8846f7eaee8fb117ad06bdd830b7586c", "password"}, >+ {"$NT$0cb6948805f797bf2a82807973b89537", "test"}, >+ {"$NT$31d6cfe0d16ae931b73c59d7e0c089c0", ""}, >+ {NULL} >+}; >+ >+#define ALGORITHM_NAME "TridgeMD4" >+ >+#define BINARY_SIZE 16 >+#define SALT_SIZE 0 >+ >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+ >+uchar saved_plain[PLAINTEXT_LENGTH + 1]; >+uchar output[BINARY_SIZE + 1]; >+ >+extern void E_md4hash(uchar *passwd, uchar *p16); >+ >+ >+static int valid(char *ciphertext) >+{ >+ char *pos; >+ >+ if (strncmp(ciphertext, "$NT$", 4)!=0) return 0; >+ >+ for (pos = &ciphertext[4]; atoi16[ARCH_INDEX(*pos)] != 0x7F; pos++); >+ >+ if (!*pos && pos - ciphertext == CIPHERTEXT_LENGTH) >+ return 1; >+ else >+ return 0; >+ >+} >+ >+static void *get_binary(char *ciphertext) >+{ >+ static uchar binary[BINARY_SIZE]; >+ int i; >+ >+ ciphertext+=4; >+ for (i=0; i<BINARY_SIZE; i++) >+ { >+ binary[i] = (atoi16[ARCH_INDEX(ciphertext[i*2])])<<4; >+ binary[i] |= (atoi16[ARCH_INDEX(ciphertext[i*2+1])]); >+ } >+ >+ return binary; >+} >+ >+static int binary_hash_0(void *binary) >+{ >+ return ((uchar *)binary)[0] & 0x0F; >+} >+ >+static int binary_hash_1(void *binary) >+{ >+ return ((uchar *)binary)[0]; >+} >+ >+static int binary_hash_2(void *binary) >+{ >+ return (((uchar *)binary)[0] << 4) + (((uchar *)binary)[1] & 0x0F); >+} >+ >+static int get_hash_0(int index) >+{ >+ return output[0] & 0x0F; >+} >+ >+static int get_hash_1(int index) >+{ >+ return output[0]; >+} >+ >+static int get_hash_2(int index) >+{ >+ return (output[0] << 4) + (output[1] & 0x0F); >+} >+ >+static void crypt_all(int count) >+{ >+ E_md4hash(saved_plain, output); >+} >+ >+static int cmp_all(void *binary, int count) >+{ >+ int i = 0; >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)output)[i]) >+ return 0; >+ i++; >+ } >+ return 1; >+} >+ >+static int cmp_exact(char *source, int index) >+{ >+ return !memcmp(output, get_binary(source), index); >+} >+ >+static void set_salt(void *salt) >+{ >+} >+ >+static void set_key(char *key, int index) >+{ >+ strncpy(saved_plain, key, PLAINTEXT_LENGTH); >+ saved_plain[PLAINTEXT_LENGTH] = 0; >+} >+ >+static char *get_key(int index) >+{ >+ return saved_plain; >+} >+ >+struct fmt_main fmt_NT = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ tests >+ }, { >+ fmt_default_init, >+ valid, >+ fmt_default_split, >+ get_binary, >+ fmt_default_salt, >+ { >+ binary_hash_0, >+ binary_hash_1, >+ binary_hash_2 >+ }, >+ fmt_default_salt_hash, >+ set_salt, >+ set_key, >+ get_key, >+ fmt_default_clear_keys, >+ crypt_all, >+ { >+ get_hash_0, >+ get_hash_1, >+ get_hash_2 >+ }, >+ cmp_all, >+ cmp_all, >+ cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/NTmmx_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/NTmmx_fmt.c >--- john-1.7.0.1/src/NTmmx_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/NTmmx_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,254 @@ >+/* >+ * NTLM patch for john version 0.3 >+ * >+ * (C) 2001 Olle Segerdahl <olle@nxs.se> >+ * >+ * license: GPL <http://www.gnu.org/licenses/gpl.html> >+ * >+ * This file is based on code from John the Ripper, >+ * Copyright (c) 1996-99 by Solar Designer >+ * >+ * performance enhancements by bartavelle@bandecon.com >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "memory.h" >+#include "common.h" >+#include "formats.h" >+#include "md4.h" >+ >+#ifndef uchar >+#define uchar unsigned char >+#endif >+ >+#define FORMAT_LABEL "ntmmx" >+#define FORMAT_NAME "NT MD4 MMX" >+ >+#define BENCHMARK_COMMENT MMX_TYPE >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 32 >+#define CIPHERTEXT_LENGTH 36 >+ >+ >+static struct fmt_tests tests[] = { >+ {"$NT$b7e4b9022cd45f275334bbdb83bb5be5", "John the Ripper"}, >+ {"$NT$8846f7eaee8fb117ad06bdd830b7586c", "password"}, >+ {"$NT$0cb6948805f797bf2a82807973b89537", "test"}, >+ {"$NT$31d6cfe0d16ae931b73c59d7e0c089c0", ""}, >+ {NULL} >+}; >+ >+#define ALGORITHM_NAME "bartavelle" >+ >+#define BINARY_SIZE 16 >+#define SALT_SIZE 0 >+ >+ >+#define MIN_KEYS_PER_CRYPT MMX_COEF >+#define MAX_KEYS_PER_CRYPT MMX_COEF >+ >+#define GETPOS(i,idx) ( ((i)&0xfffe)*MMX_COEF + ((i)&1) + ((idx)<<1) ) >+ >+//uchar saved_plain[PLAINTEXT_LENGTH + 1]; >+ >+static unsigned char saved_plain[64 * MMX_COEF] __attribute__ ((aligned(32))); >+/*static unsigned char tmpbuf[64 * MMX_COEF] __attribute__ ((aligned(32)));*/ >+static unsigned char output[BINARY_SIZE*MMX_COEF + 1] __attribute__ ((aligned(32))); >+static unsigned char out[32]; >+static unsigned long total_len; >+/*static int global_watch = 0;*/ >+ >+static int valid(char *ciphertext) >+{ >+ char *pos; >+ >+ if (strncmp(ciphertext, "$NT$", 4)!=0) return 0; >+ >+ for (pos = &ciphertext[4]; atoi16[ARCH_INDEX(*pos)] != 0x7F; pos++); >+ >+ if (!*pos && pos - ciphertext == CIPHERTEXT_LENGTH) >+ return 1; >+ else >+ return 0; >+ >+} >+ >+static void *get_binary(char *ciphertext) >+{ >+ static uchar binary[BINARY_SIZE]; >+ int i; >+ >+ ciphertext+=4; >+ for (i=0; i<BINARY_SIZE; i++) >+ { >+ binary[i] = (atoi16[ARCH_INDEX(ciphertext[i*2])])<<4; >+ binary[i] |= (atoi16[ARCH_INDEX(ciphertext[i*2+1])]); >+ } >+ >+ return binary; >+} >+ >+static int binary_hash_0(void *binary) >+{ >+ return ((uchar *)binary)[0] & 0x0F; >+} >+ >+static int binary_hash_1(void *binary) >+{ >+ return ((uchar *)binary)[0]; >+} >+ >+static int binary_hash_2(void *binary) >+{ >+ return (((uchar *)binary)[0] << 4) + (((uchar *)binary)[1] & 0x0F); >+} >+ >+static int get_hash_0(int index) >+{ >+ return output[index*4] & 0x0F; >+} >+ >+static int get_hash_1(int index) >+{ >+ return output[index*4]; >+} >+ >+static int get_hash_2(int index) >+{ >+ return (output[index*4] << 4) + (output[index*4+1] & 0x0F); >+} >+ >+static void crypt_all(int count) >+{ >+#if (MMX_COEF == 2) >+ mdfourmmx(output, saved_plain, total_len); >+#endif >+#if (MMX_COEF == 4) >+ mdfoursse2(output, saved_plain, total_len); >+#endif >+} >+ >+static int cmp_all(void *binary, int count) >+{ >+ int i = 0; >+ >+ while(i<(BINARY_SIZE/4)) >+ { >+ if ( >+ ( ((unsigned long *)binary)[i] != ((unsigned long *)output)[i*MMX_COEF]) >+#if (MMX_COEF > 1 ) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)output)[i*MMX_COEF+1]) >+#endif >+#if (MMX_COEF > 3) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)output)[i*MMX_COEF+2]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)output)[i*MMX_COEF+3]) >+#endif >+ >+ ) >+ return 0; >+ i++; >+ } >+ return 1; >+} >+ >+static int cmp_one(void * binary, int index) >+{ >+ int i = 0; >+ for(i=0;i<(BINARY_SIZE/4);i++) >+ if ( ((unsigned long *)binary)[i] != ((unsigned long *)output)[i*MMX_COEF+index] ) >+ return 0; >+ return 1; >+} >+ >+static int cmp_exact(char *source, int index) >+{ >+ return 1; >+} >+ >+static void set_salt(void *salt) >+{ >+} >+ >+static void set_key(char *key, int index) >+{ >+ int len; >+ int i; >+ >+ if(index==0) >+ { >+ total_len = 0; >+ memset(saved_plain, 0, 64*MMX_COEF); >+ } >+ len = strlen(key); >+ if(len > 32) >+ len = 32; >+ >+ total_len += len << (1 + ( (32/MMX_COEF) * index ) ); >+ >+ for(i=0;i<len;i++) >+ ((unsigned short *)saved_plain)[ GETPOS(i, index) ] = key[i] ; >+ ((unsigned short *)saved_plain)[ GETPOS(i, index) ] = 0x80; >+} >+ >+static char *get_key(int index) >+{ >+ unsigned int s, i; >+ >+#if (MMX_COEF == 4) >+ s = (total_len >> (1+((32/MMX_COEF)*(index)))) & 0xff; >+#else >+ if(index == 0) >+ s = (total_len & 0xffff) >> 1 ; >+ else >+ s = total_len >> 17; >+#endif >+ for(i=0;i<s;i++) >+ out[i] = ((unsigned short *)saved_plain)[ GETPOS(i, index) ]; >+ out[i]=0; >+ return out; >+} >+ >+struct fmt_main fmt_NTmmx = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ tests >+ }, { >+ fmt_default_init, >+ valid, >+ fmt_default_split, >+ get_binary, >+ fmt_default_salt, >+ { >+ binary_hash_0, >+ binary_hash_1, >+ binary_hash_2 >+ }, >+ fmt_default_salt_hash, >+ set_salt, >+ set_key, >+ get_key, >+ fmt_default_clear_keys, >+ crypt_all, >+ { >+ get_hash_0, >+ get_hash_1, >+ get_hash_2 >+ }, >+ cmp_all, >+ cmp_one, >+ cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/WPAPSK_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/WPAPSK_fmt.c >--- john-1.7.0.1/src/WPAPSK_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/WPAPSK_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,482 @@ >+/* >+ * Copyright (c) 2004 bartavelle >+ * bartavelle@bandecon.com >+ * >+ * Simple MD5 hashes cracker >+ * It uses the Solar Designer's md5 implementation >+ * >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "misc.h" >+#include "common.h" >+#include "formats.h" >+#include "md5.h" >+#include "sha.h" >+ >+#define FORMAT_LABEL "wpapsk" >+#define FORMAT_NAME "WPA PSK" >+#ifdef MMX_COEF >+#if (MMX_COEF == 2) >+#define ALGORITHM_NAME "wpa-psk MMX" >+#else >+#define ALGORITHM_NAME "pwa-psk SSE2" >+#endif >+#else >+#define ALGORITHM_NAME "wpa-psk" >+#endif >+ >+#ifdef MMX_TYPE >+#define BENCHMARK_COMMENT MMX_TYPE >+#else >+#define BENCHMARK_COMMENT "" >+#endif >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 60 >+#define CIPHERTEXT_LENGTH (128+400) >+ >+#define BINARY_SIZE 16 >+#define SHA_SIZE 20 >+#define SALT_SIZE 64 >+ >+#ifdef MMX_COEF >+#define MIN_KEYS_PER_CRYPT MMX_COEF >+#define MAX_KEYS_PER_CRYPT MMX_COEF >+#define GETPOS(i, index) ( (index)*4 + ((i)& (0xffffffff-3) )*MMX_COEF + (((i)&3)) ) >+#else >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+#endif >+ >+// format : essid#MIC AA SPA snonce anonce keymic eapolframe >+static struct fmt_tests wpapsk_tests[] = { >+ {"somethingclever#c016873ee6bb01499d77bde7c5e7a4be 00026f01b8fb000c413f313e289f35c24325dda9e773a11cd0416a880622c3589a37886e318120a7e0ad68dd8a4b70c7b368bac5b4476a9e6071270d1d5734e484cf09ddd3f29966e20136de 0103005ffe010900200000000000000001289f35c24325dda9e773a11cd0416a880622c3589a37886e318120a7e0ad68dd", "family movie night"}, >+ {NULL} >+}; >+ >+#ifdef MMX_COEF >+//static char saved_key[PLAINTEXT_LENGTH*MMX_COEF*2 + 1] __attribute__ ((aligned(16))); >+static char crypt_key[64*MMX_COEF] __attribute__ ((aligned(16))); >+unsigned long total_len; >+unsigned char opad[PLAINTEXT_LENGTH*MMX_COEF] __attribute__ ((aligned(16))); >+unsigned char ipad[PLAINTEXT_LENGTH*MMX_COEF] __attribute__ ((aligned(16))); >+unsigned char cursalt[SALT_SIZE*MMX_COEF] __attribute__ ((aligned(16))); >+unsigned char dump[80*4*MMX_COEF] __attribute__((aligned(16))); >+#else >+//static char saved_key[PLAINTEXT_LENGTH + 1]; >+static char crypt_key[BINARY_SIZE+1]; >+static SHA_CTX ctx; >+unsigned char opad[64]; >+unsigned char ipad[64]; >+unsigned char nopad[64]; >+unsigned char nipad[64]; >+unsigned char cursalt[SALT_SIZE]; >+unsigned char dump[SHA_SIZE]; >+#endif >+unsigned char out[PLAINTEXT_LENGTH]; >+ >+unsigned char DATA[12+64]; >+unsigned char nDATA[12+64+23+1]; >+unsigned char EAPOL[99]; >+ >+static void wpapsk_init(void) >+{ >+#ifdef MMX_COEF >+ memset(crypt_key, 0, 64*MMX_COEF); >+ memset(cursalt, 0, 64*MMX_COEF); >+ crypt_key[GETPOS(BINARY_SIZE,0)] = 0x80; >+ crypt_key[GETPOS(BINARY_SIZE,1)] = 0x80; >+#if (MMX_COEF == 4) >+ crypt_key[GETPOS(BINARY_SIZE,2)] = 0x80; >+ crypt_key[GETPOS(BINARY_SIZE,3)] = 0x80; >+#endif >+#else >+ memset(nipad, 0x36, 64); >+ memset(nopad, 0x5C, 64); >+ memset(EAPOL, 0, sizeof(EAPOL)); >+ strcpy(nDATA, "Pairwise key expansion"); >+#endif >+} >+ >+static int valid(char *ciphertext) >+{ >+ int pos, i; >+ >+ for(i=0;(i<strlen(ciphertext)) && (ciphertext[i]!='#');i++) ; >+ if(i==strlen(ciphertext)) >+ return 0; >+ pos = i+1; >+ for (i = pos; i < BINARY_SIZE*2+pos; i++){ >+ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) || >+ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f')) >+ || (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F')))) >+ return 0; >+ } >+ return 1; >+} >+ >+static void wpapsk_set_salt(void *salt) >+{ >+#ifdef MMX_COEF >+ total_len = 0; >+ while( ((unsigned char *)salt)[total_len] ) >+ { >+ cursalt[GETPOS(total_len, 0)] = ((unsigned char *)salt)[total_len]; >+ cursalt[GETPOS(total_len, 1)] = ((unsigned char *)salt)[total_len]; >+#if (MMX_COEF == 4) >+ cursalt[GETPOS(total_len, 2)] = ((unsigned char *)salt)[total_len]; >+ cursalt[GETPOS(total_len, 3)] = ((unsigned char *)salt)[total_len]; >+#endif >+ total_len ++; >+ } >+ while( ((unsigned char *)salt)[total_len-4] ) >+ { >+ cursalt[GETPOS(total_len, 0)] = ((unsigned char *)salt)[total_len]; >+ cursalt[GETPOS(total_len, 1)] = ((unsigned char *)salt)[total_len]; >+#if (MMX_COEF == 4) >+ cursalt[GETPOS(total_len, 2)] = ((unsigned char *)salt)[total_len]; >+ cursalt[GETPOS(total_len, 3)] = ((unsigned char *)salt)[total_len]; >+#endif >+ total_len ++; >+ } >+ >+ cursalt[GETPOS(total_len, 0)] = 0x80; >+ cursalt[GETPOS(total_len, 1)] = 0x80; >+#if (MMX_COEF == 4) >+ cursalt[GETPOS(total_len, 2)] = 0x80; >+ cursalt[GETPOS(total_len, 3)] = 0x80; >+#endif >+#else >+ memcpy(cursalt, salt, SALT_SIZE); >+#endif >+} >+ >+static void wpapsk_set_key(char *key, int index) { >+ int i; >+ int len; >+ >+ len = strlen(key); >+ if(len>PLAINTEXT_LENGTH) >+ len = PLAINTEXT_LENGTH; >+ >+#ifdef MMX_COEF >+ if(index==0) >+ { >+ memset(ipad, 0x36, 64*MMX_COEF); >+ memset(opad, 0x5C, 64*MMX_COEF); >+ } >+ >+ for(i=0;i<len;i++) >+ { >+ ipad[GETPOS(i, index)] = 0x36 ^ key[i]; >+ opad[GETPOS(i, index)] = 0x5C ^ key[i]; >+ } >+ >+ //saved_key[GETPOS(i, index)] = 0x80; >+#else >+ memset(ipad, 0x36, 64); >+ memset(opad, 0x5C, 64); >+ for(i=0;i<len;i++) >+ { >+ ipad[i] ^= key[i]; >+ opad[i] ^= key[i]; >+ } >+#endif >+} >+ >+static char *wpapsk_get_key(int index) { >+ unsigned int i; >+ for(i=0;i<PLAINTEXT_LENGTH;i++) >+#ifdef MMX_COEF >+ out[i] = ipad[ GETPOS(i, index) ] ^ 0x36; >+#else >+ out[i] = ipad[ i ] ^ 0x36; >+#endif >+ return out; >+} >+ >+static int wpapsk_cmp_all(void *binary, int index) { >+ int i=0; >+#ifdef MMX_COEF >+ while(i< (BINARY_SIZE/4) ) >+ { >+ if ( >+ ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+1]) >+#if (MMX_COEF > 3) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+2]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+3]) >+#endif >+ ) >+ return 0; >+ i++; >+ } >+#else >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+#endif >+ return 1; >+} >+ >+static int wpapsk_cmp_exact(char *source, int count){ >+ return (1); >+} >+ >+static int wpapsk_cmp_one(void * binary, int index) >+{ >+#ifdef MMX_COEF >+ int i = 0; >+ for(i=0;i<(BINARY_SIZE/4);i++) >+ if ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+index] ) >+ return 0; >+ return 1; >+#else >+ return wpapsk_cmp_all(binary, index); >+#endif >+} >+ >+/* >+ * ça ne marche pas et ça m'a gonflé >+ */ >+ >+static void wpapsk_crypt_all(int count) { >+#ifdef MMX_COEF >+ /*int i;*/ >+ printf("\n"); >+ dump_stuff_mmx(ipad, 64, 0); >+ memcpy(dump, ipad, 64*MMX_COEF); >+ shammx_nosizeupdate( dump, dump, 64); >+ >+ memcpy(dump, cursalt, 64*MMX_COEF); >+ shammx_noinit_uniformsizeupdate(dump, dump, total_len + 64 ); >+ dump_stuff_mmx(dump, SHA_SIZE, 0); >+ >+ shammx_nosizeupdate( dump, opad, 64); >+ shammx_noinit_uniformsizeupdate(dump, dump, SHA_SIZE + 64); >+ dump_stuff_mmx(dump, SHA_SIZE, 0); >+ >+ return; >+#else >+ unsigned char dump[SHA_SIZE]; >+ unsigned char digest[SHA_SIZE]; >+ unsigned char ptk[20*4]; >+ unsigned int i,j; >+ MD5_CTX md5ctx; >+ >+ //printf("\n"); >+ //first calculation - left part >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, ipad, 64 ); >+ SHA1_Update( &ctx, cursalt, strlen(cursalt) + 4 ); >+ SHA1_Final( dump, &ctx); >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, opad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE); >+ SHA1_Final( dump, &ctx); >+ memcpy(digest, dump, SHA_SIZE); >+ for(i=1;i<4096;i++) >+ { >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, ipad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE ); >+ SHA1_Final( dump, &ctx); >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, opad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE); >+ SHA1_Final( dump, &ctx); >+ for(j=0;j<SHA_SIZE;j++) >+ digest[j] ^= dump[j]; >+ } >+ //first calculation - right part >+ cursalt[ strlen(cursalt) + 3 ] = 2; >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, ipad, 64 ); >+ SHA1_Update( &ctx, cursalt, strlen(cursalt) + 4 ); >+ SHA1_Final( dump, &ctx); >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, opad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE); >+ SHA1_Final( dump, &ctx); >+ memcpy(digest+SHA_SIZE, dump, 32-SHA_SIZE); >+ for(i=1;i<4096;i++) >+ { >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, ipad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE ); >+ SHA1_Final( dump, &ctx); >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, opad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE); >+ SHA1_Final( dump, &ctx); >+ for(j=0;j<32-SHA_SIZE;j++) >+ digest[j+SHA_SIZE] ^= dump[j]; >+ } >+ //we now got pmk in digest,32 >+ //dump_stuff(digest, 32 ); >+ for(i=0;i<32;i++) >+ { >+ nipad[i] = 0x36 ^ digest[i]; >+ nopad[i] = 0x5c ^ digest[i]; >+ } >+ //a hmac must be done with secret key pmk/32, and text "Pairwise key expansion",0,DATA,counter >+ nDATA[23+64+12] = 0; >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, nipad, 64 ); >+ SHA1_Update( &ctx, nDATA, 22+1+12+64+1 ); >+ SHA1_Final( dump, &ctx ); >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, nopad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE); >+ SHA1_Final( ptk, &ctx); >+ >+ //seems not to be used ... >+ /* >+ nDATA[23+64+12] = 1; >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, nipad, 64 ); >+ SHA1_Update( &ctx, nDATA, 22+1+12+64+1 ); >+ SHA1_Final( dump, &ctx ); >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, nopad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE); >+ SHA1_Final( ptk + 20, &ctx); >+ >+ nDATA[23+64+12] = 2; >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, nipad, 64 ); >+ SHA1_Update( &ctx, nDATA, 22+1+12+64+1 ); >+ SHA1_Final( dump, &ctx ); >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, nopad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE); >+ SHA1_Final( ptk + 40, &ctx); >+ >+ nDATA[23+64+12] = 3; >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, nipad, 64 ); >+ SHA1_Update( &ctx, nDATA, 22+1+12+64+1 ); >+ SHA1_Final( dump, &ctx ); >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, nopad, 64 ); >+ SHA1_Update( &ctx, dump, SHA_SIZE); >+ SHA1_Final( ptk + 60, &ctx); >+ */ >+ //we now have the ptk ... >+ >+ //now hmac md5 ... >+ memset(nipad + 16, 0x36 , 16); >+ memset(nopad + 16, 0x5C , 16); >+ for(i=0;i<16;i++) >+ { >+ nipad[i] = 0x36 ^ ptk[i]; >+ nopad[i] = 0x5C ^ ptk[i]; >+ } >+ MD5_Init( &md5ctx ); >+ MD5_Update( &md5ctx, nipad, 64 ); >+ MD5_Update( &md5ctx, EAPOL, sizeof(EAPOL) ); >+ MD5_Final ( dump, &md5ctx ); >+ MD5_Init( &md5ctx ); >+ MD5_Update( &md5ctx, nopad, 64 ); >+ MD5_Update( &md5ctx, dump, 16 ); >+ MD5_Final ( crypt_key, &md5ctx ); >+#endif >+ >+} >+ >+static void * wpapsk_binary(char *ciphertext) >+{ >+ static unsigned char realcipher[BINARY_SIZE]; >+ int i,pos; >+ >+ for(i=0;ciphertext[i]!='#';i++); >+ pos=i+1; >+ for(i=0;i<BINARY_SIZE;i++) >+ { >+ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2+pos])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1+pos])]; >+ } >+ pos += i*2+1; >+ i=0; >+ while(ciphertext[pos]!=' ') >+ { >+ DATA[i] = atoi16[ARCH_INDEX(ciphertext[pos])]*16 + atoi16[ARCH_INDEX(ciphertext[1+pos])]; >+ i++; >+ pos += 2; >+ } >+ memcpy(nDATA+23, DATA, 12+64); >+ pos++; >+ i=0; >+ while(ciphertext[pos]) >+ { >+ EAPOL[i] = atoi16[ARCH_INDEX(ciphertext[pos])]*16 + atoi16[ARCH_INDEX(ciphertext[1+pos])]; >+ i++; >+ pos += 2; >+ } >+ >+ return (void *)realcipher; >+} >+ >+static void * wpapsk_salt(char *ciphertext) >+{ >+ static unsigned char salt[SALT_SIZE]; >+ memset(salt, 0, SALT_SIZE); >+ int i=0; >+ while(ciphertext[i]!='#') >+ { >+ salt[i] = ciphertext[i]; >+ i++; >+ } >+ salt[i]=0; >+ salt[i+1]=0; >+ salt[i+2]=0; >+ salt[i+3]=1; >+ return salt; >+} >+ >+struct fmt_main fmt_WPAPSK = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ wpapsk_tests >+ }, { >+ wpapsk_init, >+ valid, >+ fmt_default_split, >+ wpapsk_binary, >+ wpapsk_salt, >+ { >+ fmt_default_binary_hash, >+ fmt_default_binary_hash, >+ fmt_default_binary_hash >+ }, >+ fmt_default_salt_hash, >+ wpapsk_set_salt, >+ wpapsk_set_key, >+ wpapsk_get_key, >+ fmt_default_clear_keys, >+ wpapsk_crypt_all, >+ { >+ fmt_default_get_hash, >+ fmt_default_get_hash, >+ fmt_default_get_hash >+ }, >+ wpapsk_cmp_all, >+ wpapsk_cmp_one, >+ wpapsk_cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/alpha.S john-1.7.0.1-banquise-to-bigpatch-18/src/alpha.S >--- john-1.7.0.1/src/alpha.S 1999-09-22 03:25:30.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/alpha.S 2006-03-16 04:11:23.000000000 +0000 >@@ -318,3 +318,6 @@ > .space 128 > > .comm DES_KS_table, (8 * 128 * 16 * 8), 128 >+#ifdef __ELF__ >+.section .note.GNU-stack,"",@progbits >+#endif >diff -ruN john-1.7.0.1/src/base64.c john-1.7.0.1-banquise-to-bigpatch-18/src/base64.c >--- john-1.7.0.1/src/base64.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/base64.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,74 @@ >+ >+#include <stdio.h> >+#include <string.h> >+#include <sys/types.h> >+#include <sys/stat.h> >+ >+void base64_unmap(char *in_block) { >+ int i; >+ unsigned char *c; >+ >+ for(i=0; i<4; i++) { >+ c = in_block + i; >+ >+ if(*c>='A' && *c<='Z') { >+ *c -= 'A'; >+ continue; >+ } >+ >+ if(*c>='a' && *c<='z') { >+ *c -= 'a'; >+ *c += 26; >+ continue; >+ } >+ >+ if(*c == '+') { >+ *c = 62; >+ continue; >+ } >+ >+ if(*c == '/') { >+ *c = 63; >+ continue; >+ } >+ >+ if(*c == '=') { >+ *c = 0; >+ } >+ >+ *c -= '0'; >+ *c += 52; >+ } >+} >+ >+int base64_decode(char *in, int inlen, char *out) { >+ int i; >+ char *in_block; >+ char *out_block; >+ char temp[4]; >+ >+ out_block = out; >+ in_block = in; >+ >+ for(i=0; i<inlen; i+=4) { >+ >+ if(*in_block == '=') >+ return 0; >+ >+ memcpy(temp, in_block, 4); >+ memset(out_block, 0, 3); >+ base64_unmap(temp); >+ >+ out_block[0] = >+ ((temp[0]<<2) & 0xfc) | ((temp[1]>>4) & 3); >+ out_block[1] = >+ ((temp[1]<<4) & 0xf0) | ((temp[2]>>2) & 0xf); >+ out_block[2] = >+ ((temp[2]<<6) & 0xc0) | ((temp[3] ) & 0x3f); >+ >+ out_block += 3; >+ in_block += 4; >+ } >+ >+ return 0; >+} >diff -ruN john-1.7.0.1/src/base64.h john-1.7.0.1-banquise-to-bigpatch-18/src/base64.h >--- john-1.7.0.1/src/base64.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/base64.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,6 @@ >+#ifndef _BASE64_H >+#define _BASE64_H >+ >+int base64_decode(char *in, int inlen, char *out); >+ >+#endif >diff -ruN john-1.7.0.1/src/bf_tab.h john-1.7.0.1-banquise-to-bigpatch-18/src/bf_tab.h >--- john-1.7.0.1/src/bf_tab.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/bf_tab.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,277 @@ >+/* bf_tab.h: Blowfish P-box and S-box tables */ >+#ifndef _H_TAB_BF >+#define _H_TAB_BF >+ >+static UWORD_32bits initbf_P[bf_N + 2] = >+{ >+ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, >+ 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, >+ 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, >+ 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, >+ 0x9216d5d9, 0x8979fb1b, >+}; >+static UWORD_32bits initbf_S[4][256] = >+{ >+ { >+ 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, >+ 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, >+ 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, >+ 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, >+ 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, >+ 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, >+ 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, >+ 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, >+ 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, >+ 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, >+ 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, >+ 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, >+ 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, >+ 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, >+ 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, >+ 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, >+ 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, >+ 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, >+ 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, >+ 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, >+ 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, >+ 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, >+ 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, >+ 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, >+ 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, >+ 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, >+ 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, >+ 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, >+ 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, >+ 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, >+ 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, >+ 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, >+ 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, >+ 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, >+ 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, >+ 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, >+ 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, >+ 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, >+ 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, >+ 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, >+ 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, >+ 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, >+ 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, >+ 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, >+ 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, >+ 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, >+ 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, >+ 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, >+ 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, >+ 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, >+ 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, >+ 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, >+ 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, >+ 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, >+ 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, >+ 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, >+ 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, >+ 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, >+ 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, >+ 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, >+ 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, >+ 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, >+ 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, >+ 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a}, >+ { >+ 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, >+ 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, >+ 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, >+ 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, >+ 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, >+ 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, >+ 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, >+ 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, >+ 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, >+ 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, >+ 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, >+ 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, >+ 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, >+ 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, >+ 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, >+ 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, >+ 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, >+ 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, >+ 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, >+ 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, >+ 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, >+ 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, >+ 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, >+ 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, >+ 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, >+ 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, >+ 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, >+ 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, >+ 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, >+ 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, >+ 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, >+ 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, >+ 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, >+ 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, >+ 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, >+ 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, >+ 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, >+ 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, >+ 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, >+ 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, >+ 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, >+ 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, >+ 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, >+ 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, >+ 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, >+ 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, >+ 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, >+ 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, >+ 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, >+ 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, >+ 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, >+ 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, >+ 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, >+ 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, >+ 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, >+ 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, >+ 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, >+ 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, >+ 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, >+ 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, >+ 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, >+ 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, >+ 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, >+ 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7}, >+ { >+ 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, >+ 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, >+ 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, >+ 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, >+ 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, >+ 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, >+ 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, >+ 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, >+ 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, >+ 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, >+ 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, >+ 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, >+ 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, >+ 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, >+ 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, >+ 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, >+ 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, >+ 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, >+ 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, >+ 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, >+ 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, >+ 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, >+ 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, >+ 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, >+ 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, >+ 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, >+ 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, >+ 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, >+ 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, >+ 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, >+ 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, >+ 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, >+ 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, >+ 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, >+ 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, >+ 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, >+ 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, >+ 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, >+ 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, >+ 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, >+ 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, >+ 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, >+ 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, >+ 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, >+ 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, >+ 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, >+ 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, >+ 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, >+ 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, >+ 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, >+ 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, >+ 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, >+ 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, >+ 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, >+ 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, >+ 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, >+ 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, >+ 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, >+ 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, >+ 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, >+ 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, >+ 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, >+ 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, >+ 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0}, >+ { >+ 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, >+ 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, >+ 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, >+ 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, >+ 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, >+ 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, >+ 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, >+ 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, >+ 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, >+ 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, >+ 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, >+ 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, >+ 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, >+ 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, >+ 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, >+ 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, >+ 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, >+ 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, >+ 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, >+ 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, >+ 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, >+ 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, >+ 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, >+ 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, >+ 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, >+ 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, >+ 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, >+ 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, >+ 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, >+ 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, >+ 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, >+ 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, >+ 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, >+ 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, >+ 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, >+ 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, >+ 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, >+ 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, >+ 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, >+ 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, >+ 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, >+ 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, >+ 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, >+ 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, >+ 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, >+ 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, >+ 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, >+ 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, >+ 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, >+ 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, >+ 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, >+ 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, >+ 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, >+ 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, >+ 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, >+ 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, >+ 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, >+ 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, >+ 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, >+ 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, >+ 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, >+ 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, >+ 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, >+ 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6} >+}; >+ >+#endif >diff -ruN john-1.7.0.1/src/blowfish.c john-1.7.0.1-banquise-to-bigpatch-18/src/blowfish.c >--- john-1.7.0.1/src/blowfish.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/blowfish.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,186 @@ >+/* >+ * blowfish.c - part of blowfish.mod >+ * handles: encryption and decryption of passwords >+ */ >+/* >+ * The first half of this is very lightly edited from public domain >+ * sourcecode. For simplicity, this entire module will remain public >+ * domain. >+ */ >+/* >+ * This is ripped from eggdrop 1.3.28's source files (blowfish.mod) >+ * Modified by Sun-Zero <sun-zero@freemail.hu> >+ * 2002-04-16 >+*/ >+ >+#include <stdlib.h> >+ >+#include "blowfish.h" >+#include "bf_tab.h" /* P-box P-array, S-box */ >+ >+/* #define S(x,i) (bf_S[i][x.w.byte##i]) */ >+#define S0(x) (bf_S[0][x.w.byte0]) >+#define S1(x) (bf_S[1][x.w.byte1]) >+#define S2(x) (bf_S[2][x.w.byte2]) >+#define S3(x) (bf_S[3][x.w.byte3]) >+#define bf_F(x) (((S0(x) + S1(x)) ^ S2(x)) + S3(x)) >+#define ROUND(a,b,n) (a.word ^= bf_F(b) ^ bf_P[n]) >+ >+#include <time.h> >+ >+/* keep a set of rotating P & S boxes */ >+static struct box_t { >+ UWORD_32bits *P; >+ UWORD_32bits **S; >+ char key[81]; >+ char keybytes; >+} box; >+ >+//static UWORD_32bits bf_P[bf_N+2]; >+//static UWORD_32bits bf_S[4][256]; >+static UWORD_32bits *bf_P; >+static UWORD_32bits **bf_S; >+ >+ >+void blowfish_first_init(void) { >+ box.P = NULL; >+ box.S = NULL; >+ box.key[0] = 0; >+} >+ >+static void blowfish_encipher(UWORD_32bits * xl, UWORD_32bits * xr) >+{ >+ union aword Xl; >+ union aword Xr; >+ >+ Xl.word = *xl; >+ Xr.word = *xr; >+ >+ Xl.word ^= bf_P[0]; >+ ROUND(Xr, Xl, 1); >+ ROUND(Xl, Xr, 2); >+ ROUND(Xr, Xl, 3); >+ ROUND(Xl, Xr, 4); >+ ROUND(Xr, Xl, 5); >+ ROUND(Xl, Xr, 6); >+ ROUND(Xr, Xl, 7); >+ ROUND(Xl, Xr, 8); >+ ROUND(Xr, Xl, 9); >+ ROUND(Xl, Xr, 10); >+ ROUND(Xr, Xl, 11); >+ ROUND(Xl, Xr, 12); >+ ROUND(Xr, Xl, 13); >+ ROUND(Xl, Xr, 14); >+ ROUND(Xr, Xl, 15); >+ ROUND(Xl, Xr, 16); >+ Xr.word ^= bf_P[17]; >+ >+ *xr = Xl.word; >+ *xl = Xr.word; >+} >+ >+static void blowfish_init(UBYTE_08bits * key, short keybytes) >+{ >+ int i, j; >+ UWORD_32bits data; >+ UWORD_32bits datal; >+ UWORD_32bits datar; >+ union aword temp; >+ >+ /* is buffer already allocated for this? */ >+ if (box.P != NULL) { >+ if ((box.keybytes == keybytes) && >+ (!strncmp((char *) (box.key), (char *) key, keybytes))) { >+ /* match! */ >+ bf_P = box.P; >+ bf_S = box.S; >+ return; >+ } >+ free(box.P); >+ for (i = 0; i < 4; i++) >+ free(box.S[i]); >+ free(box.S); >+ } >+ /* initialize new buffer */ >+ /* uh... this is over 4k */ >+ box.P = (UWORD_32bits *) malloc((bf_N + 2) * sizeof(UWORD_32bits)); >+ box.S = (UWORD_32bits **) malloc(4 * sizeof(UWORD_32bits *)); >+ for (i = 0; i < 4; i++) >+ box.S[i] = (UWORD_32bits *) malloc(256 * sizeof(UWORD_32bits)); >+ bf_P = box.P; >+ bf_S = box.S; >+ box.keybytes = keybytes; >+ strncpy(box.key, key, keybytes); >+ /* robey: reset blowfish boxes to initial state */ >+ /* (i guess normally it just keeps scrambling them, but here it's >+ * important to get the same encrypted result each time) */ >+ for (i = 0; i < bf_N + 2; i++) >+ bf_P[i] = initbf_P[i]; >+ for (i = 0; i < 4; i++) >+ for (j = 0; j < 256; j++) >+ bf_S[i][j] = initbf_S[i][j]; >+ >+ j = 0; >+ for (i = 0; i < bf_N + 2; ++i) { >+ temp.word = 0; >+ temp.w.byte0 = key[j]; >+ temp.w.byte1 = key[(j + 1) % keybytes]; >+ temp.w.byte2 = key[(j + 2) % keybytes]; >+ temp.w.byte3 = key[(j + 3) % keybytes]; >+ data = temp.word; >+ bf_P[i] = bf_P[i] ^ data; >+ j = (j + 4) % keybytes; >+ } >+ datal = 0x00000000; >+ datar = 0x00000000; >+ for (i = 0; i < bf_N + 2; i += 2) { >+ blowfish_encipher(&datal, &datar); >+ bf_P[i] = datal; >+ bf_P[i + 1] = datar; >+ } >+ for (i = 0; i < 4; ++i) { >+ for (j = 0; j < 256; j += 2) { >+ blowfish_encipher(&datal, &datar); >+ bf_S[i][j] = datal; >+ bf_S[i][j + 1] = datar; >+ } >+ } >+} >+ >+/* stuff below this line was written by robey for eggdrop use */ >+ >+/* of course, if you change either of these, then your userfile will >+ * no longer be able to be shared. :) */ >+#define SALT1 0xdeadd061 >+#define SALT2 0x23f6b095 >+ >+/* convert 64-bit encrypted password to text for userfile */ >+static char *base64 = "./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; >+ >+static void blowfish_encrypt_pass(char *text, char *new) >+{ >+ UWORD_32bits left, right; >+ int n; >+ char *p; >+ >+ blowfish_init(text, strlen(text)); >+ left = SALT1; >+ right = SALT2; >+ blowfish_encipher(&left, &right); >+ p = new; >+ *p++ = '+'; /* + means encrypted pass */ >+ n = 32; >+ while (n > 0) { >+ *p++ = base64[right & 0x3f]; >+ right = (right >> 6); >+ n -= 6; >+ } >+ n = 32; >+ while (n > 0) { >+ *p++ = base64[left & 0x3f]; >+ left = (left >> 6); >+ n -= 6; >+ } >+ *p = 0; >+} >+ >diff -ruN john-1.7.0.1/src/blowfish.h john-1.7.0.1-banquise-to-bigpatch-18/src/blowfish.h >--- john-1.7.0.1/src/blowfish.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/blowfish.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,55 @@ >+/* modified 19jul1996 by robey -- uses autoconf values now */ >+#ifndef _H_BLOWFISH >+#define _H_BLOWFISH >+ >+#include "arch.h" >+ >+#define bf_N 16 >+#define noErr 0 >+#define DATAERROR -1 >+ >+#define UBYTE_08bits unsigned char >+#define UWORD_16bits unsigned short >+ >+#define SIZEOF_INT 4 >+ >+#if SIZEOF_INT==4 >+#define UWORD_32bits unsigned int >+#else >+#if SIZEOF_LONG==4 >+#define UWORD_32bits unsigned long >+#endif >+#endif >+ >+/* choose a byte order for your hardware */ >+ >+#if !ARCH_LITTLE_ENDIAN >+/* ABCD - big endian - motorola */ >+union aword { >+ UWORD_32bits word; >+ UBYTE_08bits byte[4]; >+ struct { >+ unsigned int byte0:8; >+ unsigned int byte1:8; >+ unsigned int byte2:8; >+ unsigned int byte3:8; >+ } w; >+}; >+#endif /* !ARCH_LITTLE_ENDIAN */ >+ >+#if ARCH_LITTLE_ENDIAN >+/* DCBA - little endian - intel */ >+union aword { >+ UWORD_32bits word; >+ UBYTE_08bits byte[4]; >+ struct { >+ unsigned int byte3:8; >+ unsigned int byte2:8; >+ unsigned int byte1:8; >+ unsigned int byte0:8; >+ } w; >+}; >+ >+#endif /* ARCH_LITTLE_ENDIAN */ >+ >+#endif >diff -ruN john-1.7.0.1/src/byteorder.h john-1.7.0.1-banquise-to-bigpatch-18/src/byteorder.h >--- john-1.7.0.1/src/byteorder.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/byteorder.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,274 @@ >+/* >+ Unix SMB/Netbios implementation. >+ Version 1.9. >+ SMB Byte handling >+ Copyright (C) Andrew Tridgell 1992-1998 >+ >+ This program is free software; you can redistribute it and/or modify >+ it under the terms of the GNU General Public License as published by >+ the Free Software Foundation; either version 2 of the License, or >+ (at your option) any later version. >+ >+ This program is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ GNU General Public License for more details. >+ >+ You should have received a copy of the GNU General Public License >+ along with this program; if not, write to the Free Software >+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. >+*/ >+ >+#ifndef _BYTEORDER_H >+#define _BYTEORDER_H >+ >+/* >+ This file implements macros for machine independent short and >+ int manipulation >+ >+Here is a description of this file that I emailed to the samba list once: >+ >+> I am confused about the way that byteorder.h works in Samba. I have >+> looked at it, and I would have thought that you might make a distinction >+> between LE and BE machines, but you only seem to distinguish between 386 >+> and all other architectures. >+> >+> Can you give me a clue? >+ >+sure. >+ >+The distinction between 386 and other architectures is only there as >+an optimisation. You can take it out completely and it will make no >+difference. The routines (macros) in byteorder.h are totally byteorder >+independent. The 386 optimsation just takes advantage of the fact that >+the x86 processors don't care about alignment, so we don't have to >+align ints on int boundaries etc. If there are other processors out >+there that aren't alignment sensitive then you could also define >+CAREFUL_ALIGNMENT=0 on those processors as well. >+ >+Ok, now to the macros themselves. I'll take a simple example, say we >+want to extract a 2 byte integer from a SMB packet and put it into a >+type called uint16 that is in the local machines byte order, and you >+want to do it with only the assumption that uint16 is _at_least_ 16 >+bits long (this last condition is very important for architectures >+that don't have any int types that are 2 bytes long) >+ >+You do this: >+ >+#define CVAL(buf,pos) (((unsigned char *)(buf))[pos]) >+#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos)) >+#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) >+ >+then to extract a uint16 value at offset 25 in a buffer you do this: >+ >+char *buffer = foo_bar(); >+uint16 xx = SVAL(buffer,25); >+ >+We are using the byteoder independence of the ANSI C bitshifts to do >+the work. A good optimising compiler should turn this into efficient >+code, especially if it happens to have the right byteorder :-) >+ >+I know these macros can be made a bit tidier by removing some of the >+casts, but you need to look at byteorder.h as a whole to see the >+reasoning behind them. byteorder.h defines the following macros: >+ >+SVAL(buf,pos) - extract a 2 byte SMB value >+IVAL(buf,pos) - extract a 4 byte SMB value >+SVALS(buf,pos) signed version of SVAL() >+IVALS(buf,pos) signed version of IVAL() >+ >+SSVAL(buf,pos,val) - put a 2 byte SMB value into a buffer >+SIVAL(buf,pos,val) - put a 4 byte SMB value into a buffer >+SSVALS(buf,pos,val) - signed version of SSVAL() >+SIVALS(buf,pos,val) - signed version of SIVAL() >+ >+RSVAL(buf,pos) - like SVAL() but for NMB byte ordering >+RSVALS(buf,pos) - like SVALS() but for NMB byte ordering >+RIVAL(buf,pos) - like IVAL() but for NMB byte ordering >+RIVALS(buf,pos) - like IVALS() but for NMB byte ordering >+RSSVAL(buf,pos,val) - like SSVAL() but for NMB ordering >+RSIVAL(buf,pos,val) - like SIVAL() but for NMB ordering >+RSIVALS(buf,pos,val) - like SIVALS() but for NMB ordering >+ >+it also defines lots of intermediate macros, just ignore those :-) >+ >+*/ >+ >+/* some switch macros that do both store and read to and from SMB buffers */ >+ >+#define RW_PCVAL(read,inbuf,outbuf,len) \ >+ { if (read) { PCVAL (inbuf,0,outbuf,len); } \ >+ else { PSCVAL(inbuf,0,outbuf,len); } } >+ >+#define RW_PIVAL(read,big_endian,inbuf,outbuf,len) \ >+ { if (read) { if (big_endian) { RPIVAL(inbuf,0,outbuf,len); } else { PIVAL(inbuf,0,outbuf,len); } } \ >+ else { if (big_endian) { RPSIVAL(inbuf,0,outbuf,len); } else { PSIVAL(inbuf,0,outbuf,len); } } } >+ >+#define RW_PSVAL(read,big_endian,inbuf,outbuf,len) \ >+ { if (read) { if (big_endian) { RPSVAL(inbuf,0,outbuf,len); } else { PSVAL(inbuf,0,outbuf,len); } } \ >+ else { if (big_endian) { RPSSVAL(inbuf,0,outbuf,len); } else { PSSVAL(inbuf,0,outbuf,len); } } } >+ >+#define RW_CVAL(read, inbuf, outbuf, offset) \ >+ { if (read) { (outbuf) = CVAL (inbuf,offset); } \ >+ else { SCVAL(inbuf,offset,outbuf); } } >+ >+#define RW_IVAL(read, big_endian, inbuf, outbuf, offset) \ >+ { if (read) { (outbuf) = ((big_endian) ? RIVAL(inbuf,offset) : IVAL (inbuf,offset)); } \ >+ else { if (big_endian) { RSIVAL(inbuf,offset,outbuf); } else { SIVAL(inbuf,offset,outbuf); } } } >+ >+#define RW_SVAL(read, big_endian, inbuf, outbuf, offset) \ >+ { if (read) { (outbuf) = ((big_endian) ? RSVAL(inbuf,offset) : SVAL (inbuf,offset)); } \ >+ else { if (big_endian) { RSSVAL(inbuf,offset,outbuf); } else { SSVAL(inbuf,offset,outbuf); } } } >+ >+#undef CAREFUL_ALIGNMENT >+ >+/* we know that the 386 can handle misalignment and has the "right" >+ byteorder */ >+#ifdef __i386__ >+#define CAREFUL_ALIGNMENT 0 >+#endif >+ >+#ifndef CAREFUL_ALIGNMENT >+#define CAREFUL_ALIGNMENT 1 >+#endif >+ >+#define CVAL(buf,pos) (((unsigned char *)(buf))[pos]) >+#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos)) >+#define SCVAL(buf,pos,val) (CVAL(buf,pos) = (val)) >+ >+ >+#if CAREFUL_ALIGNMENT >+ >+#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) >+#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16) >+#define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8) >+#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16)) >+#define SVALS(buf,pos) ((int16)SVAL(buf,pos)) >+#define IVALS(buf,pos) ((int32)IVAL(buf,pos)) >+#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((uint16)(val))) >+#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32)(val))) >+#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val))) >+#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val))) >+ >+#else /* CAREFUL_ALIGNMENT */ >+ >+/* this handles things for architectures like the 386 that can handle >+ alignment errors */ >+/* >+ WARNING: This section is dependent on the length of int16 and int32 >+ being correct >+*/ >+ >+/* get single value from an SMB buffer */ >+#define SVAL(buf,pos) (*(const uint16 *)((const char *)(buf) + (pos))) >+#define IVAL(buf,pos) (*(const uint32 *)((const char *)(buf) + (pos))) >+#define SVALS(buf,pos) (*(const int16 *)((const char *)(buf) + (pos))) >+#define IVALS(buf,pos) (*(const int32 *)((const char *)(buf) + (pos))) >+ >+/* store single value in an SMB buffer */ >+#define SVALMOD(buf,pos) (*(uint16 *)((char *)(buf) + (pos))) >+#define IVALMOD(buf,pos) (*(uint32 *)((char *)(buf) + (pos))) >+#define SVALSMOD(buf,pos) (*(int16 *)((char *)(buf) + (pos))) >+#define IVALSMOD(buf,pos) (*(int32 *)((char *)(buf) + (pos))) >+ >+#define SSVAL(buf,pos,val) SVALMOD(buf,pos)=((uint16)(val)) >+#define SIVAL(buf,pos,val) IVALMOD(buf,pos)=((uint32)(val)) >+#define SSVALS(buf,pos,val) SVALSMOD(buf,pos)=((int16)(val)) >+#define SIVALS(buf,pos,val) IVALSMOD(buf,pos)=((int32)(val)) >+ >+#endif /* CAREFUL_ALIGNMENT */ >+ >+/* macros for reading / writing arrays */ >+ >+#define SMBMACRO(macro,buf,pos,val,len,size) \ >+{ uint32 l; for (l = 0; l < (uint32)(len); l++) (val)[l] = macro((buf), (pos) + (size)*l); } >+ >+#define SSMBMACRO(macro,buf,pos,val,len,size) \ >+{ uint32 l; for (l = 0; l < (uint32)(len); l++) macro((buf), (pos) + (size)*l, (val)[l]); } >+ >+/* reads multiple data from an SMB buffer */ >+#define PCVAL(buf,pos,val,len) SMBMACRO(CVAL,buf,pos,val,len,1) >+#define PSVAL(buf,pos,val,len) SMBMACRO(SVAL,buf,pos,val,len,2) >+#define PIVAL(buf,pos,val,len) SMBMACRO(IVAL,buf,pos,val,len,4) >+#define PCVALS(buf,pos,val,len) SMBMACRO(CVALS,buf,pos,val,len,1) >+#define PSVALS(buf,pos,val,len) SMBMACRO(SVALS,buf,pos,val,len,2) >+#define PIVALS(buf,pos,val,len) SMBMACRO(IVALS,buf,pos,val,len,4) >+ >+/* stores multiple data in an SMB buffer */ >+#define PSCVAL(buf,pos,val,len) SSMBMACRO(SCVAL,buf,pos,val,len,1) >+#define PSSVAL(buf,pos,val,len) SSMBMACRO(SSVAL,buf,pos,val,len,2) >+#define PSIVAL(buf,pos,val,len) SSMBMACRO(SIVAL,buf,pos,val,len,4) >+#define PSCVALS(buf,pos,val,len) SSMBMACRO(SCVALS,buf,pos,val,len,1) >+#define PSSVALS(buf,pos,val,len) SSMBMACRO(SSVALS,buf,pos,val,len,2) >+#define PSIVALS(buf,pos,val,len) SSMBMACRO(SIVALS,buf,pos,val,len,4) >+ >+ >+/* now the reverse routines - these are used in nmb packets (mostly) */ >+#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) >+#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16))) >+ >+#define RSVAL(buf,pos) SREV(SVAL(buf,pos)) >+#define RSVALS(buf,pos) SREV(SVALS(buf,pos)) >+#define RIVAL(buf,pos) IREV(IVAL(buf,pos)) >+#define RIVALS(buf,pos) IREV(IVALS(buf,pos)) >+#define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val)) >+#define RSSVALS(buf,pos,val) SSVALS(buf,pos,SREV(val)) >+#define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val)) >+#define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val)) >+ >+/* reads multiple data from an SMB buffer (big-endian) */ >+#define RPSVAL(buf,pos,val,len) SMBMACRO(RSVAL,buf,pos,val,len,2) >+#define RPIVAL(buf,pos,val,len) SMBMACRO(RIVAL,buf,pos,val,len,4) >+#define RPSVALS(buf,pos,val,len) SMBMACRO(RSVALS,buf,pos,val,len,2) >+#define RPIVALS(buf,pos,val,len) SMBMACRO(RIVALS,buf,pos,val,len,4) >+ >+/* stores multiple data in an SMB buffer (big-endian) */ >+#define RPSSVAL(buf,pos,val,len) SSMBMACRO(RSSVAL,buf,pos,val,len,2) >+#define RPSIVAL(buf,pos,val,len) SSMBMACRO(RSIVAL,buf,pos,val,len,4) >+#define RPSSVALS(buf,pos,val,len) SSMBMACRO(RSSVALS,buf,pos,val,len,2) >+#define RPSIVALS(buf,pos,val,len) SSMBMACRO(RSIVALS,buf,pos,val,len,4) >+ >+#define DBG_RW_PCVAL(charmode,string,depth,base,read,inbuf,outbuf,len) \ >+ { RW_PCVAL(read,inbuf,outbuf,len) \ >+ DEBUG(5,("%s%04x %s: ", \ >+ tab_depth(depth), base,string)); \ >+ if (charmode) print_asc(5, (unsigned char*)(outbuf), (len)); else \ >+ { uint32 idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%02x ", (outbuf)[idx])); } } \ >+ DEBUG(5,("\n")); } >+ >+#define DBG_RW_PSVAL(charmode,string,depth,base,read,big_endian,inbuf,outbuf,len) \ >+ { RW_PSVAL(read,big_endian,inbuf,outbuf,len) \ >+ DEBUG(5,("%s%04x %s: ", \ >+ tab_depth(depth), base,string)); \ >+ if (charmode) print_asc(5, (unsigned char*)(outbuf), 2*(len)); else \ >+ { uint32 idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%04x ", (outbuf)[idx])); } } \ >+ DEBUG(5,("\n")); } >+ >+#define DBG_RW_PIVAL(charmode,string,depth,base,read,big_endian,inbuf,outbuf,len) \ >+ { RW_PIVAL(read,big_endian,inbuf,outbuf,len) \ >+ DEBUG(5,("%s%04x %s: ", \ >+ tab_depth(depth), base,string)); \ >+ if (charmode) print_asc(5, (unsigned char*)(outbuf), 4*(len)); else \ >+ { uint32 idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%08x ", (outbuf)[idx])); } } \ >+ DEBUG(5,("\n")); } >+ >+#define DBG_RW_CVAL(string,depth,base,read,inbuf,outbuf) \ >+ { RW_CVAL(read,inbuf,outbuf,0) \ >+ DEBUG(5,("%s%04x %s: %02x\n", \ >+ tab_depth(depth), base, string, outbuf)); } >+ >+#define DBG_RW_SVAL(string,depth,base,read,big_endian,inbuf,outbuf) \ >+ { RW_SVAL(read,big_endian,inbuf,outbuf,0) \ >+ DEBUG(5,("%s%04x %s: %04x\n", \ >+ tab_depth(depth), base, string, outbuf)); } >+ >+#define DBG_RW_IVAL(string,depth,base,read,big_endian,inbuf,outbuf) \ >+ { RW_IVAL(read,big_endian,inbuf,outbuf,0) \ >+ DEBUG(5,("%s%04x %s: %08x\n", \ >+ tab_depth(depth), base, string, outbuf)); } >+ >+/* Alignment macros. */ >+#define ALIGN4(p,base) ((p) + ((4 - (PTR_DIFF((p), (base)) & 3)) & 3)) >+#define ALIGN2(p,base) ((p) + ((2 - (PTR_DIFF((p), (base)) & 1)) & 1)) >+ >+#endif /* _BYTEORDER_H */ >diff -ruN john-1.7.0.1/src/des.c john-1.7.0.1-banquise-to-bigpatch-18/src/des.c >--- john-1.7.0.1/src/des.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/des.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,517 @@ >+#include "des.h" >+ >+static const DES_LONG DES_SPtrans[8][64]={ >+{ >+/* nibble 0 */ >+0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, >+0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L, >+0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L, >+0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L, >+0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L, >+0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L, >+0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L, >+0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L, >+0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L, >+0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L, >+0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L, >+0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L, >+0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L, >+0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L, >+0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L, >+0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L, >+},{ >+/* nibble 1 */ >+0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L, >+0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L, >+0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L, >+0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L, >+0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L, >+0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L, >+0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L, >+0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L, >+0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L, >+0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L, >+0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L, >+0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L, >+0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L, >+0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L, >+0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L, >+0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L, >+},{ >+/* nibble 2 */ >+0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L, >+0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L, >+0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L, >+0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L, >+0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L, >+0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L, >+0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L, >+0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L, >+0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L, >+0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L, >+0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L, >+0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L, >+0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L, >+0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L, >+0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L, >+0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L, >+},{ >+/* nibble 3 */ >+0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L, >+0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L, >+0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L, >+0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L, >+0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L, >+0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L, >+0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L, >+0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L, >+0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L, >+0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L, >+0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L, >+0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L, >+0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L, >+0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L, >+0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L, >+0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L, >+},{ >+/* nibble 4 */ >+0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L, >+0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L, >+0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L, >+0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L, >+0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L, >+0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L, >+0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L, >+0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L, >+0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L, >+0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L, >+0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L, >+0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L, >+0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L, >+0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L, >+0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L, >+0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L, >+},{ >+/* nibble 5 */ >+0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L, >+0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L, >+0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L, >+0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L, >+0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L, >+0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L, >+0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L, >+0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L, >+0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L, >+0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L, >+0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L, >+0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L, >+0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L, >+0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L, >+0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L, >+0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L, >+},{ >+/* nibble 6 */ >+0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L, >+0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L, >+0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L, >+0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L, >+0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L, >+0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L, >+0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L, >+0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L, >+0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L, >+0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L, >+0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L, >+0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L, >+0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L, >+0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L, >+0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L, >+0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L, >+},{ >+/* nibble 7 */ >+0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L, >+0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L, >+0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L, >+0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L, >+0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L, >+0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L, >+0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L, >+0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L, >+0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L, >+0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L, >+0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L, >+0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L, >+0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L, >+0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L, >+0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, >+0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, >+}}; >+ >+static const DES_LONG des_skb[8][64]={ >+ { >+ /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ >+ 0x00000000L,0x00000010L,0x20000000L,0x20000010L, >+ 0x00010000L,0x00010010L,0x20010000L,0x20010010L, >+ 0x00000800L,0x00000810L,0x20000800L,0x20000810L, >+ 0x00010800L,0x00010810L,0x20010800L,0x20010810L, >+ 0x00000020L,0x00000030L,0x20000020L,0x20000030L, >+ 0x00010020L,0x00010030L,0x20010020L,0x20010030L, >+ 0x00000820L,0x00000830L,0x20000820L,0x20000830L, >+ 0x00010820L,0x00010830L,0x20010820L,0x20010830L, >+ 0x00080000L,0x00080010L,0x20080000L,0x20080010L, >+ 0x00090000L,0x00090010L,0x20090000L,0x20090010L, >+ 0x00080800L,0x00080810L,0x20080800L,0x20080810L, >+ 0x00090800L,0x00090810L,0x20090800L,0x20090810L, >+ 0x00080020L,0x00080030L,0x20080020L,0x20080030L, >+ 0x00090020L,0x00090030L,0x20090020L,0x20090030L, >+ 0x00080820L,0x00080830L,0x20080820L,0x20080830L, >+ 0x00090820L,0x00090830L,0x20090820L,0x20090830L, >+ },{ >+ /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ >+ 0x00000000L,0x02000000L,0x00002000L,0x02002000L, >+ 0x00200000L,0x02200000L,0x00202000L,0x02202000L, >+ 0x00000004L,0x02000004L,0x00002004L,0x02002004L, >+ 0x00200004L,0x02200004L,0x00202004L,0x02202004L, >+ 0x00000400L,0x02000400L,0x00002400L,0x02002400L, >+ 0x00200400L,0x02200400L,0x00202400L,0x02202400L, >+ 0x00000404L,0x02000404L,0x00002404L,0x02002404L, >+ 0x00200404L,0x02200404L,0x00202404L,0x02202404L, >+ 0x10000000L,0x12000000L,0x10002000L,0x12002000L, >+ 0x10200000L,0x12200000L,0x10202000L,0x12202000L, >+ 0x10000004L,0x12000004L,0x10002004L,0x12002004L, >+ 0x10200004L,0x12200004L,0x10202004L,0x12202004L, >+ 0x10000400L,0x12000400L,0x10002400L,0x12002400L, >+ 0x10200400L,0x12200400L,0x10202400L,0x12202400L, >+ 0x10000404L,0x12000404L,0x10002404L,0x12002404L, >+ 0x10200404L,0x12200404L,0x10202404L,0x12202404L, >+ },{ >+ /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ >+ 0x00000000L,0x00000001L,0x00040000L,0x00040001L, >+ 0x01000000L,0x01000001L,0x01040000L,0x01040001L, >+ 0x00000002L,0x00000003L,0x00040002L,0x00040003L, >+ 0x01000002L,0x01000003L,0x01040002L,0x01040003L, >+ 0x00000200L,0x00000201L,0x00040200L,0x00040201L, >+ 0x01000200L,0x01000201L,0x01040200L,0x01040201L, >+ 0x00000202L,0x00000203L,0x00040202L,0x00040203L, >+ 0x01000202L,0x01000203L,0x01040202L,0x01040203L, >+ 0x08000000L,0x08000001L,0x08040000L,0x08040001L, >+ 0x09000000L,0x09000001L,0x09040000L,0x09040001L, >+ 0x08000002L,0x08000003L,0x08040002L,0x08040003L, >+ 0x09000002L,0x09000003L,0x09040002L,0x09040003L, >+ 0x08000200L,0x08000201L,0x08040200L,0x08040201L, >+ 0x09000200L,0x09000201L,0x09040200L,0x09040201L, >+ 0x08000202L,0x08000203L,0x08040202L,0x08040203L, >+ 0x09000202L,0x09000203L,0x09040202L,0x09040203L, >+ },{ >+ /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ >+ 0x00000000L,0x00100000L,0x00000100L,0x00100100L, >+ 0x00000008L,0x00100008L,0x00000108L,0x00100108L, >+ 0x00001000L,0x00101000L,0x00001100L,0x00101100L, >+ 0x00001008L,0x00101008L,0x00001108L,0x00101108L, >+ 0x04000000L,0x04100000L,0x04000100L,0x04100100L, >+ 0x04000008L,0x04100008L,0x04000108L,0x04100108L, >+ 0x04001000L,0x04101000L,0x04001100L,0x04101100L, >+ 0x04001008L,0x04101008L,0x04001108L,0x04101108L, >+ 0x00020000L,0x00120000L,0x00020100L,0x00120100L, >+ 0x00020008L,0x00120008L,0x00020108L,0x00120108L, >+ 0x00021000L,0x00121000L,0x00021100L,0x00121100L, >+ 0x00021008L,0x00121008L,0x00021108L,0x00121108L, >+ 0x04020000L,0x04120000L,0x04020100L,0x04120100L, >+ 0x04020008L,0x04120008L,0x04020108L,0x04120108L, >+ 0x04021000L,0x04121000L,0x04021100L,0x04121100L, >+ 0x04021008L,0x04121008L,0x04021108L,0x04121108L, >+ },{ >+ /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ >+ 0x00000000L,0x10000000L,0x00010000L,0x10010000L, >+ 0x00000004L,0x10000004L,0x00010004L,0x10010004L, >+ 0x20000000L,0x30000000L,0x20010000L,0x30010000L, >+ 0x20000004L,0x30000004L,0x20010004L,0x30010004L, >+ 0x00100000L,0x10100000L,0x00110000L,0x10110000L, >+ 0x00100004L,0x10100004L,0x00110004L,0x10110004L, >+ 0x20100000L,0x30100000L,0x20110000L,0x30110000L, >+ 0x20100004L,0x30100004L,0x20110004L,0x30110004L, >+ 0x00001000L,0x10001000L,0x00011000L,0x10011000L, >+ 0x00001004L,0x10001004L,0x00011004L,0x10011004L, >+ 0x20001000L,0x30001000L,0x20011000L,0x30011000L, >+ 0x20001004L,0x30001004L,0x20011004L,0x30011004L, >+ 0x00101000L,0x10101000L,0x00111000L,0x10111000L, >+ 0x00101004L,0x10101004L,0x00111004L,0x10111004L, >+ 0x20101000L,0x30101000L,0x20111000L,0x30111000L, >+ 0x20101004L,0x30101004L,0x20111004L,0x30111004L, >+ },{ >+ /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ >+ 0x00000000L,0x08000000L,0x00000008L,0x08000008L, >+ 0x00000400L,0x08000400L,0x00000408L,0x08000408L, >+ 0x00020000L,0x08020000L,0x00020008L,0x08020008L, >+ 0x00020400L,0x08020400L,0x00020408L,0x08020408L, >+ 0x00000001L,0x08000001L,0x00000009L,0x08000009L, >+ 0x00000401L,0x08000401L,0x00000409L,0x08000409L, >+ 0x00020001L,0x08020001L,0x00020009L,0x08020009L, >+ 0x00020401L,0x08020401L,0x00020409L,0x08020409L, >+ 0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, >+ 0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, >+ 0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, >+ 0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, >+ 0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, >+ 0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, >+ 0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, >+ 0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, >+ },{ >+ /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ >+ 0x00000000L,0x00000100L,0x00080000L,0x00080100L, >+ 0x01000000L,0x01000100L,0x01080000L,0x01080100L, >+ 0x00000010L,0x00000110L,0x00080010L,0x00080110L, >+ 0x01000010L,0x01000110L,0x01080010L,0x01080110L, >+ 0x00200000L,0x00200100L,0x00280000L,0x00280100L, >+ 0x01200000L,0x01200100L,0x01280000L,0x01280100L, >+ 0x00200010L,0x00200110L,0x00280010L,0x00280110L, >+ 0x01200010L,0x01200110L,0x01280010L,0x01280110L, >+ 0x00000200L,0x00000300L,0x00080200L,0x00080300L, >+ 0x01000200L,0x01000300L,0x01080200L,0x01080300L, >+ 0x00000210L,0x00000310L,0x00080210L,0x00080310L, >+ 0x01000210L,0x01000310L,0x01080210L,0x01080310L, >+ 0x00200200L,0x00200300L,0x00280200L,0x00280300L, >+ 0x01200200L,0x01200300L,0x01280200L,0x01280300L, >+ 0x00200210L,0x00200310L,0x00280210L,0x00280310L, >+ 0x01200210L,0x01200310L,0x01280210L,0x01280310L, >+ },{ >+ /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ >+ 0x00000000L,0x04000000L,0x00040000L,0x04040000L, >+ 0x00000002L,0x04000002L,0x00040002L,0x04040002L, >+ 0x00002000L,0x04002000L,0x00042000L,0x04042000L, >+ 0x00002002L,0x04002002L,0x00042002L,0x04042002L, >+ 0x00000020L,0x04000020L,0x00040020L,0x04040020L, >+ 0x00000022L,0x04000022L,0x00040022L,0x04040022L, >+ 0x00002020L,0x04002020L,0x00042020L,0x04042020L, >+ 0x00002022L,0x04002022L,0x00042022L,0x04042022L, >+ 0x00000800L,0x04000800L,0x00040800L,0x04040800L, >+ 0x00000802L,0x04000802L,0x00040802L,0x04040802L, >+ 0x00002800L,0x04002800L,0x00042800L,0x04042800L, >+ 0x00002802L,0x04002802L,0x00042802L,0x04042802L, >+ 0x00000820L,0x04000820L,0x00040820L,0x04040820L, >+ 0x00000822L,0x04000822L,0x00040822L,0x04040822L, >+ 0x00002820L,0x04002820L,0x00042820L,0x04042820L, >+ 0x00002822L,0x04002822L,0x00042822L,0x04042822L, >+ }}; >+ >+#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ >+ l|=((DES_LONG)(*((c)++)))<< 8L, \ >+ l|=((DES_LONG)(*((c)++)))<<16L, \ >+ l|=((DES_LONG)(*((c)++)))<<24L) >+ >+#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ >+ *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ >+ *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ >+ *((c)++)=(unsigned char)(((l)>>24L)&0xff)) >+#define c2ln(c,l1,l2,n) { \ >+ c+=n; \ >+ l1=l2=0; \ >+ switch (n) { \ >+ case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ >+ case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ >+ case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ >+ case 5: l2|=((DES_LONG)(*(--(c)))); \ >+ case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ >+ case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ >+ case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ >+ case 1: l1|=((DES_LONG)(*(--(c)))); \ >+ } \ >+ } >+ >+#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ >+ (a)=(a)^(t)^(t>>(16-(n)))) >+ >+#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ >+ (b)^=(t),\ >+ (a)=((a)^((t)<<(n)))) >+ >+#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) >+ >+#define IP(l,r) \ >+ { \ >+ register DES_LONG tt; \ >+ PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ >+ PERM_OP(l,r,tt,16,0x0000ffffL); \ >+ PERM_OP(r,l,tt, 2,0x33333333L); \ >+ PERM_OP(l,r,tt, 8,0x00ff00ffL); \ >+ PERM_OP(r,l,tt, 1,0x55555555L); \ >+ } >+ >+#define FP(l,r) \ >+ { \ >+ register DES_LONG tt; \ >+ PERM_OP(l,r,tt, 1,0x55555555L); \ >+ PERM_OP(r,l,tt, 8,0x00ff00ffL); \ >+ PERM_OP(l,r,tt, 2,0x33333333L); \ >+ PERM_OP(r,l,tt,16,0x0000ffffL); \ >+ PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ >+ } >+#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ >+ u=R^s[S ]; \ >+ t=R^s[S+1] >+#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) >+ >+#define D_ENCRYPT(LL,R,S) { \ >+ LOAD_DATA_tmp(R,S,u,t,E0,E1); \ >+ t=ROTATE(t,4); \ >+ LL^= \ >+ *(const DES_LONG *)(des_SP +((u )&0xfc))^ \ >+ *(const DES_LONG *)(des_SP+0x200+((u>> 8L)&0xfc))^ \ >+ *(const DES_LONG *)(des_SP+0x400+((u>>16L)&0xfc))^ \ >+ *(const DES_LONG *)(des_SP+0x600+((u>>24L)&0xfc))^ \ >+ *(const DES_LONG *)(des_SP+0x100+((t )&0xfc))^ \ >+ *(const DES_LONG *)(des_SP+0x300+((t>> 8L)&0xfc))^ \ >+ *(const DES_LONG *)(des_SP+0x500+((t>>16L)&0xfc))^ \ >+ *(const DES_LONG *)(des_SP+0x700+((t>>24L)&0xfc)); } >+ >+void my_des_set_key(DES_cblock *key, DES_key_schedule *schedule) >+{ >+ //DES_set_key_unchecked(key, schedule); >+ static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; >+ register DES_LONG c,d,t,s,t2; >+ register const unsigned char *in; >+ register DES_LONG *k; >+ register int i; >+ >+ k = &schedule->ks->deslong[0]; >+ in = &(*key)[0]; >+ >+ c2l(in,c); >+ c2l(in,d); >+ >+ /* do PC1 in 47 simple operations :-) >+ * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) >+ * for the inspiration. :-) */ >+ PERM_OP (d,c,t,4,0x0f0f0f0fL); >+ HPERM_OP(c,t,-2,0xcccc0000L); >+ HPERM_OP(d,t,-2,0xcccc0000L); >+ PERM_OP (d,c,t,1,0x55555555L); >+ PERM_OP (c,d,t,8,0x00ff00ffL); >+ PERM_OP (d,c,t,1,0x55555555L); >+ d= (((d&0x000000ffL)<<16L)| (d&0x0000ff00L) | >+ ((d&0x00ff0000L)>>16L)|((c&0xf0000000L)>>4L)); >+ c&=0x0fffffffL; >+ >+ for (i=0; i<16; i++) >+ { >+ if (shifts2[i]) >+ { >+ c=((c>>2L)|(c<<26L)); >+ d=((d>>2L)|(d<<26L)); >+ } >+ else >+ { >+ c=((c>>1L)|(c<<27L)); >+ d=((d>>1L)|(d<<27L)); >+ } >+ c&=0x0fffffffL; >+ d&=0x0fffffffL; >+ /* could be a few less shifts but I am to lazy at this >+ * point in time to investigate */ >+ s= des_skb[0][ (c )&0x3f ]| >+ des_skb[1][((c>> 6L)&0x03)|((c>> 7L)&0x3c)]| >+ des_skb[2][((c>>13L)&0x0f)|((c>>14L)&0x30)]| >+ des_skb[3][((c>>20L)&0x01)|((c>>21L)&0x06) | >+ ((c>>22L)&0x38)]; >+ t= des_skb[4][ (d )&0x3f ]| >+ des_skb[5][((d>> 7L)&0x03)|((d>> 8L)&0x3c)]| >+ des_skb[6][ (d>>15L)&0x3f ]| >+ des_skb[7][((d>>21L)&0x0f)|((d>>22L)&0x30)]; >+ >+ /* table contained 0213 4657 */ >+ t2=((t<<16L)|(s&0x0000ffffL))&0xffffffffL; >+ *(k++)=ROTATE(t2,30)&0xffffffffL; >+ >+ t2=((s>>16L)|(t&0xffff0000L)); >+ *(k++)=ROTATE(t2,26)&0xffffffffL; >+ } >+} >+ >+static void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks) >+{ >+ register DES_LONG l,r,t,u; >+ register DES_LONG *s; >+ register const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; >+ >+ r=data[0]; >+ l=data[1]; >+ >+ IP(r,l); >+ /* Things have been modified so that the initial rotate is >+ * done outside the loop. This required the >+ * DES_SPtrans values in sp.h to be rotated 1 bit to the right. >+ * One perl script later and things have a 5% speed up on a sparc2. >+ * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> >+ * for pointing this out. */ >+ /* clear the top bits on machines with 8byte longs */ >+ /* shift left by 2 */ >+ r=ROTATE(r,29)&0xffffffffL; >+ l=ROTATE(l,29)&0xffffffffL; >+ >+ s=ks->ks->deslong; >+ /* I don't know if it is worth the effort of loop unrolling the >+ * inner loop */ >+ D_ENCRYPT(l,r, 0); /* 1 */ >+ D_ENCRYPT(r,l, 2); /* 2 */ >+ D_ENCRYPT(l,r, 4); /* 3 */ >+ D_ENCRYPT(r,l, 6); /* 4 */ >+ D_ENCRYPT(l,r, 8); /* 5 */ >+ D_ENCRYPT(r,l,10); /* 6 */ >+ D_ENCRYPT(l,r,12); /* 7 */ >+ D_ENCRYPT(r,l,14); /* 8 */ >+ D_ENCRYPT(l,r,16); /* 9 */ >+ D_ENCRYPT(r,l,18); /* 10 */ >+ D_ENCRYPT(l,r,20); /* 11 */ >+ D_ENCRYPT(r,l,22); /* 12 */ >+ D_ENCRYPT(l,r,24); /* 13 */ >+ D_ENCRYPT(r,l,26); /* 14 */ >+ D_ENCRYPT(l,r,28); /* 15 */ >+ D_ENCRYPT(r,l,30); /* 16 */ >+ >+ /* rotate and clear the top bits on machines with 8byte longs */ >+ l=ROTATE(l,3)&0xffffffffL; >+ r=ROTATE(r,3)&0xffffffffL; >+ >+ FP(r,l); >+ data[0]=l; >+ data[1]=r; >+ //l=r=t=u=0; >+} >+ >+void my_des_ncbc_encrypt(const unsigned char *in, >+ long length, DES_key_schedule *schedule, DES_cblock *ivec) >+{ >+ register DES_LONG tin0,tin1; >+ register DES_LONG tout0,tout1; >+ register long l=length; >+ DES_LONG tin[2]; >+ unsigned char *iv; >+ >+ iv = &(*ivec)[0]; >+ c2l(iv,tout0); >+ c2l(iv,tout1); >+ >+ for (l-=8; l>=0; l-=8) >+ { >+ c2l(in,tin0); >+ c2l(in,tin1); >+ tin0^=tout0; tin[0]=tin0; >+ tin1^=tout1; tin[1]=tin1; >+ DES_encrypt1((DES_LONG *)tin,schedule); >+ tout0=tin[0]; >+ tout1=tin[1]; >+ } >+ if (l != -8) >+ { >+ c2ln(in,tin0,tin1,l+8); >+ tin0^=tout0; tin[0]=tin0; >+ tin1^=tout1; tin[1]=tin1; >+ DES_encrypt1((DES_LONG *)tin,schedule); >+ tout0=tin[0]; >+ tout1=tin[1]; >+ } >+ >+ iv = &(*ivec)[0]; >+ l2c(tout0,iv); >+ l2c(tout1,iv); >+} >diff -ruN john-1.7.0.1/src/des.h john-1.7.0.1-banquise-to-bigpatch-18/src/des.h >--- john-1.7.0.1/src/des.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/des.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,27 @@ >+#ifndef _DES_H >+#define _DES_H >+ >+//#include <openssl/des.h> >+typedef unsigned long DES_LONG; >+ >+typedef unsigned char DES_cblock[8]; >+ >+typedef struct DES_ks >+ { >+ union >+ { >+ DES_cblock cblock; >+ /* make sure things are correct size on machines with >+ * 8 byte longs */ >+ DES_LONG deslong[2]; >+ } ks[16]; >+ } DES_key_schedule; >+ >+ >+ >+void my_des_ncbc_encrypt(const unsigned char *input, >+ long length, DES_key_schedule *schedule, DES_cblock *ivec); >+void my_des_set_key(DES_cblock *key, DES_key_schedule *schedule); >+ >+ >+#endif >diff -ruN john-1.7.0.1/src/hmacMD5_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/hmacMD5_fmt.c >--- john-1.7.0.1/src/hmacMD5_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/hmacMD5_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,310 @@ >+/* >+ * Copyright (c) 2004 bartavelle >+ * bartavelle@bandecon.com >+ * >+ * Simple MD5 hashes cracker >+ * It uses the Solar Designer's md5 implementation >+ * >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "misc.h" >+#include "common.h" >+#include "formats.h" >+#include "md5.h" >+ >+#define FORMAT_LABEL "hmac-md5" >+#define FORMAT_NAME "HMAC MD5" >+#ifdef MMX_COEF >+#if (MMX_COEF == 2) >+#define ALGORITHM_NAME "hmac-md5 MMX" >+#else >+#define ALGORITHM_NAME "hmac-md5 SSE2" >+#endif >+#else >+#define ALGORITHM_NAME "hmac-md5" >+#endif >+ >+#ifdef MMX_TYPE >+#define BENCHMARK_COMMENT MMX_TYPE >+#else >+#define BENCHMARK_COMMENT "" >+#endif >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 64 >+#define CIPHERTEXT_LENGTH 128 >+ >+#define BINARY_SIZE 16 >+#define SALT_SIZE 64 >+ >+#ifdef MMX_COEF >+#define MIN_KEYS_PER_CRYPT MMX_COEF >+#define MAX_KEYS_PER_CRYPT MMX_COEF >+#define GETPOS(i, index) ( (index)*4 + (i& (0xffffffff-3) )*MMX_COEF + ((i)&3) ) >+#else >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+#endif >+ >+static struct fmt_tests hmacmd5_tests[] = { >+ {"what do ya want for nothing?#750c783e6ab0b503eaa86e310a5db738", "Jefe"}, >+ {NULL} >+}; >+ >+#ifdef MMX_COEF >+//static char saved_key[PLAINTEXT_LENGTH*MMX_COEF*2 + 1] __attribute__ ((aligned(16))); >+static char crypt_key[64*MMX_COEF] __attribute__ ((aligned(16))); >+unsigned long total_len; >+unsigned char opad[PLAINTEXT_LENGTH*MMX_COEF] __attribute__ ((aligned(16))); >+unsigned char ipad[PLAINTEXT_LENGTH*MMX_COEF] __attribute__ ((aligned(16))); >+unsigned char cursalt[SALT_SIZE*MMX_COEF] __attribute__ ((aligned(16))); >+unsigned char dump[BINARY_SIZE*MMX_COEF] __attribute__((aligned(16))); >+#else >+//static char saved_key[PLAINTEXT_LENGTH + 1]; >+static char crypt_key[BINARY_SIZE+1]; >+static MD5_CTX ctx; >+unsigned char opad[PLAINTEXT_LENGTH]; >+unsigned char ipad[PLAINTEXT_LENGTH]; >+unsigned char cursalt[SALT_SIZE]; >+#endif >+unsigned char out[PLAINTEXT_LENGTH]; >+ >+static void hmacmd5_init(void) >+{ >+#ifdef MMX_COEF >+ memset(crypt_key, 0, 64*MMX_COEF); >+ crypt_key[GETPOS(BINARY_SIZE,0)] = 0x80; >+ crypt_key[GETPOS(BINARY_SIZE,1)] = 0x80; >+#if (MMX_COEF == 4) >+ crypt_key[GETPOS(BINARY_SIZE,2)] = 0x80; >+ crypt_key[GETPOS(BINARY_SIZE,3)] = 0x80; >+#endif >+#endif >+} >+ >+static int valid(char *ciphertext) >+{ >+ int pos, i; >+ >+ for(i=0;(i<strlen(ciphertext)) && (ciphertext[i]!='#');i++) ; >+ if(i==strlen(ciphertext)) >+ return 0; >+ pos = i+1; >+ if (strlen(ciphertext+pos) != BINARY_SIZE*2) return 0; >+ for (i = pos; i < BINARY_SIZE*2+pos; i++){ >+ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) || >+ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f')) >+ || (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F')))) >+ return 0; >+ } >+ return 1; >+} >+ >+static void hmacmd5_set_salt(void *salt) >+{ >+#ifdef MMX_COEF >+ total_len = 0; >+ while(((unsigned char *)salt)[total_len]) >+ { >+ cursalt[GETPOS(total_len, 0)] = ((unsigned char *)salt)[total_len]; >+ cursalt[GETPOS(total_len, 1)] = ((unsigned char *)salt)[total_len]; >+#if (MMX_COEF == 4) >+ cursalt[GETPOS(total_len, 2)] = ((unsigned char *)salt)[total_len]; >+ cursalt[GETPOS(total_len, 3)] = ((unsigned char *)salt)[total_len]; >+#endif >+ total_len ++; >+ } >+ cursalt[GETPOS(total_len, 0)] = 0x80; >+ cursalt[GETPOS(total_len, 1)] = 0x80; >+#if (MMX_COEF == 4) >+ cursalt[GETPOS(total_len, 2)] = 0x80; >+ cursalt[GETPOS(total_len, 3)] = 0x80; >+#endif >+ //total_len += 64; >+ //total_len += (total_len<<16); >+#else >+ memcpy(cursalt, salt, SALT_SIZE); >+#endif >+} >+ >+static void hmacmd5_set_key(char *key, int index) { >+ int i; >+ int len; >+ >+ len = strlen(key); >+ if(len>PLAINTEXT_LENGTH) >+ len = PLAINTEXT_LENGTH; >+ >+#ifdef MMX_COEF >+ if(index==0) >+ { >+ memset(ipad, 0x36, PLAINTEXT_LENGTH*MMX_COEF); >+ memset(opad, 0x5C, PLAINTEXT_LENGTH*MMX_COEF); >+ } >+ >+ for(i=0;i<len;i++) >+ { >+ ipad[GETPOS(i, index)] ^= key[i]; >+ opad[GETPOS(i, index)] ^= key[i]; >+ } >+ >+ //saved_key[GETPOS(i, index)] = 0x80; >+#else >+ memset(ipad, 0x36, PLAINTEXT_LENGTH); >+ memset(opad, 0x5C, PLAINTEXT_LENGTH); >+ for(i=0;i<len;i++) >+ { >+ ipad[i] ^= key[i]; >+ opad[i] ^= key[i]; >+ } >+#endif >+} >+ >+static char *hmacmd5_get_key(int index) { >+ unsigned int i; >+ for(i=0;i<PLAINTEXT_LENGTH;i++) >+#ifdef MMX_COEF >+ out[i] = ipad[ GETPOS(i, index) ] ^ 0x36; >+#else >+ out[i] = ipad[ i ] ^ 0x36; >+#endif >+ return out; >+} >+ >+static int hmacmd5_cmp_all(void *binary, int index) { >+ int i=0; >+#ifdef MMX_COEF >+ while(i< (BINARY_SIZE/4) ) >+ { >+ if ( >+ ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+1]) >+#if (MMX_COEF > 3) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+2]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+3]) >+#endif >+ ) >+ return 0; >+ i++; >+ } >+#else >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+#endif >+ return 1; >+} >+ >+static int hmacmd5_cmp_exact(char *source, int count){ >+ return (1); >+} >+ >+static int hmacmd5_cmp_one(void * binary, int index) >+{ >+#ifdef MMX_COEF >+ int i = 0; >+ for(i=0;i<(BINARY_SIZE/4);i++) >+ if ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+index] ) >+ return 0; >+ return 1; >+#else >+ return hmacmd5_cmp_all(binary, index); >+#endif >+} >+ >+static void hmacmd5_crypt_all(int count) { >+ >+#ifdef MMX_COEF >+ int i; >+ i = mdfivemmx_nosizeupdate( dump, ipad, 64); >+ i = mdfivemmx_noinit_uniformsizeupdate(crypt_key, cursalt, total_len + 64); >+ i = mdfivemmx_nosizeupdate( dump, opad, 64); >+ i = mdfivemmx_noinit_uniformsizeupdate(crypt_key, crypt_key, BINARY_SIZE + 64); >+#else >+ MD5_Init( &ctx ); >+ MD5_Update( &ctx, ipad, 64 ); >+ MD5_Update( &ctx, cursalt, strlen(cursalt) ); >+ MD5_Final( crypt_key, &ctx); >+ MD5_Init( &ctx ); >+ MD5_Update( &ctx, opad, 64 ); >+ MD5_Update( &ctx, crypt_key, BINARY_SIZE); >+ MD5_Final( crypt_key, &ctx); >+#endif >+ >+} >+ >+static void * hmacmd5_binary(char *ciphertext) >+{ >+ static unsigned char realcipher[BINARY_SIZE]; >+ int i,pos; >+ >+ for(i=0;ciphertext[i]!='#';i++); >+ pos=i+1; >+ for(i=0;i<BINARY_SIZE;i++) >+ { >+ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2+pos])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1+pos])]; >+ } >+ return (void *)realcipher; >+} >+ >+static void * hmacmd5_salt(char *ciphertext) >+{ >+ static unsigned char salt[SALT_SIZE]; >+ memset(salt, 0, SALT_SIZE); >+ int i=0; >+ while(ciphertext[i]!='#') >+ { >+ salt[i] = ciphertext[i]; >+ i++; >+ } >+ salt[i]=0; >+ return salt; >+} >+ >+struct fmt_main fmt_hmacMD5 = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ hmacmd5_tests >+ }, { >+ hmacmd5_init, >+ valid, >+ fmt_default_split, >+ hmacmd5_binary, >+ hmacmd5_salt, >+ { >+ fmt_default_binary_hash, >+ fmt_default_binary_hash, >+ fmt_default_binary_hash >+ }, >+ fmt_default_salt_hash, >+ hmacmd5_set_salt, >+ hmacmd5_set_key, >+ hmacmd5_get_key, >+ fmt_default_clear_keys, >+ hmacmd5_crypt_all, >+ { >+ fmt_default_get_hash, >+ fmt_default_get_hash, >+ fmt_default_get_hash >+ }, >+ hmacmd5_cmp_all, >+ hmacmd5_cmp_one, >+ hmacmd5_cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/john.c john-1.7.0.1-banquise-to-bigpatch-18/src/john.c >--- john-1.7.0.1/src/john.c 2006-01-09 14:13:15.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/john.c 2006-03-16 04:19:36.000000000 +0000 >@@ -37,11 +37,26 @@ > #endif > > extern struct fmt_main fmt_DES, fmt_BSDI, fmt_MD5, fmt_BF; >-extern struct fmt_main fmt_AFS, fmt_LM; >+extern struct fmt_main fmt_AFS, fmt_LM, fmt_rawMD5, fmt_NT; >+extern struct fmt_main fmt_MD5_apache; >+extern struct fmt_main fmt_BFEgg; >+extern struct fmt_main fmt_MYSQL; >+extern struct fmt_main fmt_NSLDAP; >+extern struct fmt_main fmt_lotus5; >+extern struct fmt_main fmt_mscash; >+extern struct fmt_main fmt_rawSHA1; >+extern struct fmt_main fmt_mssql; >+extern struct fmt_main fmt_hmacMD5; >+extern struct fmt_main fmt_WPAPSK; >+extern struct fmt_main fmt_oracle; >+#ifdef MMX_COEF >+extern struct fmt_main fmt_NTmmx; >+#endif > > extern int unshadow(int argc, char **argv); > extern int unafs(int argc, char **argv); > extern int unique(int argc, char **argv); >+extern int undrop(int argc, char **argv); > > static struct db_main database; > static struct fmt_main dummy_format; >@@ -65,6 +80,24 @@ > john_register_one(&fmt_AFS); > john_register_one(&fmt_LM); > >+ /* new ciphers */ >+ john_register_one(&fmt_MD5_apache); >+ john_register_one(&fmt_MYSQL); >+ john_register_one(&fmt_NSLDAP); >+ john_register_one(&fmt_NT); >+ john_register_one(&fmt_lotus5); >+ john_register_one(&fmt_mscash); >+ john_register_one(&fmt_rawMD5); >+ john_register_one(&fmt_BFEgg); >+ john_register_one(&fmt_rawSHA1); >+ john_register_one(&fmt_mssql); >+ john_register_one(&fmt_hmacMD5); >+ john_register_one(&fmt_WPAPSK); >+ john_register_one(&fmt_oracle); >+ #ifdef MMX_COEF >+ john_register_one(&fmt_NTmmx); >+ #endif >+ > if (!fmt_list) { > fprintf(stderr, "Unknown ciphertext format name requested\n"); > error(); >@@ -341,6 +374,9 @@ > if (!strcmp(name, "unique")) > return unique(argc, argv); > >+ if (!strcmp(name, "undrop")) >+ return undrop(argc, argv); >+ > john_init(name, argc, argv); > john_run(); > john_done(); >diff -ruN john-1.7.0.1/src/loader.c john-1.7.0.1-banquise-to-bigpatch-18/src/loader.c >--- john-1.7.0.1/src/loader.c 2005-11-08 13:03:20.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/loader.c 2006-03-16 04:35:25.000000000 +0000 >@@ -206,6 +206,27 @@ > if (!strncmp(*ciphertext, "NO PASSWORD", 11)) > *ciphertext = ""; > >+ /* NT loader hack starts here ! */ >+ extern struct fmt_main fmt_NT; >+ >+ /* TODO test !!! */ >+ if (&fmt_NT == *format) { >+ >+ /* >+ tmp = ldr_get_field(&line); >+ *ciphertext = tmp; >+ */ >+ >+ if (!strncmp(*ciphertext, "NO PASSWORD", 11)) >+ *ciphertext = ""; >+ else { >+ *ciphertext -= 4; >+ strncpy(*ciphertext,"$NT$",4); >+ } >+ } >+ >+ /* NT loader hack ends here ! */ >+ > if (source) sprintf(source, "%s:%s", uid, line); > } > >@@ -287,6 +308,9 @@ > struct list_main *words; > size_t pw_size, salt_size; > >+ extern struct fmt_main fmt_mscash; >+ extern struct fmt_main fmt_oracle; >+ > count = ldr_split_line(&login, &ciphertext, &gecos, &home, > NULL, &db->format, db->options, line); > if (count <= 0) return; >@@ -311,7 +335,14 @@ > } > > for (index = 0; index < count; index++) { >- piece = format->methods.split(ciphertext, index); >+ if (db->format == &fmt_mscash) { >+ piece = (char *) mem_alloc_tiny(strlen(login) + strlen(ciphertext) + 4, MEM_ALIGN_NONE); >+ sprintf(piece, "M$%s#%s", login, ciphertext); >+ } else if (db->format == &fmt_oracle) { >+ piece = (char *) mem_alloc_tiny(strlen(login) + strlen(ciphertext) + 4, MEM_ALIGN_NONE); >+ sprintf(piece, "O$%s#%s", login, ciphertext); >+ } else >+ piece = format->methods.split(ciphertext, index); > > binary = format->methods.binary(piece); > pw_hash = LDR_HASH_FUNC(binary); >@@ -644,6 +675,9 @@ > int hash; > struct db_cracked *current; > >+ extern struct fmt_main fmt_mscash; >+ extern struct fmt_main fmt_oracle; >+ > format = NULL; > count = ldr_split_line(&login, &ciphertext, &gecos, &home, > source, &format, db->options, line); >@@ -653,6 +687,16 @@ > > if (format) { > split = format->methods.split; >+ if (format == &fmt_mscash) { >+ char * ciphertext2 = (char *) mem_alloc_tiny(strlen(login) + strlen(ciphertext) + 4, MEM_ALIGN_NONE); >+ sprintf(ciphertext2, "M$%s#%s", login, ciphertext); >+ ciphertext = ciphertext2; >+ } >+ if (format == &fmt_oracle) { >+ char * ciphertext2 = (char *) mem_alloc_tiny(strlen(login) + strlen(ciphertext) + 4, MEM_ALIGN_NONE); >+ sprintf(ciphertext2, "O$%s#%s", login, ciphertext); >+ ciphertext = ciphertext2; >+ } > unify = format->params.flags & FMT_SPLIT_UNIFIES_CASE; > } else { > split = fmt_default_split; >@@ -692,6 +736,18 @@ > MEM_FREE(piece); > > if (pass) { >+ /* modification by bartavelle, catches the no format bug */ >+ /* >+ if(format) >+ chars = format->params.plaintext_length; >+ else >+ chars = 0; >+ >+ if (current && show && index < count - 1) >+ if ((int)strlen(current->plaintext) != chars) >+ current = NULL; >+ */ >+ > chars = 0; > if (show) { > if (format) >@@ -710,6 +766,13 @@ > > db->guess_count++; > } else >+ /* >+ if (show) >+ do { >+ putchar('?'); >+ } while (--chars); >+ */ >+ > while (chars--) > putchar('?'); > } else >diff -ruN john-1.7.0.1/src/lotus5_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/lotus5_fmt.c >--- john-1.7.0.1/src/lotus5_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/lotus5_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,247 @@ >+//original work by Jeff Fay >+//some optimisations by bartavelle@bandecon.com >+ >+#include <stdio.h> >+#include <string.h> >+#include "misc.h" >+#include "formats.h" >+#include "common.h" >+ >+/*preprocessor constants that John The Ripper likes*/ >+#define FORMAT_LABEL "lotus5" >+#define FORMAT_NAME "Lotus5" >+#define ALGORITHM_NAME "Lotus v5 Proprietary" >+#define BENCHMARK_COMMENT "" >+#define BENCHMARK_LENGTH -1 >+#define PLAINTEXT_LENGTH 16 >+#define CIPHERTEXT_LENGTH 32 >+#define BINARY_SIZE 16 >+#define SALT_SIZE 0 >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+ >+/*A struct used for JTR's benchmarks*/ >+static struct fmt_tests tests[] = { >+ {"06E0A50B579AD2CD5FFDC48564627EE7", "secret"}, >+ {"355E98E7C7B59BD810ED845AD0FD2FC4", "password"}, >+ {"CD2D90E8E00D8A2A63A81F531EA8A9A3", "lotus"}, >+ {"69D90B46B1AC0912E5CCF858094BBBFC", "dirtydog"}, >+ {NULL} >+}; >+ >+static const char lotus_magic_table[256] = { >+ 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, >+ 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0, >+ 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, >+ 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, >+ 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda, >+ 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, >+ 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, >+ 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c, >+ 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, >+ 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, >+ 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72, >+ 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, >+ 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, >+ 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e, >+ 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, >+ 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, >+ 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77, >+ 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, >+ 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, >+ 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3, >+ 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, >+ 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, >+ 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d, >+ 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, >+ 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, >+ 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5, >+ 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, >+ 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, >+ 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef, >+ 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, >+ 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, >+ 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab, >+}; >+ >+/*Some more JTR variables*/ >+static char crypt_key[BINARY_SIZE+1]; >+static char saved_key[PLAINTEXT_LENGTH + 1]; >+ >+/*Utility function to convert hex to bin */ >+static void * binary (char *ciphertext) >+{ >+ static char realcipher[BINARY_SIZE]; >+ int i; >+ for (i = 0; i < BINARY_SIZE; i++) >+ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1])]; >+ return ((void *) realcipher); >+} >+ >+/*Another function required by JTR: decides whether we have a valid >+ * ciphertext */ >+static int >+valid (char *ciphertext) >+{ >+ int i; >+ >+ for (i = 0; i < CIPHERTEXT_LENGTH; i++) >+ if (!(((ciphertext[i] >= '0') && (ciphertext[i] <= '9')) >+ || ((ciphertext[i] >= 'a') && (ciphertext[i] <= 'f')) >+ || ((ciphertext[i] >= 'A') && (ciphertext[i] <= 'F')))) >+ { >+ return 0; >+ } >+ return 1; >+} >+ >+/*sets the value of saved_key so we can play with it*/ >+static void set_key (char *key, int index) >+{ >+ strnzcpy (saved_key, key, PLAINTEXT_LENGTH + 1); >+} >+ >+/*retrieves the saved key; used by JTR*/ >+static char * get_key (int index) >+{ >+ return saved_key; >+} >+static int >+cmp_all (void *binary, int index) >+{ >+ int i = 0; >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+ return 1; >+} >+static int cmp_exact (char *source, int index) >+{ >+ return 1; >+} >+ >+static void set_salt (void *salt) { } >+ >+ >+/*Beginning of private functions*/ >+/* Takes the plaintext password and generates the second row of our >+ * working matrix for the final call to the mixing function*/ >+void >+lotus_transform_password (unsigned char *inpass, unsigned char *outh) >+{ >+ unsigned char prevbyte; >+ int i; >+ >+ prevbyte = 0x00; >+ for (i = 0; i < 16; i++) >+ { >+ *outh = lotus_magic_table[ARCH_INDEX((*inpass) ^ prevbyte)]; >+ prevbyte = *outh; >+ ++outh; >+ ++inpass; >+ } >+} >+ >+/* The mixing function: perturbs the first three rows of the matrix*/ >+void lotus_mix (unsigned char *lotus_matrix) >+{ >+ int i, j; >+ unsigned char prevbyte; >+ unsigned char *temp; >+ >+ prevbyte = 0x00; >+ >+ for (i = 18; i > 0; i--) >+ { >+ temp = lotus_matrix; >+ for (j = 48; j > 0; j--) >+ { >+ *temp = *temp ^ lotus_magic_table[ARCH_INDEX((j + prevbyte) & 0xff)]; >+ prevbyte = *temp; >+ temp++; >+ } >+ } >+} >+ >+ >+/*the last public function; generates ciphertext*/ >+static void crypt_all (int count) >+{ >+ unsigned char password[PLAINTEXT_LENGTH]; >+ unsigned char lotus_matrix[64], *lotus_matrix1, *lotus_matrix2, *lotus_matrix3, *lotus_matrix4; >+ int i; >+ int password_length; >+ >+ password_length = strlen (saved_key); >+ memset (password, (PLAINTEXT_LENGTH - password_length), PLAINTEXT_LENGTH); >+ lotus_matrix1 = lotus_matrix; >+ lotus_matrix2 = lotus_matrix1 + 16; >+ lotus_matrix3 = lotus_matrix2 + 16; >+ lotus_matrix4 = lotus_matrix3 + 16; >+ memcpy (password, saved_key, password_length); >+ >+ memset (lotus_matrix1, 0, 16); >+ memcpy (lotus_matrix2, password, 16); >+ memcpy (lotus_matrix3, password, 16); >+ lotus_transform_password (lotus_matrix2, lotus_matrix4); >+ lotus_mix (lotus_matrix); >+ memcpy (lotus_matrix2, lotus_matrix4, 16); >+ for (i = 0; i < 16; i++) >+ { >+ lotus_matrix3[i] = lotus_matrix1[i] ^ lotus_matrix2[i]; >+ } >+ lotus_mix (lotus_matrix); >+ memcpy (crypt_key, lotus_matrix1, BINARY_SIZE); >+} >+ >+static int get_hash1(int index) { return (((unsigned int *)crypt_key)[0] & 0xf); } >+static int get_hash2(int index) { return (((unsigned int *)crypt_key)[0] & 0xff); } >+static int get_hash3(int index) { return (((unsigned int *)crypt_key)[0] & 0xfff); } >+static int binary_hash1(void * binary) { return (((unsigned int *)binary)[0] & 0xf); } >+static int binary_hash2(void * binary) { return (((unsigned int *)binary)[0] & 0xff); } >+static int binary_hash3(void * binary) { return (((unsigned int *)binary)[0] & 0xfff); } >+ >+/* C's version of a class specifier */ >+struct fmt_main fmt_lotus5 = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ tests >+ }, { >+ fmt_default_init, >+ valid, >+ fmt_default_split, >+ binary, >+ fmt_default_salt, >+ { >+ binary_hash1, >+ binary_hash2, >+ binary_hash3 >+ }, >+ fmt_default_salt_hash, >+ set_salt, >+ set_key, >+ get_key, >+ fmt_default_clear_keys, >+ crypt_all, >+ { >+ get_hash1, >+ get_hash2, >+ get_hash3 >+ }, >+ cmp_all, >+ cmp_all, >+ cmp_exact} >+}; >diff -ruN john-1.7.0.1/src/md4-mmx.S john-1.7.0.1-banquise-to-bigpatch-18/src/md4-mmx.S >--- john-1.7.0.1/src/md4-mmx.S 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/md4-mmx.S 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,194 @@ >+ >+// extern int mdfourmmx(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+ >+#ifdef UNDERSCORES >+#define mdfourmmx _mdfourmmx >+#endif >+ >+.globl mdfourmmx >+ >+.data >+.align(16) >+const_init_a: >+.long 0x67452301 >+.long 0x67452301 >+const_init_b: >+.long 0xefcdab89 >+.long 0xefcdab89 >+const_init_c: >+.long 0x98badcfe >+.long 0x98badcfe >+const_init_d: >+.long 0x10325476 >+.long 0x10325476 >+ >+const_stage2: >+.long 0x5a827999 >+.long 0x5a827999 >+const_stage3: >+.long 0x6ed9eba1 >+.long 0x6ed9eba1 >+ >+.align(16) >+buffer: >+.zero(64*2) >+ >+#define ctxa %mm0 >+#define ctxb %mm1 >+#define ctxc %mm2 >+#define ctxd %mm3 >+#define tmp1 %mm4 >+#define tmp2 %mm5 >+#define tmp3 %mm6 >+#define tmp4 %mm7 >+ >+ >+//#define F_MMX(x, y, z) (z ^ (x & (y ^ z))) >+ >+#define F(x,y,z) \ >+ movq y, tmp1; \ >+ pxor z, tmp1; \ >+ pand x, tmp1; \ >+ pxor z, tmp1 >+ >+//#define G_MMX(x, y, z) ((x & (y | z)) | (y & z)) >+ >+#define G(x,y,z) \ >+ movq y, tmp1; \ >+ movq y, tmp2; \ >+ por z, tmp1; \ >+ pand z, tmp2; \ >+ pand x, tmp1; \ >+ por tmp2, tmp1 >+ >+//#define H_MMX(x, y, z) (x ^ y ^ z) >+#define H(x,y,z) \ >+ movq x, tmp1; \ >+ pxor y, tmp1; \ >+ pxor z, tmp1 >+ >+//#define STEP_MMX(f, a, b, c, d, x, s) \ >+// (a) += f((b), (c), (d)) + (x); \ >+// (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); >+ >+#define STEP1(f, a, b, c, d, x, s) \ >+ f(b, c, d); \ >+ paddd (x*8)(%edx), tmp1; \ >+ paddd tmp1, a; \ >+ movq a, tmp3; \ >+ pslld $s, a; \ >+ psrld $(32-s), tmp3; \ >+ por tmp3, a >+ >+#define STEP2(f, a, b, c, d, x, s) \ >+ f(b, c, d); \ >+ paddd (x*8)(%edx), tmp1; \ >+ paddd tmp4, tmp1; \ >+ paddd tmp1, a; \ >+ movq a, tmp3; \ >+ pslld $s, a; \ >+ psrld $(32-s), tmp3; \ >+ por tmp3, a >+ >+ >+.text >+/* >+ * Try to do some asm md4 w/ mmx >+ * %eax ptr -> out >+ * %edx ptr -> in >+ * %ecx n >+ */ >+ >+mdfourmmx: >+ //MD4 Init >+ pusha >+ >+ shl $3, %ecx >+ mov %ecx, %ebx >+ and $0xffff, %ecx >+ shrl $16, %ebx >+ // %ecx contient la taille du premier mdp >+ // %edx celle du second >+ mov %ecx, (14*8)(%edx) >+ mov %ebx, (14*8+4)(%edx) >+ >+ movq const_init_a, ctxa >+ movq const_init_b, ctxb >+ movq const_init_c, ctxc >+ movq const_init_d, ctxd >+ >+ STEP1(F, ctxa, ctxb, ctxc, ctxd, 0, 3) >+ STEP1(F, ctxd, ctxa, ctxb, ctxc, 1, 7) >+ STEP1(F, ctxc, ctxd, ctxa, ctxb, 2, 11) >+ STEP1(F, ctxb, ctxc, ctxd, ctxa, 3, 19) >+ STEP1(F, ctxa, ctxb, ctxc, ctxd, 4, 3) >+ STEP1(F, ctxd, ctxa, ctxb, ctxc, 5, 7) >+ STEP1(F, ctxc, ctxd, ctxa, ctxb, 6, 11) >+ STEP1(F, ctxb, ctxc, ctxd, ctxa, 7, 19) >+ STEP1(F, ctxa, ctxb, ctxc, ctxd, 8, 3) >+ STEP1(F, ctxd, ctxa, ctxb, ctxc, 9, 7) >+ STEP1(F, ctxc, ctxd, ctxa, ctxb, 10, 11) >+ STEP1(F, ctxb, ctxc, ctxd, ctxa, 11, 19) >+ STEP1(F, ctxa, ctxb, ctxc, ctxd, 12, 3) >+ STEP1(F, ctxd, ctxa, ctxb, ctxc, 13, 7) >+ STEP1(F, ctxc, ctxd, ctxa, ctxb, 14, 11) >+ STEP1(F, ctxb, ctxc, ctxd, ctxa, 15, 19) >+ >+ movq const_stage2, tmp4 >+ >+ STEP2(G, ctxa, ctxb, ctxc, ctxd, 0, 3) >+ STEP2(G, ctxd, ctxa, ctxb, ctxc, 4, 5) >+ STEP2(G, ctxc, ctxd, ctxa, ctxb, 8, 9) >+ STEP2(G, ctxb, ctxc, ctxd, ctxa, 12, 13) >+ STEP2(G, ctxa, ctxb, ctxc, ctxd, 1, 3) >+ STEP2(G, ctxd, ctxa, ctxb, ctxc, 5, 5) >+ STEP2(G, ctxc, ctxd, ctxa, ctxb, 9, 9) >+ STEP2(G, ctxb, ctxc, ctxd, ctxa, 13, 13) >+ STEP2(G, ctxa, ctxb, ctxc, ctxd, 2, 3) >+ STEP2(G, ctxd, ctxa, ctxb, ctxc, 6, 5) >+ STEP2(G, ctxc, ctxd, ctxa, ctxb, 10, 9) >+ STEP2(G, ctxb, ctxc, ctxd, ctxa, 14, 13) >+ STEP2(G, ctxa, ctxb, ctxc, ctxd, 3, 3) >+ STEP2(G, ctxd, ctxa, ctxb, ctxc, 7, 5) >+ STEP2(G, ctxc, ctxd, ctxa, ctxb, 11, 9) >+ STEP2(G, ctxb, ctxc, ctxd, ctxa, 15, 13) >+ >+ movq const_stage3, tmp4 >+ >+ STEP2(H, ctxa, ctxb, ctxc, ctxd, 0, 3) >+ STEP2(H, ctxd, ctxa, ctxb, ctxc, 8, 9) >+ STEP2(H, ctxc, ctxd, ctxa, ctxb, 4, 11) >+ STEP2(H, ctxb, ctxc, ctxd, ctxa, 12, 15) >+ STEP2(H, ctxa, ctxb, ctxc, ctxd, 2, 3) >+ STEP2(H, ctxd, ctxa, ctxb, ctxc, 10, 9) >+ STEP2(H, ctxc, ctxd, ctxa, ctxb, 6, 11) >+ STEP2(H, ctxb, ctxc, ctxd, ctxa, 14, 15) >+ STEP2(H, ctxa, ctxb, ctxc, ctxd, 1, 3) >+ STEP2(H, ctxd, ctxa, ctxb, ctxc, 9, 9) >+ STEP2(H, ctxc, ctxd, ctxa, ctxb, 5, 11) >+ STEP2(H, ctxb, ctxc, ctxd, ctxa, 13, 15) >+ STEP2(H, ctxa, ctxb, ctxc, ctxd, 3, 3) >+ STEP2(H, ctxd, ctxa, ctxb, ctxc, 11, 9) >+ STEP2(H, ctxc, ctxd, ctxa, ctxb, 7, 11) >+ STEP2(H, ctxb, ctxc, ctxd, ctxa, 15, 15) >+ >+ paddd const_init_a, ctxa >+ paddd const_init_b, ctxb >+ paddd const_init_c, ctxc >+ paddd const_init_d, ctxd >+ >+ >+ movq ctxa, 0(%eax) >+ movq ctxb, 8(%eax) >+ movq ctxc, 16(%eax) >+ movq ctxd, 24(%eax) >+ >+ popa >+ movd ctxa, %eax >+ emms >+ >+ ret >+ >+#ifdef __ELF__ >+.section .note.GNU-stack,"",@progbits >+#endif >diff -ruN john-1.7.0.1/src/md4-sse2.S john-1.7.0.1-banquise-to-bigpatch-18/src/md4-sse2.S >--- john-1.7.0.1/src/md4-sse2.S 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/md4-sse2.S 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,223 @@ >+ >+// extern int mdfoursse2(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+ >+#ifdef UNDERSCORES >+#define mdfoursse2 _mdfoursse2 >+#endif >+ >+.globl mdfoursse2 >+ >+.data >+.align(16) >+const_init_a: >+.long 0x67452301 >+.long 0x67452301 >+.long 0x67452301 >+.long 0x67452301 >+const_init_b: >+.long 0xefcdab89 >+.long 0xefcdab89 >+.long 0xefcdab89 >+.long 0xefcdab89 >+const_init_c: >+.long 0x98badcfe >+.long 0x98badcfe >+.long 0x98badcfe >+.long 0x98badcfe >+const_init_d: >+.long 0x10325476 >+.long 0x10325476 >+.long 0x10325476 >+.long 0x10325476 >+ >+const_stage2: >+.long 0x5a827999 >+.long 0x5a827999 >+.long 0x5a827999 >+.long 0x5a827999 >+const_stage3: >+.long 0x6ed9eba1 >+.long 0x6ed9eba1 >+.long 0x6ed9eba1 >+.long 0x6ed9eba1 >+ >+.align(16) >+buffer: >+.zero(64*4) >+ >+#define ctxa %xmm0 >+#define ctxb %xmm1 >+#define ctxc %xmm2 >+#define ctxd %xmm3 >+#define tmp1 %xmm4 >+#define tmp2 %xmm5 >+#define tmp3 %xmm6 >+#define tmp4 %xmm7 >+ >+ >+//#define F_MMX(x, y, z) (z ^ (x & (y ^ z))) >+ >+#define F(x,y,z) \ >+ movapd y, tmp1; \ >+ pxor z, tmp1; \ >+ pand x, tmp1; \ >+ pxor z, tmp1 >+ >+//#define G_MMX(x, y, z) ((x & (y | z)) | (y & z)) >+ >+#define G(x,y,z) \ >+ movapd y, tmp1; \ >+ movapd y, tmp2; \ >+ por z, tmp1; \ >+ pand z, tmp2; \ >+ pand x, tmp1; \ >+ por tmp2, tmp1 >+ >+//#define H_MMX(x, y, z) (x ^ y ^ z) >+#define H(x,y,z) \ >+ movapd x, tmp1; \ >+ pxor y, tmp1; \ >+ pxor z, tmp1 >+ >+//#define STEP_MMX(f, a, b, c, d, x, s) \ >+// (a) += f((b), (c), (d)) + (x); \ >+// (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); >+ >+#define STEP1(f, a, b, c, d, x, s) \ >+ f(b, c, d); \ >+ paddd (x*16)(%edx), tmp1; \ >+ paddd tmp1, a; \ >+ movapd a, tmp3; \ >+ pslld $s, a; \ >+ psrld $(32-s), tmp3; \ >+ por tmp3, a >+ >+#define STEP2(f, a, b, c, d, x, s) \ >+ f(b, c, d); \ >+ paddd (x*16)(%edx), tmp1; \ >+ paddd tmp4, tmp1; \ >+ paddd tmp1, a; \ >+ movapd a, tmp3; \ >+ pslld $s, a; \ >+ psrld $(32-s), tmp3; \ >+ por tmp3, a >+ >+ >+.text >+/* >+ * Try to do some asm md4 w/ sse2 >+ * %eax ptr -> out >+ * %edx ptr -> in >+ * %ecx n >+ */ >+ >+mdfoursse2: >+ //MD4 Init >+ pusha >+ >+ //mov %edx, %eax >+ //ret >+ >+// shl $3, %ecx >+ mov %ecx, %ebx >+ shr $8, %ecx >+ and $0xff, %ebx >+ shl $3, %ebx >+ mov %ebx, (14*16)(%edx) >+ >+ mov %ecx, %ebx >+ shr $8, %ecx >+ and $0xff, %ebx >+ shl $3, %ebx >+ mov %ebx, (14*16+4)(%edx) >+ >+ mov %ecx, %ebx >+ shr $8, %ecx >+ and $0xff, %ebx >+ shl $3, %ebx >+ mov %ebx, (14*16+8)(%edx) >+ >+ and $0xff, %ecx >+ shl $3, %ecx >+ mov %ecx, (14*16+12)(%edx) >+ >+ movapd const_init_a, ctxa >+ movapd const_init_b, ctxb >+ movapd const_init_c, ctxc >+ movapd const_init_d, ctxd >+ >+ STEP1(F, ctxa, ctxb, ctxc, ctxd, 0, 3) >+ STEP1(F, ctxd, ctxa, ctxb, ctxc, 1, 7) >+ STEP1(F, ctxc, ctxd, ctxa, ctxb, 2, 11) >+ STEP1(F, ctxb, ctxc, ctxd, ctxa, 3, 19) >+ STEP1(F, ctxa, ctxb, ctxc, ctxd, 4, 3) >+ STEP1(F, ctxd, ctxa, ctxb, ctxc, 5, 7) >+ STEP1(F, ctxc, ctxd, ctxa, ctxb, 6, 11) >+ STEP1(F, ctxb, ctxc, ctxd, ctxa, 7, 19) >+ STEP1(F, ctxa, ctxb, ctxc, ctxd, 8, 3) >+ STEP1(F, ctxd, ctxa, ctxb, ctxc, 9, 7) >+ STEP1(F, ctxc, ctxd, ctxa, ctxb, 10, 11) >+ STEP1(F, ctxb, ctxc, ctxd, ctxa, 11, 19) >+ STEP1(F, ctxa, ctxb, ctxc, ctxd, 12, 3) >+ STEP1(F, ctxd, ctxa, ctxb, ctxc, 13, 7) >+ STEP1(F, ctxc, ctxd, ctxa, ctxb, 14, 11) >+ STEP1(F, ctxb, ctxc, ctxd, ctxa, 15, 19) >+ >+ movapd const_stage2, tmp4 >+ >+ STEP2(G, ctxa, ctxb, ctxc, ctxd, 0, 3) >+ STEP2(G, ctxd, ctxa, ctxb, ctxc, 4, 5) >+ STEP2(G, ctxc, ctxd, ctxa, ctxb, 8, 9) >+ STEP2(G, ctxb, ctxc, ctxd, ctxa, 12, 13) >+ STEP2(G, ctxa, ctxb, ctxc, ctxd, 1, 3) >+ STEP2(G, ctxd, ctxa, ctxb, ctxc, 5, 5) >+ STEP2(G, ctxc, ctxd, ctxa, ctxb, 9, 9) >+ STEP2(G, ctxb, ctxc, ctxd, ctxa, 13, 13) >+ STEP2(G, ctxa, ctxb, ctxc, ctxd, 2, 3) >+ STEP2(G, ctxd, ctxa, ctxb, ctxc, 6, 5) >+ STEP2(G, ctxc, ctxd, ctxa, ctxb, 10, 9) >+ STEP2(G, ctxb, ctxc, ctxd, ctxa, 14, 13) >+ STEP2(G, ctxa, ctxb, ctxc, ctxd, 3, 3) >+ STEP2(G, ctxd, ctxa, ctxb, ctxc, 7, 5) >+ STEP2(G, ctxc, ctxd, ctxa, ctxb, 11, 9) >+ STEP2(G, ctxb, ctxc, ctxd, ctxa, 15, 13) >+ >+ movapd const_stage3, tmp4 >+ >+ STEP2(H, ctxa, ctxb, ctxc, ctxd, 0, 3) >+ STEP2(H, ctxd, ctxa, ctxb, ctxc, 8, 9) >+ STEP2(H, ctxc, ctxd, ctxa, ctxb, 4, 11) >+ STEP2(H, ctxb, ctxc, ctxd, ctxa, 12, 15) >+ STEP2(H, ctxa, ctxb, ctxc, ctxd, 2, 3) >+ STEP2(H, ctxd, ctxa, ctxb, ctxc, 10, 9) >+ STEP2(H, ctxc, ctxd, ctxa, ctxb, 6, 11) >+ STEP2(H, ctxb, ctxc, ctxd, ctxa, 14, 15) >+ STEP2(H, ctxa, ctxb, ctxc, ctxd, 1, 3) >+ STEP2(H, ctxd, ctxa, ctxb, ctxc, 9, 9) >+ STEP2(H, ctxc, ctxd, ctxa, ctxb, 5, 11) >+ STEP2(H, ctxb, ctxc, ctxd, ctxa, 13, 15) >+ STEP2(H, ctxa, ctxb, ctxc, ctxd, 3, 3) >+ STEP2(H, ctxd, ctxa, ctxb, ctxc, 11, 9) >+ STEP2(H, ctxc, ctxd, ctxa, ctxb, 7, 11) >+ STEP2(H, ctxb, ctxc, ctxd, ctxa, 15, 15) >+ >+ paddd const_init_a, ctxa >+ paddd const_init_b, ctxb >+ paddd const_init_c, ctxc >+ paddd const_init_d, ctxd >+ >+ >+ movapd ctxa, 0(%eax) >+ movapd ctxb, 16(%eax) >+ movapd ctxc, 32(%eax) >+ movapd ctxd, 48(%eax) >+ >+ popa >+ movd ctxa, %eax >+ emms >+ >+ ret >+ >+#ifdef __ELF__ >+.section .note.GNU-stack,"",@progbits >+#endif >diff -ruN john-1.7.0.1/src/md4.c john-1.7.0.1-banquise-to-bigpatch-18/src/md4.c >--- john-1.7.0.1/src/md4.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/md4.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,276 @@ >+/* >+ * This is an OpenSSL-compatible implementation of the RSA Data Security, >+ * Inc. MD4 Message-Digest Algorithm (RFC 1320). >+ * >+ * Written by Solar Designer <solar at openwall.com> in 2005, and placed >+ * in the public domain. There's absolutely no warranty. >+ * >+ * This differs from Colin Plumb's older public domain implementation in >+ * that no 32-bit integer data type is required, there's no compile-time >+ * endianness configuration, and the function prototypes match OpenSSL's. >+ * The primary goals are portability and ease of use. >+ * >+ * This implementation is meant to be fast, but not as fast as possible. >+ * Some known optimizations are not included to reduce source code size >+ * and avoid compile-time configuration. >+ */ >+ >+#ifndef HAVE_OPENSSL >+ >+#include <string.h> >+#include "md4.h" >+ >+/* >+ * The basic MD4 functions. >+ * >+ * F and G are optimized compared to their RFC 1320 definitions, with the >+ * optimization for F borrowed from Colin Plumb's MD5 implementation. >+ */ >+#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) >+#define G(x, y, z) (((x) & ((y) | (z))) | ((y) & (z))) >+#define H(x, y, z) ((x) ^ (y) ^ (z)) >+ >+/* >+ * The MD4 transformation for all three rounds. >+ */ >+#define STEP(f, a, b, c, d, x, s) \ >+ (a) += f((b), (c), (d)) + (x); \ >+ (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); >+ >+/* >+ * SET reads 4 input bytes in little-endian byte order and stores them >+ * in a properly aligned word in host byte order. >+ * >+ * The check for little-endian architectures which tolerate unaligned >+ * memory accesses is just an optimization. Nothing will break if it >+ * doesn't work. >+ */ >+#if defined(__i386__) || defined(__vax__) >+#define SET(n) \ >+ (*(MD4_u32plus *)&ptr[(n) * 4]) >+#define GET(n) \ >+ SET(n) >+#else >+#define SET(n) \ >+ (ctx->block[(n)] = \ >+ (MD4_u32plus)ptr[(n) * 4] | \ >+ ((MD4_u32plus)ptr[(n) * 4 + 1] << 8) | \ >+ ((MD4_u32plus)ptr[(n) * 4 + 2] << 16) | \ >+ ((MD4_u32plus)ptr[(n) * 4 + 3] << 24)) >+#define GET(n) \ >+ (ctx->block[(n)]) >+#endif >+ >+/* >+ * This processes one or more 64-byte data blocks, but does NOT update >+ * the bit counters. There're no alignment requirements. >+ */ >+static void *body(MD4_CTX *ctx, void *data, unsigned long size) >+{ >+ unsigned char *ptr; >+ MD4_u32plus a, b, c, d; >+ MD4_u32plus saved_a, saved_b, saved_c, saved_d; >+ >+ ptr = data; >+ >+ a = ctx->a; >+ b = ctx->b; >+ c = ctx->c; >+ d = ctx->d; >+ >+ do { >+ saved_a = a; >+ saved_b = b; >+ saved_c = c; >+ saved_d = d; >+ >+/* Round 1 */ >+ STEP(F, a, b, c, d, SET(0), 3) >+ STEP(F, d, a, b, c, SET(1), 7) >+ STEP(F, c, d, a, b, SET(2), 11) >+ STEP(F, b, c, d, a, SET(3), 19) >+ STEP(F, a, b, c, d, SET(4), 3) >+ STEP(F, d, a, b, c, SET(5), 7) >+ STEP(F, c, d, a, b, SET(6), 11) >+ STEP(F, b, c, d, a, SET(7), 19) >+ STEP(F, a, b, c, d, SET(8), 3) >+ STEP(F, d, a, b, c, SET(9), 7) >+ STEP(F, c, d, a, b, SET(10), 11) >+ STEP(F, b, c, d, a, SET(11), 19) >+ STEP(F, a, b, c, d, SET(12), 3) >+ STEP(F, d, a, b, c, SET(13), 7) >+ STEP(F, c, d, a, b, SET(14), 11) >+ STEP(F, b, c, d, a, SET(15), 19) >+ >+/* Round 2 */ >+ STEP(G, a, b, c, d, GET(0) + 0x5a827999, 3) >+ STEP(G, d, a, b, c, GET(4) + 0x5a827999, 5) >+ STEP(G, c, d, a, b, GET(8) + 0x5a827999, 9) >+ STEP(G, b, c, d, a, GET(12) + 0x5a827999, 13) >+ STEP(G, a, b, c, d, GET(1) + 0x5a827999, 3) >+ STEP(G, d, a, b, c, GET(5) + 0x5a827999, 5) >+ STEP(G, c, d, a, b, GET(9) + 0x5a827999, 9) >+ STEP(G, b, c, d, a, GET(13) + 0x5a827999, 13) >+ STEP(G, a, b, c, d, GET(2) + 0x5a827999, 3) >+ STEP(G, d, a, b, c, GET(6) + 0x5a827999, 5) >+ STEP(G, c, d, a, b, GET(10) + 0x5a827999, 9) >+ STEP(G, b, c, d, a, GET(14) + 0x5a827999, 13) >+ STEP(G, a, b, c, d, GET(3) + 0x5a827999, 3) >+ STEP(G, d, a, b, c, GET(7) + 0x5a827999, 5) >+ STEP(G, c, d, a, b, GET(11) + 0x5a827999, 9) >+ STEP(G, b, c, d, a, GET(15) + 0x5a827999, 13) >+ >+/* Round 3 */ >+ STEP(H, a, b, c, d, GET(0) + 0x6ed9eba1, 3) >+ STEP(H, d, a, b, c, GET(8) + 0x6ed9eba1, 9) >+ STEP(H, c, d, a, b, GET(4) + 0x6ed9eba1, 11) >+ STEP(H, b, c, d, a, GET(12) + 0x6ed9eba1, 15) >+ STEP(H, a, b, c, d, GET(2) + 0x6ed9eba1, 3) >+ STEP(H, d, a, b, c, GET(10) + 0x6ed9eba1, 9) >+ STEP(H, c, d, a, b, GET(6) + 0x6ed9eba1, 11) >+ STEP(H, b, c, d, a, GET(14) + 0x6ed9eba1, 15) >+ STEP(H, a, b, c, d, GET(1) + 0x6ed9eba1, 3) >+ STEP(H, d, a, b, c, GET(9) + 0x6ed9eba1, 9) >+ STEP(H, c, d, a, b, GET(5) + 0x6ed9eba1, 11) >+ STEP(H, b, c, d, a, GET(13) + 0x6ed9eba1, 15) >+ STEP(H, a, b, c, d, GET(3) + 0x6ed9eba1, 3) >+ STEP(H, d, a, b, c, GET(11) + 0x6ed9eba1, 9) >+ STEP(H, c, d, a, b, GET(7) + 0x6ed9eba1, 11) >+ STEP(H, b, c, d, a, GET(15) + 0x6ed9eba1, 15) >+ >+ a += saved_a; >+ b += saved_b; >+ c += saved_c; >+ d += saved_d; >+ >+ ptr += 64; >+ } while (size -= 64); >+ >+ ctx->a = a; >+ ctx->b = b; >+ ctx->c = c; >+ ctx->d = d; >+ >+ return ptr; >+} >+ >+void MD4_Init(MD4_CTX *ctx) >+{ >+ ctx->a = 0x67452301; >+ ctx->b = 0xefcdab89; >+ ctx->c = 0x98badcfe; >+ ctx->d = 0x10325476; >+ >+ ctx->lo = 0; >+ ctx->hi = 0; >+} >+ >+void MD4_Update(MD4_CTX *ctx, void *data, unsigned long size) >+{ >+ MD4_u32plus saved_lo; >+ unsigned long used, free; >+ >+ saved_lo = ctx->lo; >+ if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) >+ ctx->hi++; >+ ctx->hi += size >> 29; >+ >+ used = saved_lo & 0x3f; >+ >+ if (used) { >+ free = 64 - used; >+ >+ if (size < free) { >+ memcpy(&ctx->buffer[used], data, size); >+ return; >+ } >+ >+ memcpy(&ctx->buffer[used], data, free); >+ >+ data = (unsigned char *)data + free; >+ size -= free; >+ body(ctx, ctx->buffer, 64); >+ } >+ >+ if (size >= 64) { >+ data = body(ctx, data, size & ~(unsigned long)0x3f); >+ size &= 0x3f; >+ } >+ >+ memcpy(ctx->buffer, data, size); >+} >+ >+void MD4_Final(unsigned char *result, MD4_CTX *ctx) >+{ >+ unsigned long used, free; >+ >+ used = ctx->lo & 0x3f; >+ >+ ctx->buffer[used++] = 0x80; >+ >+ free = 64 - used; >+ >+ if (free < 8) { >+ memset(&ctx->buffer[used], 0, free); >+ body(ctx, ctx->buffer, 64); >+ used = 0; >+ free = 64; >+ } >+ >+ memset(&ctx->buffer[used], 0, free - 8); >+ >+ >+ ctx->lo <<= 3; >+#ifndef ARCH_LITTLE_ENDIAN >+ ctx->buffer[56] = ctx->lo; >+ ctx->buffer[57] = ctx->lo >> 8; >+ ctx->buffer[58] = ctx->lo >> 16; >+ ctx->buffer[59] = ctx->lo >> 24; >+ ctx->buffer[60] = ctx->hi; >+ ctx->buffer[61] = ctx->hi >> 8; >+ ctx->buffer[62] = ctx->hi >> 16; >+ ctx->buffer[63] = ctx->hi >> 24; >+#else >+ ((unsigned long *)ctx->buffer)[14] = ctx->lo; >+ ((unsigned long *)ctx->buffer)[15] = ctx->hi; >+#endif >+ >+ body(ctx, ctx->buffer, 64); >+ >+#ifndef ARCH_LITTLE_ENDIAN >+ result[0] = ctx->a; >+ result[1] = ctx->a >> 8; >+ result[2] = ctx->a >> 16; >+ result[3] = ctx->a >> 24; >+ result[4] = ctx->b; >+ result[5] = ctx->b >> 8; >+ result[6] = ctx->b >> 16; >+ result[7] = ctx->b >> 24; >+ result[8] = ctx->c; >+ result[9] = ctx->c >> 8; >+ result[10] = ctx->c >> 16; >+ result[11] = ctx->c >> 24; >+ result[12] = ctx->d; >+ result[13] = ctx->d >> 8; >+ result[14] = ctx->d >> 16; >+ result[15] = ctx->d >> 24; >+#else >+ ((unsigned long *)result)[0] = ctx->a; >+ ((unsigned long *)result)[1] = ctx->b; >+ ((unsigned long *)result)[2] = ctx->c; >+ ((unsigned long *)result)[3] = ctx->d; >+#endif >+ >+ memset(ctx, 0, sizeof(*ctx)); >+} >+ >+//this function has been added by bartavelle at bandecon.com >+void mdfour(unsigned char *out, unsigned char *in, int n) >+{ >+ MD4_CTX ctx; >+ MD4_Init(&ctx); >+ MD4_Update(&ctx, in, n); >+ MD4_Final(out, &ctx); >+} >+ >+#endif >diff -ruN john-1.7.0.1/src/md4.h john-1.7.0.1-banquise-to-bigpatch-18/src/md4.h >--- john-1.7.0.1/src/md4.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/md4.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,39 @@ >+/* >+ * This is an OpenSSL-compatible implementation of the RSA Data Security, >+ * Inc. MD4 Message-Digest Algorithm (RFC 1320). >+ * >+ * Written by Solar Designer <solar at openwall.com> in 2005, and placed >+ * in the public domain. See md4.c for more information. >+ */ >+ >+#ifdef HAVE_OPENSSL >+#include <openssl/md4.h> >+#elif !defined(_MD4_H) >+#define _MD4_H >+ >+/* Any 32-bit or wider unsigned integer data type will do */ >+typedef unsigned long MD4_u32plus; >+ >+typedef struct { >+ MD4_u32plus lo, hi; >+ MD4_u32plus a, b, c, d; >+ unsigned char buffer[64]; >+ MD4_u32plus block[16]; >+} MD4_CTX; >+ >+extern void MD4_Init(MD4_CTX *ctx); >+extern void MD4_Update(MD4_CTX *ctx, void *data, unsigned long size); >+extern void MD4_Final(unsigned char *result, MD4_CTX *ctx); >+ >+//added by bartavelle >+extern void mdfour(unsigned char *out, unsigned char *in, int n); >+ >+#if (MMX_COEF == 2) >+extern int mdfourmmx(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+#endif >+ >+#if (MMX_COEF == 4) >+extern int mdfoursse2(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+#endif >+ >+#endif >diff -ruN john-1.7.0.1/src/md5-mmx.S john-1.7.0.1-banquise-to-bigpatch-18/src/md5-mmx.S >--- john-1.7.0.1/src/md5-mmx.S 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/md5-mmx.S 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,307 @@ >+#include "arch.h" >+ >+// extern int mdfourmmx(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+ >+#ifdef UNDERSCORES >+#define mdfivemmx _mdfivemmx >+#endif >+.globl mdfivemmx >+.globl mdfivemmx_noinit_sizeupdate >+.globl mdfivemmx_noinit_uniformsizeupdate >+.globl mdfivemmx_nosizeupdate >+ >+.data >+.align(16) >+#if (MMX_COEF == 2) >+const_init_a: ; .long 0x67452301 ; .long 0x67452301 >+const_init_b: ; .long 0xefcdab89 ; .long 0xefcdab89 >+const_init_c: ; .long 0x98badcfe ; .long 0x98badcfe >+const_init_d: ; .long 0x10325476 ; .long 0x10325476 >+storea: ; .long 0 ; .long 0 >+storeb: ; .long 0 ; .long 0 >+storec: ; .long 0 ; .long 0 >+stored: ; .long 0 ; .long 0 >+#define REGMM0 %mm0 >+#define REGMM1 %mm1 >+#define REGMM2 %mm2 >+#define REGMM3 %mm3 >+#define REGMM4 %mm4 >+#define REGMM5 %mm5 >+#define REGMM6 %mm6 >+#define REGMM7 %mm7 >+#define MMXMOVE movq >+#include "stages_mmx_md5.S" >+#else >+const_init_a: ; .long 0x67452301 ; .long 0x67452301 ; .long 0x67452301 ; .long 0x67452301 >+const_init_b: ; .long 0xefcdab89 ; .long 0xefcdab89 ; .long 0xefcdab89 ; .long 0xefcdab89 >+const_init_c: ; .long 0x98badcfe ; .long 0x98badcfe ; .long 0x98badcfe ; .long 0x98badcfe >+const_init_d: ; .long 0x10325476 ; .long 0x10325476 ; .long 0x10325476 ; .long 0x10325476 >+storea: ; .long 0 ; .long 0 ; .long 0 ; .long 0 >+storeb: ; .long 0 ; .long 0 ; .long 0 ; .long 0 >+storec: ; .long 0 ; .long 0 ; .long 0 ; .long 0 >+stored: ; .long 0 ; .long 0 ; .long 0 ; .long 0 >+#define REGMM0 %xmm0 >+#define REGMM1 %xmm1 >+#define REGMM2 %xmm2 >+#define REGMM3 %xmm3 >+#define REGMM4 %xmm4 >+#define REGMM5 %xmm5 >+#define REGMM6 %xmm6 >+#define REGMM7 %xmm7 >+#define MMXMOVE movapd >+#include "stages_sse2_md5.S" >+#endif >+ >+ >+#define ctxa REGMM0 >+#define ctxb REGMM1 >+#define ctxc REGMM2 >+#define ctxd REGMM3 >+#define tmp1 REGMM4 >+#define tmp2 REGMM5 >+#define tmp3 REGMM6 >+#define tmp4 REGMM7 >+ >+ >+//#define F_MMX(x, y, z) (z ^ (x & (y ^ z))) >+ >+#define F(x,y,z) \ >+ MMXMOVE y, tmp1; \ >+ pxor z, tmp1; \ >+ pand x, tmp1; \ >+ pxor z, tmp1 >+ >+//#define G_MMX(x, y, z) (y ^ (z & (x ^ y))) >+ >+#define G(x,y,z) \ >+ MMXMOVE y, tmp1; \ >+ pxor x, tmp1; \ >+ pand z, tmp1; \ >+ pxor y, tmp1 >+ >+//#define H_MMX(x, y, z) (x ^ y ^ z) >+#define H(x,y,z) \ >+ MMXMOVE x, tmp1; \ >+ pxor y, tmp1; \ >+ pxor z, tmp1 >+ >+//#define I(x, y, z) (y ^ (x | ~z)) >+#define I(x, y, z) \ >+ MMXMOVE z, tmp1; \ >+ pandn tmp4, tmp1; \ >+ por x, tmp1; \ >+ pxor y, tmp1; >+ >+ >+//#define STEP_MMX(f, a, b, c, d, x, s) \ >+// (a) += f((b), (c), (d)) + (x); \ >+// (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); >+ >+//#define STEP(f, a, b, c, d, x, t, s) \ >+// (a) += f((b), (c), (d)) + (x) + (t); \ >+// (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ >+// (a) += (b); >+ >+ >+#define STEP(f, a, b, c, d, x, t, s) \ >+ f(b, c, d); \ >+ paddd (x*4*MMX_COEF)(%edx), tmp1; \ >+ paddd t, a; \ >+ paddd tmp1, a; \ >+ MMXMOVE a, tmp3; \ >+ psrld $(32-s), tmp3; \ >+ pslld $s, a; \ >+ por tmp3, a; \ >+ paddd b, a >+ >+#define STEPD(f, a, b, c, d, x, t, s) \ >+ f(b, c, d); \ >+ paddd (x*4*MMX_COEF)(%edx), tmp1; \ >+ paddd t, a; \ >+ paddd tmp1, a; \ >+ MMXMOVE a, tmp3; \ >+ psrld $(32-s), tmp3; \ >+ pslld $s, a; \ >+ por tmp3, a; \ >+ paddd b, a >+ >+ >+.text >+/* >+ * Try to do some asm md4 w/ mmx >+ * %eax ptr -> out >+ * %edx ptr -> in >+ * %ecx n >+ */ >+ >+init: >+ MMXMOVE const_init_a, ctxa >+ MMXMOVE const_init_b, ctxb >+ MMXMOVE const_init_c, ctxc >+ MMXMOVE const_init_d, ctxd >+ ret; >+ >+sizeupdate: >+#if (MMX_COEF == 2) >+ shl $3, %ecx >+ mov %ecx, %ebx >+ and $0xffff, %ecx >+ shrl $16, %ebx >+ mov %ecx, (14*4*MMX_COEF)(%edx) >+ mov %ebx, (14*4*MMX_COEF+4)(%edx) >+#else >+ mov %ecx, %ebx >+ shr $8, %ecx >+ and $0xff, %ebx >+ shl $3, %ebx >+ mov %ebx, (14*16)(%edx) >+ >+ mov %ecx, %ebx >+ shr $8, %ecx >+ and $0xff, %ebx >+ shl $3, %ebx >+ mov %ebx, (14*16+4)(%edx) >+ >+ mov %ecx, %ebx >+ shr $8, %ecx >+ and $0xff, %ebx >+ shl $3, %ebx >+ mov %ebx, (14*16+8)(%edx) >+ >+ and $0xff, %ecx >+ shl $3, %ecx >+ mov %ecx, (14*16+12)(%edx) >+#endif >+ ret >+ >+uniformsizeupdate: >+ shl $3, %ecx >+ mov %ecx, (14*4*MMX_COEF)(%edx) >+ mov %ecx, (14*4*MMX_COEF+4)(%edx) >+#if (MMX_COEF == 4) >+ mov %ecx, (14*4*MMX_COEF+8)(%edx) >+ mov %ecx, (14*4*MMX_COEF+12)(%edx) >+#endif >+ ret >+ >+//entry points >+mdfivemmx_noinit_sizeupdate: >+ pusha >+ call sizeupdate >+ jmp mdfivemmx_noinit >+ >+mdfivemmx_noinit_uniformsizeupdate: >+ pusha >+ call uniformsizeupdate >+ jmp mdfivemmx_noinit >+ >+mdfivemmx: >+ pusha >+ call sizeupdate >+ call init >+ jmp mdfivemmx_noinit >+ >+mdfivemmx_nosizeupdate: >+ pusha >+ call init >+ jmp mdfivemmx_noinit >+//end entry points >+ >+mdfivemmx_noinit: >+ pcmpeqd tmp4, tmp4; >+ MMXMOVE ctxa, storea >+ MMXMOVE ctxb, storeb >+ MMXMOVE ctxc, storec >+ MMXMOVE ctxd, stored >+ >+ STEP(F, ctxa, ctxb, ctxc, ctxd, 0, const_stage_1, 7) >+ STEP(F, ctxd, ctxa, ctxb, ctxc, 1, const_stage_2, 12) >+ STEP(F, ctxc, ctxd, ctxa, ctxb, 2, const_stage_3, 17) >+ STEP(F, ctxb, ctxc, ctxd, ctxa, 3, const_stage_4, 22) >+ STEP(F, ctxa, ctxb, ctxc, ctxd, 4, const_stage_5, 7) >+ STEP(F, ctxd, ctxa, ctxb, ctxc, 5, const_stage_6, 12) >+ STEP(F, ctxc, ctxd, ctxa, ctxb, 6, const_stage_7, 17) >+ STEP(F, ctxb, ctxc, ctxd, ctxa, 7, const_stage_8, 22) >+ STEP(F, ctxa, ctxb, ctxc, ctxd, 8, const_stage_9, 7) >+ STEP(F, ctxd, ctxa, ctxb, ctxc, 9, const_stage_10, 12) >+ STEP(F, ctxc, ctxd, ctxa, ctxb, 10, const_stage_11, 17) >+ STEP(F, ctxb, ctxc, ctxd, ctxa, 11, const_stage_12, 22) >+ STEP(F, ctxa, ctxb, ctxc, ctxd, 12, const_stage_13, 7) >+ STEP(F, ctxd, ctxa, ctxb, ctxc, 13, const_stage_14, 12) >+ STEP(F, ctxc, ctxd, ctxa, ctxb, 14, const_stage_15, 17) >+ STEP(F, ctxb, ctxc, ctxd, ctxa, 15, const_stage_16, 22) >+ >+ STEP(G, ctxa, ctxb, ctxc, ctxd, 1, const_stage_17, 5) >+ STEP(G, ctxd, ctxa, ctxb, ctxc, 6, const_stage_18, 9) >+ STEP(G, ctxc, ctxd, ctxa, ctxb, 11, const_stage_19, 14) >+ STEP(G, ctxb, ctxc, ctxd, ctxa, 0, const_stage_20, 20) >+ STEP(G, ctxa, ctxb, ctxc, ctxd, 5, const_stage_21, 5) >+ STEP(G, ctxd, ctxa, ctxb, ctxc, 10, const_stage_22, 9) >+ STEP(G, ctxc, ctxd, ctxa, ctxb, 15, const_stage_23, 14) >+ STEP(G, ctxb, ctxc, ctxd, ctxa, 4, const_stage_24, 20) >+ STEP(G, ctxa, ctxb, ctxc, ctxd, 9, const_stage_25, 5) >+ STEP(G, ctxd, ctxa, ctxb, ctxc, 14, const_stage_26, 9) >+ STEP(G, ctxc, ctxd, ctxa, ctxb, 3, const_stage_27, 14) >+ STEP(G, ctxb, ctxc, ctxd, ctxa, 8, const_stage_28, 20) >+ STEP(G, ctxa, ctxb, ctxc, ctxd, 13, const_stage_29, 5) >+ STEP(G, ctxd, ctxa, ctxb, ctxc, 2, const_stage_30, 9) >+ STEP(G, ctxc, ctxd, ctxa, ctxb, 7, const_stage_31, 14) >+ STEP(G, ctxb, ctxc, ctxd, ctxa, 12, const_stage_32, 20) >+ >+ STEP(H, ctxa, ctxb, ctxc, ctxd, 5, const_stage_33, 4) >+ STEP(H, ctxd, ctxa, ctxb, ctxc, 8, const_stage_34, 11) >+ STEP(H, ctxc, ctxd, ctxa, ctxb, 11, const_stage_35, 16) >+ STEP(H, ctxb, ctxc, ctxd, ctxa, 14, const_stage_36, 23) >+ STEP(H, ctxa, ctxb, ctxc, ctxd, 1, const_stage_37, 4) >+ STEP(H, ctxd, ctxa, ctxb, ctxc, 4, const_stage_38, 11) >+ STEP(H, ctxc, ctxd, ctxa, ctxb, 7, const_stage_39, 16) >+ STEP(H, ctxb, ctxc, ctxd, ctxa, 10, const_stage_40, 23) >+ STEP(H, ctxa, ctxb, ctxc, ctxd, 13, const_stage_41, 4) >+ STEP(H, ctxd, ctxa, ctxb, ctxc, 0, const_stage_42, 11) >+ STEP(H, ctxc, ctxd, ctxa, ctxb, 3, const_stage_43, 16) >+ STEP(H, ctxb, ctxc, ctxd, ctxa, 6, const_stage_44, 23) >+ STEP(H, ctxa, ctxb, ctxc, ctxd, 9, const_stage_45, 4) >+ STEP(H, ctxd, ctxa, ctxb, ctxc, 12, const_stage_46, 11) >+ STEP(H, ctxc, ctxd, ctxa, ctxb, 15, const_stage_47, 16) >+ STEP(H, ctxb, ctxc, ctxd, ctxa, 2, const_stage_48, 23) >+ >+ STEP(I, ctxa, ctxb, ctxc, ctxd, 0, const_stage_49, 6) >+ STEP(I, ctxd, ctxa, ctxb, ctxc, 7, const_stage_50, 10) >+ STEP(I, ctxc, ctxd, ctxa, ctxb, 14, const_stage_51, 15) >+ STEP(I, ctxb, ctxc, ctxd, ctxa, 5, const_stage_52, 21) >+ STEP(I, ctxa, ctxb, ctxc, ctxd, 12, const_stage_53, 6) >+ STEP(I, ctxd, ctxa, ctxb, ctxc, 3, const_stage_54, 10) >+ STEP(I, ctxc, ctxd, ctxa, ctxb, 10, const_stage_55, 15) >+ STEP(I, ctxb, ctxc, ctxd, ctxa, 1, const_stage_56, 21) >+ STEP(I, ctxa, ctxb, ctxc, ctxd, 8, const_stage_57, 6) >+ STEP(I, ctxd, ctxa, ctxb, ctxc, 15, const_stage_58, 10) >+ STEP(I, ctxc, ctxd, ctxa, ctxb, 6, const_stage_59, 15) >+ STEP(I, ctxb, ctxc, ctxd, ctxa, 13, const_stage_60, 21) >+ STEP(I, ctxa, ctxb, ctxc, ctxd, 4, const_stage_61, 6) >+ STEP(I, ctxd, ctxa, ctxb, ctxc, 11, const_stage_62, 10) >+ STEP(I, ctxc, ctxd, ctxa, ctxb, 2, const_stage_63, 15) >+ STEP(I, ctxb, ctxc, ctxd, ctxa, 9, const_stage_64, 21) >+ >+ paddd storea, ctxa >+ paddd storeb, ctxb >+ paddd storec, ctxc >+ paddd stored, ctxd >+ >+ MMXMOVE ctxa, 0(%eax) >+ MMXMOVE ctxa, storea >+ MMXMOVE ctxb, (4*MMX_COEF)(%eax) >+ MMXMOVE ctxb, storeb >+ MMXMOVE ctxc, (8*MMX_COEF)(%eax) >+ MMXMOVE ctxc, storec >+ MMXMOVE ctxd, (12*MMX_COEF)(%eax) >+ MMXMOVE ctxd, stored >+ >+ popa >+ >+ emms >+ >+ ret >+ >+#ifdef __ELF__ >+.section .note.GNU-stack,"",@progbits >+#endif >diff -ruN john-1.7.0.1/src/md5.c john-1.7.0.1-banquise-to-bigpatch-18/src/md5.c >--- john-1.7.0.1/src/md5.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/md5.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,274 @@ >+/* >+ * This is an OpenSSL-compatible implementation of the RSA Data Security, >+ * Inc. MD5 Message-Digest Algorithm. >+ * >+ * Written by Solar Designer <solar@openwall.com> in 2001, and placed in >+ * the public domain. There's absolutely no warranty. >+ * >+ * This differs from Colin Plumb's older public domain implementation in >+ * that no 32-bit integer data type is required, there's no compile-time >+ * endianness configuration, and the function prototypes match OpenSSL's. >+ * The primary goals are portability and ease of use. >+ * >+ * This implementation is meant to be fast, but not as fast as possible. >+ * Some known optimizations are not included to reduce source code size >+ * and avoid compile-time configuration. >+ */ >+ >+#ifndef HAVE_OPENSSL >+ >+#include <string.h> >+ >+#include "md5.h" >+ >+/* >+ * The basic MD5 functions. >+ * >+ * F is optimized compared to its RFC 1321 definition just like in Colin >+ * Plumb's implementation. >+ */ >+#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) >+#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) >+#define H(x, y, z) ((x) ^ (y) ^ (z)) >+#define I(x, y, z) ((y) ^ ((x) | ~(z))) >+ >+/* >+ * The MD5 transformation for all four rounds. >+ */ >+#define STEP(f, a, b, c, d, x, t, s) \ >+ (a) += f((b), (c), (d)) + (x) + (t); \ >+ (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ >+ (a) += (b); >+ >+/* >+ * SET reads 4 input bytes in little-endian byte order and stores them >+ * in a properly aligned word in host byte order. >+ * >+ * The check for little-endian architectures which tolerate unaligned >+ * memory accesses is just an optimization. Nothing will break if it >+ * doesn't work. >+ */ >+#if defined(__i386__) || defined(__vax__) >+#define SET(n) \ >+ (*(MD5_u32plus *)&ptr[(n) * 4]) >+#define GET(n) \ >+ SET(n) >+#else >+#define SET(n) \ >+ (ctx->block[(n)] = \ >+ (MD5_u32plus)ptr[(n) * 4] | \ >+ ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ >+ ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ >+ ((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) >+#define GET(n) \ >+ (ctx->block[(n)]) >+#endif >+ >+/* >+ * This processes one or more 64-byte data blocks, but does NOT update >+ * the bit counters. There're no alignment requirements. >+ */ >+static void *body(MD5_CTX *ctx, void *data, unsigned long size) >+{ >+ unsigned char *ptr; >+ MD5_u32plus a, b, c, d; >+ MD5_u32plus saved_a, saved_b, saved_c, saved_d; >+ >+ ptr = data; >+ >+ a = ctx->a; >+ b = ctx->b; >+ c = ctx->c; >+ d = ctx->d; >+ >+ do { >+ saved_a = a; >+ saved_b = b; >+ saved_c = c; >+ saved_d = d; >+ >+/* Round 1 */ >+ STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) >+ STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) >+ STEP(F, c, d, a, b, SET(2), 0x242070db, 17) >+ STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) >+ STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) >+ STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) >+ STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) >+ STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) >+ STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) >+ STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) >+ STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) >+ STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) >+ STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) >+ STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) >+ STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) >+ STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) >+ >+/* Round 2 */ >+ STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) >+ STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) >+ STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) >+ STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) >+ STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) >+ STEP(G, d, a, b, c, GET(10), 0x02441453, 9) >+ STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) >+ STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) >+ STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) >+ STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) >+ STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) >+ STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) >+ STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) >+ STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) >+ STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) >+ STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) >+ >+/* Round 3 */ >+ STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) >+ STEP(H, d, a, b, c, GET(8), 0x8771f681, 11) >+ STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) >+ STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23) >+ STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) >+ STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11) >+ STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) >+ STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23) >+ STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) >+ STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11) >+ STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) >+ STEP(H, b, c, d, a, GET(6), 0x04881d05, 23) >+ STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) >+ STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11) >+ STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) >+ STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23) >+ >+/* Round 4 */ >+ STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) >+ STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) >+ STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) >+ STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) >+ STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) >+ STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) >+ STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) >+ STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) >+ STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) >+ STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) >+ STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) >+ STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) >+ STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) >+ STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) >+ STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) >+ STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) >+ >+ a += saved_a; >+ b += saved_b; >+ c += saved_c; >+ d += saved_d; >+ >+ ptr += 64; >+ } while (size -= 64); >+ >+ ctx->a = a; >+ ctx->b = b; >+ ctx->c = c; >+ ctx->d = d; >+ >+ return ptr; >+} >+ >+void MD5_Init(MD5_CTX *ctx) >+{ >+ ctx->a = 0x67452301; >+ ctx->b = 0xefcdab89; >+ ctx->c = 0x98badcfe; >+ ctx->d = 0x10325476; >+ >+ ctx->lo = 0; >+ ctx->hi = 0; >+} >+ >+void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) >+{ >+ MD5_u32plus saved_lo; >+ unsigned long used, free; >+ >+ saved_lo = ctx->lo; >+ if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) >+ ctx->hi++; >+ ctx->hi += size >> 29; >+ >+ used = saved_lo & 0x3f; >+ >+ if (used) { >+ free = 64 - used; >+ >+ if (size < free) { >+ memcpy(&ctx->buffer[used], data, size); >+ return; >+ } >+ >+ memcpy(&ctx->buffer[used], data, free); >+ data = (unsigned char *)data + free; >+ size -= free; >+ body(ctx, ctx->buffer, 64); >+ } >+ >+ if (size >= 64) { >+ data = body(ctx, data, size & ~(unsigned long)0x3f); >+ size &= 0x3f; >+ } >+ >+ memcpy(ctx->buffer, data, size); >+} >+ >+void MD5_Final(unsigned char *result, MD5_CTX *ctx) >+{ >+ unsigned long used, free; >+ >+ used = ctx->lo & 0x3f; >+ >+ ctx->buffer[used++] = 0x80; >+ >+ free = 64 - used; >+ >+ if (free < 8) { >+ memset(&ctx->buffer[used], 0, free); >+ body(ctx, ctx->buffer, 64); >+ used = 0; >+ free = 64; >+ } >+ >+ memset(&ctx->buffer[used], 0, free - 8); >+ >+ ctx->lo <<= 3; >+ ctx->buffer[56] = ctx->lo; >+ ctx->buffer[57] = ctx->lo >> 8; >+ ctx->buffer[58] = ctx->lo >> 16; >+ ctx->buffer[59] = ctx->lo >> 24; >+ ctx->buffer[60] = ctx->hi; >+ ctx->buffer[61] = ctx->hi >> 8; >+ ctx->buffer[62] = ctx->hi >> 16; >+ ctx->buffer[63] = ctx->hi >> 24; >+ >+ body(ctx, ctx->buffer, 64); >+ >+ result[0] = ctx->a; >+ result[1] = ctx->a >> 8; >+ result[2] = ctx->a >> 16; >+ result[3] = ctx->a >> 24; >+ result[4] = ctx->b; >+ result[5] = ctx->b >> 8; >+ result[6] = ctx->b >> 16; >+ result[7] = ctx->b >> 24; >+ result[8] = ctx->c; >+ result[9] = ctx->c >> 8; >+ result[10] = ctx->c >> 16; >+ result[11] = ctx->c >> 24; >+ result[12] = ctx->d; >+ result[13] = ctx->d >> 8; >+ result[14] = ctx->d >> 16; >+ result[15] = ctx->d >> 24; >+ >+ memset(ctx, 0, sizeof(*ctx)); >+} >+ >+#endif >diff -ruN john-1.7.0.1/src/md5.h john-1.7.0.1-banquise-to-bigpatch-18/src/md5.h >--- john-1.7.0.1/src/md5.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/md5.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,35 @@ >+/* >+ * This is an OpenSSL-compatible implementation of the RSA Data Security, >+ * Inc. MD5 Message-Digest Algorithm. >+ * >+ * Written by Solar Designer <solar@openwall.com> in 2001, and placed in >+ * the public domain. See md5.c for more information. >+ */ >+ >+#ifdef HAVE_OPENSSL >+#include <openssl/md5.h> >+#elif !defined(_MD5_H) >+#define _MD5_H >+ >+/* Any 32-bit or wider unsigned integer data type will do */ >+typedef unsigned long MD5_u32plus; >+ >+typedef struct { >+ MD5_u32plus lo, hi; >+ MD5_u32plus a, b, c, d; >+ unsigned char buffer[64]; >+ MD5_u32plus block[16]; >+} MD5_CTX; >+ >+extern void MD5_Init(MD5_CTX *ctx); >+extern void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size); >+extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); >+ >+#ifdef MMX_COEF >+extern int mdfivemmx(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+extern int mdfivemmx_nosizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+extern int mdfivemmx_noinit_sizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+extern int mdfivemmx_noinit_uniformsizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+#endif >+ >+#endif >diff -ruN john-1.7.0.1/src/memory.c john-1.7.0.1-banquise-to-bigpatch-18/src/memory.c >--- john-1.7.0.1/src/memory.c 2003-10-01 01:26:25.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/memory.c 2006-03-16 04:42:35.000000000 +0000 >@@ -70,3 +70,29 @@ > size = strlen(src) + 1; > return (char *)memcpy(mem_alloc_tiny(size, MEM_ALIGN_NONE), src, size); > } >+ >+void dump_stuff(unsigned char * x, unsigned int size) >+{ >+ while(size--) >+ { >+ printf("%.2x", *x); >+ x++; >+ } >+ printf("\n"); >+} >+ >+#ifdef MMX_COEF >+#define GETPOS(i, index) ( (index)*4 + (i& (0xffffffff-3) )*MMX_COEF + ((i)&3) ) >+ >+void dump_stuff_mmx(unsigned char * buf, unsigned int size, unsigned int index) >+{ >+ int i; >+ for(i=0;i<size;i++) >+ { >+ if(!(i%4)) >+ printf(" "); >+ printf("%.2x", buf[GETPOS(i, index)]); >+ } >+ printf("\n"); >+} >+#endif >diff -ruN john-1.7.0.1/src/memory.h john-1.7.0.1-banquise-to-bigpatch-18/src/memory.h >--- john-1.7.0.1/src/memory.h 2003-10-01 01:26:25.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/memory.h 2006-03-16 04:43:26.000000000 +0000 >@@ -73,4 +73,9 @@ > */ > extern char *str_alloc_copy(char *src); > >+void dump_stuff(unsigned char * x, unsigned int size); >+#ifdef MMX_COEF >+void dump_stuff_mmx(unsigned char * x, unsigned int size, unsigned int index); >+#endif >+ > #endif >diff -ruN john-1.7.0.1/src/mscash_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/mscash_fmt.c >--- john-1.7.0.1/src/mscash_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/mscash_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,213 @@ >+/* >+ * Copyright (c) 2004 Simon Marechal >+ * bartavelle@bandecon.com >+ * >+ * This is a plugin that adds Microsoft credential's cache hashing algorithm, >+ * MS Cache Hash, a.k.a. MS Cash. This patch is invasive because john doesn't >+ * support the use of the username easily within the current framework. >+ * In order to get those hashes, use the CacheDump utility : >+ * >+ * http://www.cr0.net:8040/misc/cachedump.html >+ * >+ * It uses >+ * - smbencrypt.c Copyright (C) Andrew Tridgell 1997-1998 >+ * - md4.c, md4.h by Solar Designer >+ * >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "misc.h" >+#include "common.h" >+#include "formats.h" >+#include "md4.h" >+ >+#define FORMAT_LABEL "mscash" >+#define FORMAT_NAME "M$ Cache Hash" >+#define ALGORITHM_NAME "mscash" >+ >+#define BENCHMARK_COMMENT "" >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 32 >+ >+#define BINARY_SIZE 16 >+//max username size is 64, double for unicode "optimization" >+#define SALT_SIZE (64*2) >+#define CIPHERTEXT_LENGTH (BINARY_SIZE*2 + SALT_SIZE) >+ >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+ >+static struct fmt_tests mscash_tests[] = { >+ {"M$test1#64cd29e36a8431a2b111378564a10631", "test1" }, >+ {"M$test2#ab60bdb4493822b175486810ac2abe63", "test2" }, >+ {"M$test3#14dd041848e12fc48c0aa7a416a4a00c", "test3" }, >+ {"M$test4#b945d24866af4b01a6d89b9d932a153c", "test4" }, >+ {NULL} >+}; >+ >+static char saved_key[PLAINTEXT_LENGTH + 1]; >+//stores the ciphertext for value currently being tested >+static char crypt_key[BINARY_SIZE+1]; >+ >+static int salt_length; //the length of the current username >+static unsigned short cur_salt[SALT_SIZE/2]; //current salt >+ >+extern void E_md4hash(unsigned char *passwd, unsigned char *p16); >+ >+static int valid(char *ciphertext) >+{ >+ int i; >+ int l; >+ >+ /* >+ * 2 cases >+ * 1 - it comes from the disk, and does not have M$ + salt >+ * 2 - it comes from memory, and has got M$ + salt + # + blah >+ */ >+ >+ if (!memcmp(ciphertext, "M$", 2)) >+ { >+ l = strlen(ciphertext) - PLAINTEXT_LENGTH; >+ if(ciphertext[l-1]!='#') >+ return 0; >+ } >+ else >+ { >+ if(strlen(ciphertext)!=PLAINTEXT_LENGTH) >+ return 0; >+ l = 0; >+ } >+ for (i = l; i < l + PLAINTEXT_LENGTH; i++){ >+ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) || >+ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f')) >+ || (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F')))) >+ return 0; >+ } >+ >+ return 1; >+} >+ >+//salt is unicode, so let's say it's unsigned short >+static void mscash_set_salt(void *salt) { >+ salt_length = 0; >+ while( ((unsigned char *)salt)[salt_length]!='#' ) >+ { >+#if ARCH_LITTLE_ENDIAN >+ cur_salt[salt_length] = ((unsigned char *)salt)[salt_length]; >+#else >+ cur_salt[salt_length] = ((unsigned char *)salt)[salt_length] << 8; >+#endif >+ salt_length ++; >+ } >+ cur_salt[salt_length] = 0; >+} >+ >+static void mscash_set_key(char *key, int index) { >+ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1); >+} >+ >+static char *mscash_get_key(int index) { >+ return saved_key; >+} >+ >+static int mscash_cmp_all(void *binary, int index) { >+ int i=0; >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+ return 1; >+} >+ >+static void mscash_crypt_all(int count) { >+ unsigned char buffer[BINARY_SIZE+SALT_SIZE]; >+ // get plaintext input in saved_key put it into ciphertext crypt_key >+ >+ //stage 1 : build nt hash of password >+ E_md4hash(saved_key, buffer); >+ >+ //stage 2 : append cleartext to buffer >+ memcpy(buffer+BINARY_SIZE, cur_salt, salt_length*2); >+ >+ //stage 3 : generate final hash and put it in crypt_key >+ mdfour(crypt_key, buffer, BINARY_SIZE+salt_length*2); >+} >+ >+static void * mscash_binary(char *ciphertext) >+{ >+ static unsigned char realcipher[BINARY_SIZE]; >+ int i; >+ >+ int l = strlen(ciphertext); >+ for(i=0; i<BINARY_SIZE ;i++) >+ { >+ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2+l-BINARY_SIZE*2])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+l-BINARY_SIZE*2+1])]; >+ } >+ return (void *)realcipher; >+} >+ >+static void * mscash_get_salt(char * ciphertext) >+{ >+ static unsigned char out[SALT_SIZE]; >+ int l; >+ >+ l = strlen(ciphertext); >+ strncpy(out, ciphertext + 2, l - PLAINTEXT_LENGTH + 1); >+ return out; >+} >+ >+static int mscash_cmp_one(void *binary, int count){ >+ return (1); >+} >+ >+static int mscash_cmp_exact(char *source, int count){ >+ return 1; >+ //return (!memcmp(mscash_binary(source), crypt_key, BINARY_SIZE)); >+} >+ >+struct fmt_main fmt_mscash = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ mscash_tests >+ }, { >+ fmt_default_init, >+ valid, >+ fmt_default_split, >+ mscash_binary, >+ mscash_get_salt, >+ { >+ fmt_default_binary_hash, >+ fmt_default_binary_hash, >+ fmt_default_binary_hash >+ }, >+ fmt_default_salt_hash, >+ mscash_set_salt, >+ mscash_set_key, >+ mscash_get_key, >+ fmt_default_clear_keys, >+ mscash_crypt_all, >+ { >+ fmt_default_get_hash, >+ fmt_default_get_hash, >+ fmt_default_get_hash >+ }, >+ mscash_cmp_all, >+ mscash_cmp_one, >+ mscash_cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/mscash_mmx.c john-1.7.0.1-banquise-to-bigpatch-18/src/mscash_mmx.c >--- john-1.7.0.1/src/mscash_mmx.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/mscash_mmx.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,234 @@ >+/* >+ * Copyright (c) 2004 Simon Marechal >+ * bartavelle@bandecon.com >+ * >+ * This is a plugin that adds Microsoft credential's cache hashing algorithm, >+ * MS Cache Hash, a.k.a. MS Cash. This patch is invasive because john doesn't >+ * support the use of the username easily within the current framework. >+ * In order to get those hashes, use the CacheDump utility : >+ * >+ * http://www.cr0.net:8040/misc/cachedump.html >+ * >+ * It uses >+ * - smbencrypt.c Copyright (C) Andrew Tridgell 1997-1998 >+ * - md4.c, md4.h by Solar Designer >+ * >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "misc.h" >+#include "common.h" >+#include "formats.h" >+#include "md4.h" >+ >+#define FORMAT_LABEL "mscashmmx" >+#define FORMAT_NAME "M$ Cache Hash MMX" >+#define ALGORITHM_NAME "mscash" >+ >+#define BENCHMARK_COMMENT MMX_TYPE >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 32 >+ >+#define BINARY_SIZE 16 >+//max username size is 64, double for unicode "optimization" >+#define SALT_SIZE (64*2*MMX_COEF) >+#define CIPHERTEXT_LENGTH (BINARY_SIZE*2 + SALT_SIZE) >+ >+#define MIN_KEYS_PER_CRYPT MMX_COEF >+#define MAX_KEYS_PER_CRYPT MMX_COEF >+ >+#define GETPOS(i,idx) ( ((i)&0xfffe)*MMX_COEF + ((i)&1) + ((idx)<<1) ) >+ >+static struct fmt_tests mscash_tests[] = { >+ {"M$test1#64cd29e36a8431a2b111378564a10631", "test1" }, >+ {"M$test2#ab60bdb4493822b175486810ac2abe63", "test2" }, >+ {"M$test3#14dd041848e12fc48c0aa7a416a4a00c", "test3" }, >+ {"M$test4#b945d24866af4b01a6d89b9d932a153c", "test4" }, >+ {NULL} >+}; >+ >+static char saved_key[PLAINTEXT_LENGTH*MMX_COEF + 1]; >+//stores the ciphertext for value currently being tested >+static char crypt_key[BINARY_SIZE*MMX_COEF+1]; >+ >+static int salt_length; //the length of the current username >+static int total_len; >+static unsigned short cur_salt[MMX_COEF*SALT_SIZE/2]; //current salt >+ >+//extern void E_md4hash(unsigned char *passwd, unsigned char *p16); >+ >+static int valid(char *ciphertext) >+{ >+ int i; >+ int l; >+ >+ /* >+ * 2 cases >+ * 1 - it comes from the disk, and does not have M$ + salt >+ * 2 - it comes from memory, and has got M$ + salt + # + blah >+ */ >+ >+ if (!memcmp(ciphertext, "M$", 2)) >+ { >+ l = strlen(ciphertext) - PLAINTEXT_LENGTH; >+ if(ciphertext[l-1]!='#') >+ return 0; >+ } >+ else >+ { >+ if(strlen(ciphertext)!=PLAINTEXT_LENGTH) >+ return 0; >+ l = 0; >+ } >+ for (i = l; i < l + PLAINTEXT_LENGTH; i++){ >+ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) || >+ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f')) >+ || (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F')))) >+ return 0; >+ } >+ >+ return 1; >+} >+ >+//salt is unicode, so let's say it's unsigned short >+static void mscash_set_salt(void *salt) { >+ unsigned int curlen; >+ salt_length = 0; >+ while( ((unsigned char *)salt)[salt_length]!='#' ) >+ { >+#if ARCH_LITTLE_ENDIAN >+ cur_salt[salt_length] = ((unsigned char *)salt)[salt_length]; >+#else >+ cur_salt[salt_length] = ((unsigned char *)salt)[salt_length] << 8; >+#endif >+ salt_length ++; >+ } >+ cur_salt[salt_length] = 0; >+ salt_length = curlen; >+} >+ >+static void mscash_set_key(char *key, int index) { >+ int len; >+ int i; >+ >+ if(index==0) >+ { >+ total_len = 0; >+ memset(saved_key, 0, 64*MMX_COEF); >+ } >+ len = strlen(key); >+ if(len > 32) >+ len = 32; >+ >+ total_len += len << (1 + ( (32/MMX_COEF) * index ) ); >+ >+ for(i=0;i<len;i++) >+ ((unsigned short *)saved_key)[ GETPOS(i, index) ] = key[i] ; >+ ((unsigned short *)saved_key)[ GETPOS(i, index) ] = 0x80; >+} >+ >+static char *mscash_get_key(int index) { >+ return saved_key; >+} >+ >+static int mscash_cmp_all(void *binary, int index) { >+ int i=0; >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+ return 1; >+} >+ >+static void mscash_crypt_all(int count) { >+ unsigned char buffer[BINARY_SIZE+SALT_SIZE]; >+ // get plaintext input in saved_key put it into ciphertext crypt_key >+ >+ //stage 1 : build nt hash of password >+ //E_md4hash(saved_key, buffer); >+ >+ //stage 2 : append cleartext to buffer >+ //memcpy(buffer+BINARY_SIZE, cur_salt, salt_length*2); >+ >+ //stage 3 : generate final hash and put it in crypt_key >+ //mdfour(crypt_key, buffer, BINARY_SIZE+salt_length*2); >+} >+ >+static void * mscash_binary(char *ciphertext) >+{ >+ static unsigned char realcipher[BINARY_SIZE]; >+ int i; >+ >+ int l = strlen(ciphertext); >+ for(i=0; i<BINARY_SIZE ;i++) >+ { >+ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2+l-BINARY_SIZE*2])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+l-BINARY_SIZE*2+1])]; >+ } >+ return (void *)realcipher; >+} >+ >+static void * mscash_get_salt(char * ciphertext) >+{ >+ static unsigned char out[SALT_SIZE]; >+ int l; >+ >+ l = strlen(ciphertext); >+ strncpy(out, ciphertext + 2, l - PLAINTEXT_LENGTH + 1); >+ return out; >+} >+ >+static int mscash_cmp_one(void *binary, int count){ >+ return (1); >+} >+ >+static int mscash_cmp_exact(char *source, int count){ >+ return 1; >+ //return (!memcmp(mscash_binary(source), crypt_key, BINARY_SIZE)); >+} >+ >+struct fmt_main fmt_mscash_mmx = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ mscash_tests >+ }, { >+ fmt_default_init, >+ valid, >+ fmt_default_split, >+ mscash_binary, >+ mscash_get_salt, >+ { >+ fmt_default_binary_hash, >+ fmt_default_binary_hash, >+ fmt_default_binary_hash >+ }, >+ fmt_default_salt_hash, >+ mscash_set_salt, >+ mscash_set_key, >+ mscash_get_key, >+ fmt_default_clear_keys, >+ mscash_crypt_all, >+ { >+ fmt_default_get_hash, >+ fmt_default_get_hash, >+ fmt_default_get_hash >+ }, >+ mscash_cmp_all, >+ mscash_cmp_one, >+ mscash_cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/mssql_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/mssql_fmt.c >--- john-1.7.0.1/src/mssql_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/mssql_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,326 @@ >+/* >+ * Copyright (c) 2004 bartavelle >+ * bartavelle@bandecon.com >+ * >+ * microsoft MS SQL cracker >+ * >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "misc.h" >+#include "common.h" >+#include "formats.h" >+#include "sha.h" >+ >+//remove this line at your own risks! >+//seems to work sometimes ... >+#undef MMX_COEF >+ >+#define FORMAT_LABEL "mssql" >+#define FORMAT_NAME "MS-SQL" >+#ifdef MMX_COEF >+#if (MMX_COEF == 2) >+#define ALGORITHM_NAME "ms-sql MMX" >+#else >+#define ALGORITHM_NAME "ms-sql SSE2" >+#endif >+#else >+#define ALGORITHM_NAME "ms-sql" >+#endif >+ >+#ifdef MMX_TYPE >+#define BENCHMARK_COMMENT MMX_TYPE >+#else >+#define BENCHMARK_COMMENT "" >+#endif >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 20 >+#define CIPHERTEXT_LENGTH 94 >+ >+#define BINARY_SIZE 20 >+#define SALT_SIZE 4 >+ >+#ifdef MMX_COEF >+#define MIN_KEYS_PER_CRYPT MMX_COEF >+#define MAX_KEYS_PER_CRYPT MMX_COEF >+//#define GETPOS(i, index) ( (index)*4 + (i& (0xffffffff-3) )*MMX_COEF + ((i)&3) ) //std getpos >+#define GETPOS(i, index) ( (index)*4 + (i& (0xffffffff-3) )*MMX_COEF + (3-((i)&3)) ) //for endianity conversion >+#else >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+#endif >+ >+//microsoft unicode ... >+#if ARCH_BIG_ENDIAN >+#define ENDIAN_SHIFT_L << 8 >+#define ENDIAN_SHIFT_R >> 8 >+#else >+#define ENDIAN_SHIFT_L >+#define ENDIAN_SHIFT_R >+#endif >+ >+static struct fmt_tests mssql_tests[] = { >+ {"0x0100A607BA7C54A24D17B565C59F1743776A10250F581D482DA8B6D6261460D3F53B279CC6913CE747006A2E3254", "FOO"}, >+ {"0x01000508513EADDF6DB7DDD270CCA288BF097F2FF69CC2DB74FBB9644D6901764F999BAB9ECB80DE578D92E3F80D", "BAR"}, >+ {"0x01008408C523CF06DCB237835D701C165E68F9460580132E28ED8BC558D22CEDF8801F4503468A80F9C52A12C0A3", "CANARD"}, >+ {"0x0100BF088517935FC9183FE39FDEC77539FD5CB52BA5F5761881E5B9638641A79DBF0F1501647EC941F3355440A2", "LAPIN"}, >+ {NULL} >+}; >+ >+static unsigned char cursalt[SALT_SIZE]; >+ >+#ifdef MMX_COEF >+static char saved_key[64*MMX_COEF*2 + 1] __attribute__ ((aligned(16))); >+static char crypt_key[80*4*MMX_COEF+1] __attribute__ ((aligned(16))); //wtf >+unsigned long total_len; >+unsigned char out[PLAINTEXT_LENGTH]; >+#else >+static unsigned char saved_key[PLAINTEXT_LENGTH*2 + 1]; >+static unsigned char crypt_key[BINARY_SIZE+1]; >+static SHA_CTX ctx; >+unsigned int key_length; >+#endif >+ >+static int valid(char *ciphertext) >+{ >+ int i; >+ >+ if (strlen(ciphertext) != CIPHERTEXT_LENGTH) return 0; >+ if(memcmp(ciphertext, "0x0100", 6)) >+ return 0; >+ for (i = 6; i < CIPHERTEXT_LENGTH; i++){ >+ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) || >+ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f')) >+ || (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F')))) >+ return 0; >+ } >+ return 1; >+} >+ >+static void mssql_set_salt(void *salt) >+{ >+ memcpy(cursalt, salt, SALT_SIZE); >+} >+ >+static void * mssql_get_salt(char * ciphertext) >+{ >+ static unsigned char out2[SALT_SIZE]; >+ int l; >+ >+ for(l=0;l<SALT_SIZE;l++) >+ { >+ out2[l] = atoi16[ARCH_INDEX(ciphertext[l*2+6])]*16 >+ + atoi16[ARCH_INDEX(ciphertext[l*2+7])]; >+ } >+ >+ return out2; >+} >+ >+static inline unsigned char upper(unsigned char c) >+{ >+ if( (c>='a') && (c<='z')) >+ return c+'A'-'a'; >+ return c; >+} >+ >+static void mssql_init(void) >+{ >+#ifdef MMX_COEF >+ memset(saved_key, 0, 64*MMX_COEF); >+#endif >+} >+ >+static void mssql_set_key(char *key, int index) { >+#ifdef MMX_COEF >+ int len; >+ int i; >+ >+ if(index==0) >+ { >+ total_len = 0; >+ memset(saved_key, 0, 64*MMX_COEF); >+ } >+ len = strlen(key); >+ if(len>PLAINTEXT_LENGTH) >+ len = PLAINTEXT_LENGTH; >+ >+ total_len += (len*2+SALT_SIZE ) << ( ( (32/MMX_COEF) * index ) ); >+ for(i=0;i<len;i++) >+ { >+ saved_key[GETPOS((i*2), index)] = upper(key[i]); >+ saved_key[GETPOS((i*2+1), index)] = 0; >+ } >+ for(i=0;i<4;i++) >+ saved_key[GETPOS( (len*2+i), index)] = cursalt[i]; >+ saved_key[GETPOS( (len*2+SALT_SIZE) , index)] = 0x80; >+#else >+ key_length = 0; >+ while( (((unsigned short *)saved_key)[key_length] = upper(key[key_length]) ENDIAN_SHIFT_L )) >+ key_length++; >+#endif >+} >+ >+static char *mssql_get_key(int index) { >+#ifdef MMX_COEF >+ unsigned int i,s; >+ >+ s = (total_len >> (((32/MMX_COEF)*(index)))) & 0xff; >+ s = (s-4)/2; >+ for(i=0;i<s;i++) >+ out[i] = saved_key[ GETPOS(i*2, index) ]; >+ out[i] = 0; >+ return out; >+#else >+ static unsigned char retkey[PLAINTEXT_LENGTH]; >+ int i; >+ >+ memset(retkey, 0, PLAINTEXT_LENGTH); >+ for(i=0;i<key_length;i++) >+ retkey[i] = ((unsigned short *)saved_key)[i]; >+ return retkey; >+#endif >+} >+ >+static int mssql_cmp_all(void *binary, int index) { >+ int i=0; >+#ifdef MMX_COEF >+ while(i< (BINARY_SIZE/4) ) >+ { >+ if ( >+ ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+1]) >+#if (MMX_COEF > 3) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+2]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+3]) >+#endif >+ ) >+ return 0; >+ i++; >+ } >+#else >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+#endif >+ return 1; >+} >+ >+static int mssql_cmp_exact(char *source, int count){ >+ return (1); >+} >+ >+static int mssql_cmp_one(void * binary, int index) >+{ >+#ifdef MMX_COEF >+ int i = 0; >+ for(i=0;i<(BINARY_SIZE/4);i++) >+ if ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+index] ) >+ return 0; >+ return 1; >+#else >+ return mssql_cmp_all(binary, index); >+#endif >+} >+ >+static void mssql_crypt_all(int count) { >+ // get plaintext input in saved_key put it into ciphertext crypt_key >+#ifdef MMX_COEF >+ shammx(crypt_key, saved_key, total_len); >+#else >+ memcpy(saved_key+key_length*2, cursalt, SALT_SIZE); >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, saved_key, key_length*2+SALT_SIZE ); >+ SHA1_Final( crypt_key, &ctx); >+#endif >+ >+} >+ >+static void * mssql_binary(char *ciphertext) >+{ >+ static char realcipher[BINARY_SIZE]; >+ int i; >+ >+ for(i=0;i<BINARY_SIZE;i++) >+ { >+ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2+54])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+55])]; >+ } >+ return (void *)realcipher; >+} >+ >+static int binary_hash_0(void *binary) >+{ >+ return ((unsigned int *)binary)[0] & 0xF; >+} >+ >+static int binary_hash_1(void *binary) >+{ >+ return ((unsigned int *)binary)[0] & 0xFF; >+} >+ >+static int binary_hash_2(void *binary) >+{ >+ return ((unsigned int *)binary)[0] & 0xFFF; >+} >+ >+static int get_hash_0(int index) >+{ >+ return ((unsigned long *)crypt_key)[index] & 0xF; >+} >+ >+static int get_hash_1(int index) >+{ >+ return ((unsigned long *)crypt_key)[index] & 0xFF; >+} >+ >+static int get_hash_2(int index) >+{ >+ return ((unsigned long *)crypt_key)[index] & 0xFFF; >+} >+ >+struct fmt_main fmt_mssql = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_8_BIT, >+ mssql_tests >+ }, { >+ mssql_init, >+ valid, >+ fmt_default_split, >+ mssql_binary, >+ mssql_get_salt, >+ { >+ binary_hash_0, >+ binary_hash_1, >+ binary_hash_2 >+ }, >+ fmt_default_salt_hash, >+ mssql_set_salt, >+ mssql_set_key, >+ mssql_get_key, >+ fmt_default_clear_keys, >+ mssql_crypt_all, >+ { >+ get_hash_0, >+ get_hash_1, >+ get_hash_2 >+ }, >+ mssql_cmp_all, >+ mssql_cmp_one, >+ mssql_cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/options.c john-1.7.0.1-banquise-to-bigpatch-18/src/options.c >--- john-1.7.0.1/src/options.c 2006-01-09 14:35:00.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/options.c 2006-03-16 04:46:43.000000000 +0000 >@@ -102,6 +102,10 @@ > "only\n" \ > "--format=NAME force ciphertext format NAME: " \ > "DES/BSDI/MD5/BF/AFS/LM\n" \ >+" raw-md5/MYSQL/NT/lotus5/mscash/md5a/nsldap\n" \ >+" bfegg/mssql/\n" \ >+" NTmmx (will not work for passwords more\n" \ >+" than 32 characters, use NT instead)\n" \ > "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n" > > void opt_init(char *name, int argc, char **argv) >diff -ruN john-1.7.0.1/src/oracle_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/oracle_fmt.c >--- john-1.7.0.1/src/oracle_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/oracle_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,248 @@ >+/* >+ * Copyright (c) 2004 Simon Marechal >+ * simon.marechal@thales-security.com >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "misc.h" >+#include "common.h" >+#include "formats.h" >+#include "des.h" >+ >+#define FORMAT_LABEL "oracle" >+#define FORMAT_NAME "Oracle" >+#define ALGORITHM_NAME "oracle" >+ >+#define BENCHMARK_COMMENT "" >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 16 >+ >+#define BINARY_SIZE 8 >+#define SALT_SIZE 32 >+#define CIPHERTEXT_LENGTH (BINARY_SIZE + SALT_SIZE) >+ >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+ >+static struct fmt_tests oracle_tests[] = { >+ {"O$SIMON#4F8BC1809CB2AF77", "A"}, >+ {"O$SIMON#183D72325548EF11", "THALES2" }, >+ {"O$SIMON#C4EB3152E17F24A4", "TST" }, >+ {"O$SYSTEM#9EEDFA0AD26C6D52", "THALES" }, >+ {NULL} >+}; >+ >+#if ARCH_LITTLE_ENDIAN >+#define ENDIAN_SHIFT_L << 8 >+#define ENDIAN_SHIFT_R >> 8 >+#else >+#define ENDIAN_SHIFT_L >+#define ENDIAN_SHIFT_R >+#endif >+ >+//stores the ciphertext for value currently being tested >+static char crypt_key[BINARY_SIZE+1]; >+ >+static unsigned char cur_salt[128 + 1]; //current salt >+static unsigned char cur_key[128 + 1]; //current salt >+ >+static unsigned char deskey[8]; >+static unsigned char salt_iv[8]; >+static DES_key_schedule desschedule1; >+static DES_key_schedule desschedule2; >+ >+static int salt_length; >+static int key_length; >+ >+static int valid(char *ciphertext) >+{ >+ int i; >+ int l; >+ >+ /* >+ * 2 cases >+ * 1 - it comes from the disk, and does not have O$ + salt >+ * 2 - it comes from memory, and has got O$ + salt + # + blah >+ */ >+ >+ if (!memcmp(ciphertext, "O$", 2)) >+ { >+ l = strlen(ciphertext) - PLAINTEXT_LENGTH; >+ if(ciphertext[l-1]!='#') >+ return 0; >+ } >+ else >+ { >+ if(strlen(ciphertext)!=PLAINTEXT_LENGTH) >+ return 0; >+ l = 0; >+ } >+ for (i = l; i < l + PLAINTEXT_LENGTH; i++){ >+ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) || >+ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f')) >+ || (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F')))) >+ return 0; >+ } >+ >+ return 1; >+} >+ >+static void oracle_init(void) >+{ >+ deskey[0] = 0x01; >+ deskey[1] = 0x23; >+ deskey[2] = 0x45; >+ deskey[3] = 0x67; >+ deskey[4] = 0x89; >+ deskey[5] = 0xab; >+ deskey[6] = 0xcd; >+ deskey[7] = 0xef; >+ >+ my_des_set_key(&deskey, &desschedule1); >+} >+ >+static inline unsigned char upper(unsigned char c) >+{ >+ if( (c>='a') && (c<='z')) >+ return c+'A'-'a'; >+ return c; >+} >+ >+static void oracle_set_salt(void *salt, int count) { >+ salt_length = 0; >+ >+ memset(salt_iv, 0, 8); >+ while ( (((unsigned short *)cur_salt)[salt_length] = upper(((unsigned char *)salt)[salt_length]) ENDIAN_SHIFT_L )) >+ salt_length++; >+} >+ >+static void oracle_set_key(char *key, int index) { >+ key_length = 0; >+ while( (((unsigned short *)cur_key)[key_length] = upper(key[key_length]) ENDIAN_SHIFT_L )) >+ key_length++; >+} >+ >+static char *oracle_get_key(int index) { >+ static unsigned char out[PLAINTEXT_LENGTH]; >+ unsigned int i; >+ for(i=0;i<key_length;i++) >+ out[i] = ((unsigned short *)cur_key)[i] ENDIAN_SHIFT_R; >+ out[i] = 0; >+ return out; >+} >+ >+static int oracle_cmp_all(void *binary, int index) { >+ int i=0; >+ while(i<(BINARY_SIZE/sizeof(int))) >+ { >+ if(((int *)binary)[i]!=((int *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+ return 1; >+} >+ >+static void oracle_crypt_all(int count) >+{ >+ unsigned int l; >+ >+ >+ l = (salt_length + key_length)*2; >+ memcpy(crypt_key, salt_iv, 8); >+ //that's the way john works ... >+ memcpy(cur_salt + salt_length*2, cur_key, key_length * 2); >+ my_des_ncbc_encrypt(cur_salt ,l , &desschedule1,(DES_cblock *) crypt_key); >+ my_des_set_key((DES_cblock *)crypt_key, &desschedule2); >+ memset(crypt_key, 0, 8); >+ my_des_ncbc_encrypt(cur_salt, l , &desschedule2, (DES_cblock *)crypt_key); >+} >+ >+static void * oracle_binary(char *ciphertext) >+{ >+ static unsigned char out3[BINARY_SIZE]; >+ int l; >+ int i; >+ l = strlen(ciphertext) - PLAINTEXT_LENGTH; >+ for(i=0;i<BINARY_SIZE;i++) >+ { >+ out3[i] = atoi16[ARCH_INDEX(ciphertext[i*2+l])]*16 >+ + atoi16[ARCH_INDEX(ciphertext[i*2+l+1])]; >+ } >+ return out3; >+} >+ >+static void * oracle_get_salt(char * ciphertext) >+{ >+ static unsigned char out2[SALT_SIZE]; >+ int l; >+ >+ l = 2; >+ while( ciphertext[l] && (ciphertext[l]!='#') ) >+ { >+ out2[l-2] = ciphertext[l]; >+ l++; >+ } >+ out2[l-2] = 0; >+ return out2; >+} >+ >+static int oracle_cmp_one(void *binary, int count){ >+ return (1); >+} >+ >+static int oracle_cmp_exact(char *source, int count){ >+ return 1; >+} >+ >+static int binary_hash1(void * binary) { return (((unsigned int *)binary)[0] & 0xf); } >+static int binary_hash2(void * binary) { return (((unsigned int *)binary)[0] & 0xff); } >+static int binary_hash3(void * binary) { return (((unsigned int *)binary)[0] & 0xfff); } >+ >+static int get_hash1(int index) { return (((unsigned int *)crypt_key)[0] & 0xf); } >+static int get_hash2(int index) { return (((unsigned int *)crypt_key)[0] & 0xff); } >+static int get_hash3(int index) { return (((unsigned int *)crypt_key)[0] & 0xfff); } >+ >+struct fmt_main fmt_oracle = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_8_BIT, >+ oracle_tests >+ }, { >+ oracle_init, >+ valid, >+ fmt_default_split, >+ oracle_binary, >+ oracle_get_salt, >+ { >+ binary_hash1, >+ binary_hash2, >+ binary_hash3 >+ }, >+ fmt_default_salt_hash, >+ oracle_set_salt, >+ oracle_set_key, >+ oracle_get_key, >+ fmt_default_clear_keys, >+ oracle_crypt_all, >+ { >+ get_hash1, >+ get_hash2, >+ get_hash3 >+ }, >+ oracle_cmp_all, >+ oracle_cmp_one, >+ oracle_cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/params.h john-1.7.0.1-banquise-to-bigpatch-18/src/params.h >diff -ruN john-1.7.0.1/src/ppc-alti.c john-1.7.0.1-banquise-to-bigpatch-18/src/ppc-alti.c >--- john-1.7.0.1/src/ppc-alti.c 2005-05-04 17:18:06.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/ppc-alti.c 2006-03-16 04:51:35.000000000 +0000 >@@ -178,6 +178,9 @@ > ARCH_WORD **k; > #endif > int iterations, rounds_and_swapped; >+#if DES_BS_VECTOR >+ int depth; >+#endif > > DES_bs_clear_block(); > >diff -ruN john-1.7.0.1/src/ppc.h john-1.7.0.1-banquise-to-bigpatch-18/src/ppc.h >--- john-1.7.0.1/src/ppc.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/ppc.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,47 @@ >+/* >+ * This file is part of John the Ripper password cracker, >+ * Copyright (c) 1996-2000 by Solar Designer >+ */ >+ >+/* >+ * Architecture specific parameters for PowerPC. >+ */ >+ >+#ifndef _JOHN_ARCH_H >+#define _JOHN_ARCH_H >+ >+#define ARCH_WORD long >+#define ARCH_SIZE 4 >+#define ARCH_BITS 32 >+#define ARCH_BITS_LOG 5 >+#define ARCH_BITS_STR "32" >+#define ARCH_LITTLE_ENDIAN 0 >+#define ARCH_INT_GT_32 0 >+#define ARCH_ALLOWS_UNALIGNED 0 >+#define ARCH_INDEX(x) ((unsigned int)(unsigned char)(x)) >+ >+#define OS_TIMER 1 >+#define OS_FLOCK 1 >+ >+#define CPU_DETECT 0 >+ >+#define DES_ASM 0 >+#define DES_128K 0 >+#define DES_X2 0 >+#define DES_MASK 1 >+#define DES_SCALE 0 >+#define DES_EXTB 1 >+#define DES_COPY 0 >+#define DES_BS_ASM 0 >+#define DES_BS 1 >+#define DES_BS_VECTOR 0 >+#define DES_BS_EXPAND 1 >+ >+#define MD5_ASM 0 >+#define MD5_X2 1 >+#define MD5_IMM 0 >+ >+#define BF_ASM 0 >+#define BF_SCALE 0 >+ >+#endif >diff -ruN john-1.7.0.1/src/ppc64.h john-1.7.0.1-banquise-to-bigpatch-18/src/ppc64.h >--- john-1.7.0.1/src/ppc64.h 2005-05-04 15:26:47.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/ppc64.h 2006-03-16 04:52:44.000000000 +0000 >@@ -10,7 +10,7 @@ > #ifndef _JOHN_ARCH_H > #define _JOHN_ARCH_H > >-#define ARCH_WORD long >+#define ARCH_WORD long long > #define ARCH_SIZE 8 > #define ARCH_BITS 64 > #define ARCH_BITS_LOG 6 >diff -ruN john-1.7.0.1/src/ppc64alt.h john-1.7.0.1-banquise-to-bigpatch-18/src/ppc64alt.h >--- john-1.7.0.1/src/ppc64alt.h 2005-05-04 15:27:13.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/ppc64alt.h 2006-03-16 04:53:40.000000000 +0000 >@@ -10,7 +10,7 @@ > #ifndef _JOHN_ARCH_H > #define _JOHN_ARCH_H > >-#define ARCH_WORD long >+#define ARCH_WORD long long > #define ARCH_SIZE 8 > #define ARCH_BITS 64 > #define ARCH_BITS_LOG 6 >diff -ruN john-1.7.0.1/src/rawMD5_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/rawMD5_fmt.c >--- john-1.7.0.1/src/rawMD5_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/rawMD5_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,262 @@ >+/* >+ * Copyright (c) 2004 bartavelle >+ * bartavelle@bandecon.com >+ * >+ * Simple MD5 hashes cracker >+ * It uses the Solar Designer's md5 implementation >+ * >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "misc.h" >+#include "common.h" >+#include "formats.h" >+#include "md5.h" >+ >+#define FORMAT_LABEL "raw-md5" >+#define FORMAT_NAME "Raw MD5" >+#ifdef MMX_COEF >+#if (MMX_COEF == 2) >+#define ALGORITHM_NAME "raw-md5 MMX" >+#else >+#define ALGORITHM_NAME "raw-md5 SSE2" >+#endif >+#else >+#define ALGORITHM_NAME "raw-md5" >+#endif >+ >+#ifdef MMX_TYPE >+#define BENCHMARK_COMMENT MMX_TYPE >+#else >+#define BENCHMARK_COMMENT "" >+#endif >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 32 >+#define CIPHERTEXT_LENGTH 32 >+ >+#define BINARY_SIZE 16 >+#define SALT_SIZE 0 >+ >+#ifdef MMX_COEF >+#define MIN_KEYS_PER_CRYPT MMX_COEF >+#define MAX_KEYS_PER_CRYPT MMX_COEF >+#define GETPOS(i, index) ( (index)*4 + (i& (0xffffffff-3) )*MMX_COEF + ((i)&3) ) >+#else >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+#endif >+ >+static struct fmt_tests rawmd5_tests[] = { >+ {"5a105e8b9d40e1329780d62ea2265d8a", "test1"}, >+ {"ad0234829205b9033196ba818f7a872b", "test2"}, >+ {"8ad8757baa8564dc136c1e07507f4a98", "test3"}, >+ {"86985e105f79b95d6bc918fb45ec7727", "test4"}, >+ {NULL} >+}; >+ >+#ifdef MMX_COEF >+static char saved_key[PLAINTEXT_LENGTH*MMX_COEF*2 + 1] __attribute__ ((aligned(16))); >+static char crypt_key[BINARY_SIZE*MMX_COEF+1] __attribute__ ((aligned(16))); >+unsigned long total_len; >+unsigned char out[PLAINTEXT_LENGTH]; >+#else >+static char saved_key[PLAINTEXT_LENGTH + 1]; >+static char crypt_key[BINARY_SIZE+1]; >+static MD5_CTX ctx; >+#endif >+ >+static int valid(char *ciphertext) >+{ >+ int i; >+ >+ if (strlen(ciphertext) != CIPHERTEXT_LENGTH) return 0; >+ for (i = 0; i < CIPHERTEXT_LENGTH; i++){ >+ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) || >+ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f')) >+ || (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F')))) >+ return 0; >+ } >+ return 1; >+} >+ >+static void rawmd5_set_salt(void *salt) { } >+ >+static void rawmd5_set_key(char *key, int index) { >+#ifdef MMX_COEF >+ int len; >+ int i; >+ >+ if(index==0) >+ { >+ total_len = 0; >+ memset(saved_key, 0, PLAINTEXT_LENGTH*MMX_COEF); >+ } >+ len = strlen(key); >+ if(len>PLAINTEXT_LENGTH) >+ len = PLAINTEXT_LENGTH; >+ >+ total_len += len << ( ( (32/MMX_COEF) * index ) ); >+ for(i=0;i<len;i++) >+ saved_key[GETPOS(i, index)] = key[i]; >+ >+ saved_key[GETPOS(i, index)] = 0x80; >+#else >+ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1); >+#endif >+} >+ >+static char *rawmd5_get_key(int index) { >+#ifdef MMX_COEF >+ unsigned int i,s; >+ >+ s = (total_len >> (((32/MMX_COEF)*(index)))) & 0xff; >+ for(i=0;i<s;i++) >+ out[i] = saved_key[ GETPOS(i, index) ]; >+ out[i] = 0; >+ return out; >+#else >+ return saved_key; >+#endif >+} >+ >+static int rawmd5_cmp_all(void *binary, int index) { >+ int i=0; >+#ifdef MMX_COEF >+ while(i< (BINARY_SIZE/4) ) >+ { >+ if ( >+ ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+1]) >+#if (MMX_COEF > 3) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+2]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+3]) >+#endif >+ ) >+ return 0; >+ i++; >+ } >+#else >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+#endif >+ return 1; >+} >+ >+static int rawmd5_cmp_exact(char *source, int count){ >+ return (1); >+} >+ >+static int rawmd5_cmp_one(void * binary, int index) >+{ >+#ifdef MMX_COEF >+ int i = 0; >+ for(i=0;i<(BINARY_SIZE/4);i++) >+ if ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+index] ) >+ return 0; >+ return 1; >+#else >+ return rawmd5_cmp_all(binary, index); >+#endif >+} >+ >+static void rawmd5_crypt_all(int count) { >+ // get plaintext input in saved_key put it into ciphertext crypt_key >+#ifdef MMX_COEF >+ mdfivemmx(crypt_key, saved_key, total_len); >+#else >+ MD5_Init( &ctx ); >+ MD5_Update( &ctx, saved_key, strlen( saved_key ) ); >+ MD5_Final( crypt_key, &ctx); >+#endif >+ >+} >+ >+static void * rawmd5_binary(char *ciphertext) >+{ >+ static char realcipher[BINARY_SIZE]; >+ int i; >+ >+ for(i=0;i<BINARY_SIZE;i++) >+ { >+ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1])]; >+ } >+ return (void *)realcipher; >+} >+ >+static int get_hash1(int index) >+{ >+#ifdef MMX_COEF >+ return (((unsigned long *)crypt_key)[index] & 0xf); >+#else >+ return (((unsigned int *)crypt_key)[0] & 0xf); >+#endif >+} >+static int get_hash2(int index) >+{ >+#ifdef MMX_COEF >+ return (((unsigned long *)crypt_key)[index] & 0xff); >+#else >+ return (((unsigned int *)crypt_key)[0] & 0xff); >+#endif >+} >+static int get_hash3(int index) >+{ >+#ifdef MMX_COEF >+ return (((unsigned long *)crypt_key)[index] & 0xfff); >+#else >+ return (((unsigned int *)crypt_key)[0] & 0xfff); >+#endif >+} >+ >+static int binary_hash1(void * binary) { return (((unsigned int *)binary)[0] & 0xf); } >+static int binary_hash2(void * binary) { return (((unsigned int *)binary)[0] & 0xff); } >+static int binary_hash3(void * binary) { return (((unsigned int *)binary)[0] & 0xfff); } >+ >+struct fmt_main fmt_rawMD5 = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ rawmd5_tests >+ }, { >+ fmt_default_init, >+ valid, >+ fmt_default_split, >+ rawmd5_binary, >+ fmt_default_salt, >+ { >+ binary_hash1, >+ binary_hash2, >+ binary_hash3 >+ }, >+ fmt_default_salt_hash, >+ rawmd5_set_salt, >+ rawmd5_set_key, >+ rawmd5_get_key, >+ fmt_default_clear_keys, >+ rawmd5_crypt_all, >+ { >+ get_hash1, >+ get_hash2, >+ get_hash3 >+ }, >+ rawmd5_cmp_all, >+ rawmd5_cmp_one, >+ rawmd5_cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/rawSHA1_fmt.c john-1.7.0.1-banquise-to-bigpatch-18/src/rawSHA1_fmt.c >--- john-1.7.0.1/src/rawSHA1_fmt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/rawSHA1_fmt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,271 @@ >+/* >+ * Copyright (c) 2004 bartavelle >+ * bartavelle@bandecon.com >+ * >+ * Simple MD5 hashes cracker >+ * It uses the Solar Designer's md5 implementation >+ * >+ */ >+ >+#include <string.h> >+ >+#include "arch.h" >+#include "misc.h" >+#include "common.h" >+#include "formats.h" >+#include "sha.h" >+ >+#define FORMAT_LABEL "raw-sha1" >+#define FORMAT_NAME "Raw SHA1" >+#ifdef MMX_COEF >+#if (MMX_COEF == 2) >+#define ALGORITHM_NAME "raw-sha1 MMX" >+#else >+#define ALGORITHM_NAME "raw-sha1 SSE2" >+#endif >+#else >+#define ALGORITHM_NAME "raw-sha1" >+#endif >+ >+#ifdef MMX_TYPE >+#define BENCHMARK_COMMENT MMX_TYPE >+#else >+#define BENCHMARK_COMMENT "" >+#endif >+#define BENCHMARK_LENGTH -1 >+ >+#define PLAINTEXT_LENGTH 32 >+#define CIPHERTEXT_LENGTH 40 >+ >+#define BINARY_SIZE 20 >+#define SALT_SIZE 0 >+ >+#ifdef MMX_COEF >+#define MIN_KEYS_PER_CRYPT MMX_COEF >+#define MAX_KEYS_PER_CRYPT MMX_COEF >+//#define GETPOS(i, index) ( (index)*4 + (i& (0xffffffff-3) )*MMX_COEF + ((i)&3) ) //std getpos >+#define GETPOS(i, index) ( (index)*4 + (i& (0xffffffff-3) )*MMX_COEF + (3-((i)&3)) ) //for endianity conversion >+#else >+#define MIN_KEYS_PER_CRYPT 1 >+#define MAX_KEYS_PER_CRYPT 1 >+#endif >+ >+static struct fmt_tests rawsha1_tests[] = { >+ {"A9993E364706816ABA3E25717850C26C9CD0D89D", "abc"}, >+ {"2fbf0eba37de1d1d633bc1ed943b907f9b360d4c", "azertyuiop1"}, >+ {"f879f8090e92232ed07092ebed6dc6170457a21d", "azertyuiop2"}, >+ {"1813c12f25e64931f3833b26e999e26e81f9ad24", "azertyuiop3"}, >+ {NULL} >+}; >+ >+#ifdef MMX_COEF >+static char saved_key[PLAINTEXT_LENGTH*MMX_COEF*2 + 1] __attribute__ ((aligned(16))); >+static char crypt_key[80*4*MMX_COEF+1] __attribute__ ((aligned(16))); >+unsigned long total_len; >+unsigned char out[PLAINTEXT_LENGTH]; >+#else >+static char saved_key[PLAINTEXT_LENGTH + 1]; >+static char crypt_key[BINARY_SIZE+1]; >+static SHA_CTX ctx; >+#endif >+ >+static int valid(char *ciphertext) >+{ >+ int i; >+ >+ if (strlen(ciphertext) != CIPHERTEXT_LENGTH) return 0; >+ for (i = 0; i < CIPHERTEXT_LENGTH; i++){ >+ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) || >+ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f')) >+ || (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F')))) >+ return 0; >+ } >+ return 1; >+} >+ >+static void rawsha1_set_salt(void *salt) { } >+ >+static void rawsha1_init(void) >+{ >+#ifdef MMX_COEF >+ memset(saved_key, 0, PLAINTEXT_LENGTH*MMX_COEF*2 + 1); >+#endif >+} >+ >+static void rawsha1_set_key(char *key, int index) { >+#ifdef MMX_COEF >+ int len; >+ int i; >+ >+ if(index==0) >+ { >+ total_len = 0; >+ memset(saved_key, 0, PLAINTEXT_LENGTH*MMX_COEF); >+ } >+ len = strlen(key); >+ if(len>PLAINTEXT_LENGTH) >+ len = PLAINTEXT_LENGTH; >+ >+ total_len += len << ( ( (32/MMX_COEF) * index ) ); >+ for(i=0;i<len;i++) >+ saved_key[GETPOS(i, index)] = key[i]; >+ >+ saved_key[GETPOS(i, index)] = 0x80; >+#else >+ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1); >+#endif >+} >+ >+static char *rawsha1_get_key(int index) { >+#ifdef MMX_COEF >+ unsigned int i,s; >+ >+ s = (total_len >> (((32/MMX_COEF)*(index)))) & 0xff; >+ for(i=0;i<s;i++) >+ out[i] = saved_key[ GETPOS(i, index) ]; >+ out[i] = 0; >+ return out; >+#else >+ return saved_key; >+#endif >+} >+ >+static int rawsha1_cmp_all(void *binary, int index) { >+ int i=0; >+#ifdef MMX_COEF >+ while(i< (BINARY_SIZE/4) ) >+ { >+ if ( >+ ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+1]) >+#if (MMX_COEF > 3) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+2]) >+ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+3]) >+#endif >+ ) >+ return 0; >+ i++; >+ } >+#else >+ while(i<BINARY_SIZE) >+ { >+ if(((char *)binary)[i]!=((char *)crypt_key)[i]) >+ return 0; >+ i++; >+ } >+#endif >+ return 1; >+} >+ >+static int rawsha1_cmp_exact(char *source, int count){ >+ return (1); >+} >+ >+static int rawsha1_cmp_one(void * binary, int index) >+{ >+#ifdef MMX_COEF >+ int i = 0; >+ for(i=0;i<(BINARY_SIZE/4);i++) >+ if ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+index] ) >+ return 0; >+ return 1; >+#else >+ return rawsha1_cmp_all(binary, index); >+#endif >+} >+ >+static void rawsha1_crypt_all(int count) { >+ // get plaintext input in saved_key put it into ciphertext crypt_key >+#ifdef MMX_COEF >+ shammx(crypt_key, saved_key, total_len); >+#else >+ SHA1_Init( &ctx ); >+ SHA1_Update( &ctx, saved_key, strlen( saved_key ) ); >+ SHA1_Final( crypt_key, &ctx); >+#endif >+ >+} >+ >+static void * rawsha1_binary(char *ciphertext) >+{ >+ static char realcipher[BINARY_SIZE]; >+ int i; >+ >+ for(i=0;i<BINARY_SIZE;i++) >+ { >+ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1])]; >+ } >+ return (void *)realcipher; >+} >+ >+static int binary_hash_0(void *binary) >+{ >+ return ((unsigned int *)binary)[0] & 0xF; >+} >+ >+static int binary_hash_1(void *binary) >+{ >+ return ((unsigned int *)binary)[0] & 0xFF; >+} >+ >+static int binary_hash_2(void *binary) >+{ >+ return ((unsigned int *)binary)[0] & 0xFFF; >+} >+ >+static int get_hash_0(int index) >+{ >+ return ((unsigned long *)crypt_key)[index] & 0xF; >+} >+ >+static int get_hash_1(int index) >+{ >+ return ((unsigned long *)crypt_key)[index] & 0xFF; >+} >+ >+static int get_hash_2(int index) >+{ >+ return ((unsigned long *)crypt_key)[index] & 0xFFF; >+} >+ >+struct fmt_main fmt_rawSHA1 = { >+ { >+ FORMAT_LABEL, >+ FORMAT_NAME, >+ ALGORITHM_NAME, >+ BENCHMARK_COMMENT, >+ BENCHMARK_LENGTH, >+ PLAINTEXT_LENGTH, >+ BINARY_SIZE, >+ SALT_SIZE, >+ MIN_KEYS_PER_CRYPT, >+ MAX_KEYS_PER_CRYPT, >+ FMT_CASE | FMT_8_BIT, >+ rawsha1_tests >+ }, { >+ rawsha1_init, >+ valid, >+ fmt_default_split, >+ rawsha1_binary, >+ fmt_default_salt, >+ { >+ binary_hash_0, >+ binary_hash_1, >+ binary_hash_2 >+ }, >+ fmt_default_salt_hash, >+ rawsha1_set_salt, >+ rawsha1_set_key, >+ rawsha1_get_key, >+ fmt_default_clear_keys, >+ rawsha1_crypt_all, >+ { >+ get_hash_0, >+ get_hash_1, >+ get_hash_2 >+ }, >+ rawsha1_cmp_all, >+ rawsha1_cmp_one, >+ rawsha1_cmp_exact >+ } >+}; >diff -ruN john-1.7.0.1/src/sha.h john-1.7.0.1-banquise-to-bigpatch-18/src/sha.h >--- john-1.7.0.1/src/sha.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/sha.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,115 @@ >+/* crypto/sha/sha.h */ >+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) >+ * All rights reserved. >+ * >+ * This package is an SSL implementation written >+ * by Eric Young (eay@cryptsoft.com). >+ * The implementation was written so as to conform with Netscapes SSL. >+ * >+ * This library is free for commercial and non-commercial use as long as >+ * the following conditions are aheared to. The following conditions >+ * apply to all code found in this distribution, be it the RC4, RSA, >+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation >+ * included with this distribution is covered by the same copyright terms >+ * except that the holder is Tim Hudson (tjh@cryptsoft.com). >+ * >+ * Copyright remains Eric Young's, and as such any Copyright notices in >+ * the code are not to be removed. >+ * If this package is used in a product, Eric Young should be given attribution >+ * as the author of the parts of the library used. >+ * This can be in the form of a textual message at program startup or >+ * in documentation (online or textual) provided with the package. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. All advertising materials mentioning features or use of this software >+ * must display the following acknowledgement: >+ * "This product includes cryptographic software written by >+ * Eric Young (eay@cryptsoft.com)" >+ * The word 'cryptographic' can be left out if the rouines from the library >+ * being used are not cryptographic related :-). >+ * 4. If you include any Windows specific code (or a derivative thereof) from >+ * the apps directory (application code) you must include an acknowledgement: >+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" >+ * >+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND >+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE >+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >+ * SUCH DAMAGE. >+ * >+ * The licence and distribution terms for any publically available version or >+ * derivative of this code cannot be changed. i.e. this code cannot simply be >+ * copied and put under another distribution licence >+ * [including the GNU Public Licence.] >+ */ >+ >+#ifndef HEADER_SHA_H >+#define HEADER_SHA_H >+ >+#ifdef __cplusplus >+extern "C" { >+#endif >+ >+#define SHA_CBLOCK 64 >+#define SHA_LBLOCK 16 >+#define SHA_BLOCK 16 >+#define SHA_LAST_BLOCK 56 >+#define SHA_LENGTH_BLOCK 8 >+#define SHA_DIGEST_LENGTH 20 >+ >+typedef struct SHAstate_st >+ { >+ unsigned long h0,h1,h2,h3,h4; >+ unsigned long Nl,Nh; >+ unsigned long data[SHA_LBLOCK]; >+ int num; >+ } SHA_CTX; >+ >+#ifndef NOPROTO >+void SHA_Init(SHA_CTX *c); >+void SHA_Update(SHA_CTX *c, unsigned char *data, unsigned long len); >+void SHA_Final(unsigned char *md, SHA_CTX *c); >+unsigned char *SHA(unsigned char *d, unsigned long n,unsigned char *md); >+void SHA_Transform(SHA_CTX *c, unsigned char *data); >+void SHA1_Init(SHA_CTX *c); >+void SHA1_Update(SHA_CTX *c, unsigned char *data, unsigned long len); >+void SHA1_Final(unsigned char *md, SHA_CTX *c); >+unsigned char *SHA1(unsigned char *d, unsigned long n,unsigned char *md); >+void SHA1_Transform(SHA_CTX *c, unsigned char *data); >+#else >+void SHA_Init(); >+void SHA_Update(); >+void SHA_Final(); >+unsigned char *SHA(); >+void SHA_Transform(); >+void SHA1_Init(); >+void SHA1_Update(); >+void SHA1_Final(); >+unsigned char *SHA1(); >+void SHA1_Transform(); >+#endif >+ >+#ifdef MMX_COEF >+extern int shammx(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+extern int shammx_nosizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+extern int shammx_noinit_uniformsizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+#endif >+ >+#ifdef __cplusplus >+} >+#endif >+ >+#endif >diff -ruN john-1.7.0.1/src/sha1-mmx.S john-1.7.0.1-banquise-to-bigpatch-18/src/sha1-mmx.S >--- john-1.7.0.1/src/sha1-mmx.S 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/sha1-mmx.S 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,561 @@ >+ >+// extern int mdfourmmx(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3))); >+ >+#include "arch.h" >+#ifdef UNDERSCORES >+#define shammx _shammx >+#endif >+ >+.globl shammx; >+.globl shammx_nosizeupdate; >+.globl shammx_noinit_uniformsizeupdate; >+ >+.data >+.align(8*MMX_COEF) >+const_init_a: >+.long 0x67452301 >+.long 0x67452301 >+#if (MMX_COEF>=4) >+.long 0x67452301 >+.long 0x67452301 >+#endif >+const_init_b: >+.long 0xefcdab89 >+.long 0xefcdab89 >+#if (MMX_COEF>=4) >+.long 0xefcdab89 >+.long 0xefcdab89 >+#endif >+const_init_c: >+.long 0x98badcfe >+.long 0x98badcfe >+#if (MMX_COEF>=4) >+.long 0x98badcfe >+.long 0x98badcfe >+#endif >+const_init_d: >+.long 0x10325476 >+.long 0x10325476 >+#if (MMX_COEF>=4) >+.long 0x10325476 >+.long 0x10325476 >+#endif >+const_init_e: >+.long 0xc3d2e1f0 >+.long 0xc3d2e1f0 >+#if (MMX_COEF>=4) >+.long 0xc3d2e1f0 >+.long 0xc3d2e1f0 >+#endif >+ >+.align(8*MMX_COEF) >+const_stage0: >+.long 0x5a827999 >+.long 0x5a827999 >+#if (MMX_COEF>=4) >+.long 0x5a827999 >+.long 0x5a827999 >+#endif >+const_stage1: >+.long 0x6ed9eba1 >+.long 0x6ed9eba1 >+#if (MMX_COEF>=4) >+.long 0x6ed9eba1 >+.long 0x6ed9eba1 >+#endif >+const_stage2: >+.long 0x8f1bbcdc >+.long 0x8f1bbcdc >+#if (MMX_COEF>=4) >+.long 0x8f1bbcdc >+.long 0x8f1bbcdc >+#endif >+const_stage3: >+.long 0xca62c1d6 >+.long 0xca62c1d6 >+#if (MMX_COEF>=4) >+.long 0xca62c1d6 >+.long 0xca62c1d6 >+#endif >+ >+.align(8*MMX_COEF) >+mask0f0f: >+.long 0x00ff00ff >+.long 0x00ff00ff >+#if (MMX_COEF>=4) >+.long 0x00ff00ff >+.long 0x00ff00ff >+#endif >+maskf0f0: >+.long 0xff00ff00 >+.long 0xff00ff00 >+#if (MMX_COEF>=4) >+.long 0xff00ff00 >+.long 0xff00ff00 >+#endif >+ >+#if (MMX_COEF == 2) >+#define MMXMOVE movq >+#define REGMM0 %mm0 >+#define REGMM1 %mm1 >+#define REGMM2 %mm2 >+#define REGMM3 %mm3 >+#define REGMM4 %mm4 >+#define REGMM5 %mm5 >+#define REGMM6 %mm6 >+#define REGMM7 %mm7 >+storea: ; .long 0 ; .long 0 >+storeb: ; .long 0 ; .long 0 >+storec: ; .long 0 ; .long 0 >+stored: ; .long 0 ; .long 0 >+storee: ; .long 0 ; .long 0 >+#else >+#define MMXMOVE movapd >+#define REGMM0 %xmm0 >+#define REGMM1 %xmm1 >+#define REGMM2 %xmm2 >+#define REGMM3 %xmm3 >+#define REGMM4 %xmm4 >+#define REGMM5 %xmm5 >+#define REGMM6 %xmm6 >+#define REGMM7 %xmm7 >+storea: ; .long 0 ; .long 0 ; .long 0 ; .long 0 >+storeb: ; .long 0 ; .long 0 ; .long 0 ; .long 0 >+storec: ; .long 0 ; .long 0 ; .long 0 ; .long 0 >+stored: ; .long 0 ; .long 0 ; .long 0 ; .long 0 >+storee: ; .long 0 ; .long 0 ; .long 0 ; .long 0 >+#endif >+ >+#define ctxa REGMM0 >+#define ctxb REGMM1 >+#define ctxc REGMM2 >+#define ctxd REGMM3 >+#define ctxe REGMM4 >+#define tmp1 REGMM5 >+#define tmp2 REGMM6 >+#define tmp3 REGMM7 >+ >+//ft(x,y,z) = (x AND y) OR ((NOT x) AND z) ( 0 <= t <= 19) >+#define F0(x,y,z) \ >+ MMXMOVE x, tmp2; \ >+ MMXMOVE x, tmp1; \ >+ pand y, tmp2; \ >+ pandn z, tmp1; \ >+ por tmp2, tmp1; >+ >+//ft(x,y,z) = x XOR y XOR z (20 <= t <= 39) >+#define F1(x,y,z) \ >+ MMXMOVE z, tmp1; \ >+ pxor y, tmp1; \ >+ pxor x, tmp1 >+ >+//ft(x,y,z) = (x AND y) OR (x AND z) OR (y AND z) (40 <= t <= 59) >+//ft(x,y,z) = (x AND y) | ((x OR y) AND z) (40 <= t <= 59) >+#define F2(x,y,z) \ >+ MMXMOVE x, tmp1; \ >+ MMXMOVE x, tmp2; \ >+ pand y, tmp1; \ >+ por y, tmp2; \ >+ pand z, tmp2; \ >+ por tmp2, tmp1; >+ >+//ft(x,y,z) = x XOR y XOR z (60 <= t <= 79). = la seconde >+ >+ >+#define expand(t) \ >+ MMXMOVE ((t-3)*4*MMX_COEF)(%edx), tmp1; \ >+ pxor ((t-8)*4*MMX_COEF)(%edx), tmp1; \ >+ pxor ((t-14)*4*MMX_COEF)(%edx), tmp1; \ >+ pxor ((t-16)*4*MMX_COEF)(%edx), tmp1; \ >+ MMXMOVE tmp1, tmp2; \ >+ pslld $1, tmp1; \ >+ psrld $31, tmp2; \ >+ por tmp2, tmp1; \ >+ MMXMOVE tmp1, (t*4*MMX_COEF)(%edx) >+ >+#define subRound(a, b, c, d, e, f, k, data) \ >+ f(b,c,d); \ >+ MMXMOVE a, tmp2; \ >+ MMXMOVE a, tmp3; \ >+ paddd tmp1, e; \ >+ pslld $5, tmp2; \ >+ psrld $27, tmp3; \ >+ por tmp3, tmp2; \ >+ paddd tmp2, e; \ >+ MMXMOVE b, tmp2; \ >+ pslld $30, b; \ >+ paddd k, e; \ >+ paddd (data*4*MMX_COEF)(%edx), e; \ >+ psrld $2, tmp2; \ >+ por tmp2, b; >+ >+#define subRoundu(a, b, c, d, e, f, k, data) \ >+ expand(data); \ >+ paddd tmp1, e; \ >+ f(b,c,d); \ >+ MMXMOVE a, tmp2; \ >+ MMXMOVE a, tmp3; \ >+ paddd tmp1, e; \ >+ pslld $5, tmp2; \ >+ psrld $27, tmp3; \ >+ por tmp3, tmp2; \ >+ paddd tmp2, e; \ >+ MMXMOVE b, tmp2; \ >+ pslld $30, b; \ >+ paddd k, e; \ >+ psrld $2, tmp2; \ >+ por tmp2, b; >+ >+.text >+/* >+ * Try to do some asm md4 w/ mmx >+ * %eax ptr -> out >+ * %edx ptr -> in (80*MMX_WIDTH mots) >+ * %ecx n >+ */ >+ >+init_ctx: >+ MMXMOVE const_init_a, ctxa >+ MMXMOVE const_init_b, ctxb >+ MMXMOVE const_init_c, ctxc >+ MMXMOVE const_init_d, ctxd >+ MMXMOVE const_init_e, ctxe >+ ret >+ >+sizeupdate: >+ //MD4 Init >+#if (MMX_COEF == 2) >+ shl $3, %ecx >+ mov %ecx, %ebx >+ and $0xffff, %ecx >+ shrl $16, %ebx >+ // %ecx contient la taille du premier mdp >+ // %edx celle du second >+ mov %ecx, (15*4*MMX_COEF)(%edx) >+ mov %ebx, (15*4*MMX_COEF+4)(%edx) >+#else >+ mov %ecx, %ebx >+ shr $8, %ecx >+ and $0xff, %ebx >+ shl $3, %ebx >+ mov %ebx, (15*16)(%edx) >+ >+ mov %ecx, %ebx >+ shr $8, %ecx >+ and $0xff, %ebx >+ shl $3, %ebx >+ mov %ebx, (15*16+4)(%edx) >+ >+ mov %ecx, %ebx >+ shr $8, %ecx >+ and $0xff, %ebx >+ shl $3, %ebx >+ mov %ebx, (15*16+8)(%edx) >+ >+ and $0xff, %ecx >+ shl $3, %ecx >+ mov %ecx, (15*16+12)(%edx) >+#endif >+ ret >+ >+ >+uniformsizeupdate: >+ shl $3, %ecx >+ mov %ecx, (14*4*MMX_COEF)(%edx) >+ mov %ecx, (14*4*MMX_COEF+4)(%edx) >+#if (MMX_COEF == 4) >+ mov %ecx, (14*4*MMX_COEF+8)(%edx) >+ mov %ecx, (14*4*MMX_COEF+12)(%edx) >+#endif >+ ret >+ >+ >+shammx_noinit_sizeupdate: >+ pusha >+ call sizeupdate >+ jmp shammx_noinit >+ >+shammx_noinit_uniformsizeupdate: >+ pusha >+ call uniformsizeupdate >+ jmp shammx_noinit >+ >+shammx: >+ pusha >+ call sizeupdate >+ call init_ctx >+ jmp shammx_noinit >+ >+shammx_nosizeupdate: >+ pusha >+ call init_ctx >+ jmp shammx_noinit >+ >+shammx_noinit: >+ MMXMOVE ctxa, storea >+ MMXMOVE ctxb, storeb >+ MMXMOVE ctxc, storec >+ MMXMOVE ctxd, stored >+ MMXMOVE ctxe, storee >+ >+round0: >+ prefetchnta (%edx) >+ subRound( ctxa, ctxb, ctxc, ctxd, ctxe, F0, const_stage0, 0 ); >+ subRound( ctxe, ctxa, ctxb, ctxc, ctxd, F0, const_stage0, 1 ); >+ subRound( ctxd, ctxe, ctxa, ctxb, ctxc, F0, const_stage0, 2 ); >+ subRound( ctxc, ctxd, ctxe, ctxa, ctxb, F0, const_stage0, 3 ); >+ subRound( ctxb, ctxc, ctxd, ctxe, ctxa, F0, const_stage0, 4 ); >+ subRound( ctxa, ctxb, ctxc, ctxd, ctxe, F0, const_stage0, 5 ); >+ subRound( ctxe, ctxa, ctxb, ctxc, ctxd, F0, const_stage0, 6 ); >+ subRound( ctxd, ctxe, ctxa, ctxb, ctxc, F0, const_stage0, 7 ); >+ subRound( ctxc, ctxd, ctxe, ctxa, ctxb, F0, const_stage0, 8 ); >+ subRound( ctxb, ctxc, ctxd, ctxe, ctxa, F0, const_stage0, 9 ); >+ subRound( ctxa, ctxb, ctxc, ctxd, ctxe, F0, const_stage0, 10 ); >+ subRound( ctxe, ctxa, ctxb, ctxc, ctxd, F0, const_stage0, 11 ); >+ subRound( ctxd, ctxe, ctxa, ctxb, ctxc, F0, const_stage0, 12 ); >+ subRound( ctxc, ctxd, ctxe, ctxa, ctxb, F0, const_stage0, 13 ); >+ subRound( ctxb, ctxc, ctxd, ctxe, ctxa, F0, const_stage0, 14 ); >+ subRound( ctxa, ctxb, ctxc, ctxd, ctxe, F0, const_stage0, 15 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F0, const_stage0, 16 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F0, const_stage0, 17 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F0, const_stage0, 18 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F0, const_stage0, 19 ); >+ >+round1: >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F1, const_stage1, 20 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F1, const_stage1, 21 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F1, const_stage1, 22 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F1, const_stage1, 23 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F1, const_stage1, 24 ); >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F1, const_stage1, 25 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F1, const_stage1, 26 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F1, const_stage1, 27 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F1, const_stage1, 28 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F1, const_stage1, 29 ); >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F1, const_stage1, 30 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F1, const_stage1, 31 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F1, const_stage1, 32 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F1, const_stage1, 33 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F1, const_stage1, 34 ); >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F1, const_stage1, 35 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F1, const_stage1, 36 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F1, const_stage1, 37 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F1, const_stage1, 38 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F1, const_stage1, 39 ); >+ >+round2: >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F2, const_stage2, 40 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F2, const_stage2, 41 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F2, const_stage2, 42 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F2, const_stage2, 43 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F2, const_stage2, 44 ); >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F2, const_stage2, 45 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F2, const_stage2, 46 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F2, const_stage2, 47 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F2, const_stage2, 48 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F2, const_stage2, 49 ); >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F2, const_stage2, 50 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F2, const_stage2, 51 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F2, const_stage2, 52 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F2, const_stage2, 53 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F2, const_stage2, 54 ); >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F2, const_stage2, 55 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F2, const_stage2, 56 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F2, const_stage2, 57 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F2, const_stage2, 58 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F2, const_stage2, 59 ); >+ >+round3: >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F1, const_stage3, 60 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F1, const_stage3, 61 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F1, const_stage3, 62 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F1, const_stage3, 63 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F1, const_stage3, 64 ); >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F1, const_stage3, 65 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F1, const_stage3, 66 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F1, const_stage3, 67 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F1, const_stage3, 68 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F1, const_stage3, 69 ); >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F1, const_stage3, 70 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F1, const_stage3, 71 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F1, const_stage3, 72 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F1, const_stage3, 73 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F1, const_stage3, 74 ); >+ subRoundu( ctxa, ctxb, ctxc, ctxd, ctxe, F1, const_stage3, 75 ); >+ subRoundu( ctxe, ctxa, ctxb, ctxc, ctxd, F1, const_stage3, 76 ); >+ subRoundu( ctxd, ctxe, ctxa, ctxb, ctxc, F1, const_stage3, 77 ); >+ subRoundu( ctxc, ctxd, ctxe, ctxa, ctxb, F1, const_stage3, 78 ); >+ subRoundu( ctxb, ctxc, ctxd, ctxe, ctxa, F1, const_stage3, 79 ); >+ >+ paddd storea, ctxa >+ paddd storeb, ctxb >+ paddd storec, ctxc >+ paddd stored, ctxd >+ paddd storee, ctxe >+ MMXMOVE ctxa, storea >+ MMXMOVE ctxb, storeb >+ MMXMOVE ctxc, storec >+ MMXMOVE ctxd, stored >+ MMXMOVE ctxe, storee >+ jmp endianity >+ >+endianity: >+ >+//reverse indianity w/ rotate & and >+//mmx has no rotate instructions .. >+#define ENDIAN(a) \ >+ MMXMOVE a, tmp1; \ >+ MMXMOVE maskf0f0, tmp3; \ >+ pand tmp3, a; \ >+ MMXMOVE mask0f0f, tmp3; \ >+ pand tmp3, tmp1; \ >+ psrld $8, a; \ >+ pslld $8, tmp1; \ >+ por tmp1, a; \ >+ MMXMOVE a, tmp1; \ >+ psrld $16, a; \ >+ pslld $16, tmp1; \ >+ por tmp1, a >+ >+// why is this so slow ? >+#define ENDIAN2(a) \ >+ pshuflw $177,a,a; \ >+ pshufhw $177,a,a; \ >+ movq a,tmp1; \ >+ pand maskf0f0, a; \ >+ pand mask0f0f, tmp1; \ >+ psrld $8, a; \ >+ pslld $8, tmp1; \ >+ por tmp1, a >+ >+//changes indianity ... >+ MMXMOVE maskf0f0, tmp3 >+ MMXMOVE ctxa, tmp1 >+ MMXMOVE ctxb, tmp2 >+ pand tmp3, ctxa >+ pand tmp3, ctxb >+ MMXMOVE mask0f0f, tmp3 >+ pand tmp3, tmp1 >+ pand tmp3, tmp2 >+ psrld $8, ctxa >+ psrld $8, ctxb >+ pslld $8, tmp1 >+ pslld $8, tmp2 >+ por tmp1, ctxa >+ por tmp2, ctxb >+ MMXMOVE ctxa, tmp1 >+ MMXMOVE ctxb, tmp2 >+ psrld $16, ctxa >+ psrld $16, ctxb >+ pslld $16, tmp1 >+ pslld $16, tmp2 >+ por tmp1, ctxa >+ por tmp2, ctxb >+ MMXMOVE ctxa, 0(%eax) >+ MMXMOVE ctxb, 4*MMX_COEF(%eax) >+ >+ >+//now 2 more register to play with .. >+#define tmp4 ctxa >+#define tmp5 ctxb >+ >+ MMXMOVE maskf0f0, tmp5 >+ MMXMOVE ctxc, tmp1 >+ MMXMOVE ctxd, tmp2 >+ MMXMOVE ctxe, tmp3 >+ pand tmp5, ctxc >+ pand tmp5, ctxd >+ pand tmp5, ctxe >+ MMXMOVE mask0f0f, tmp5 >+ pand tmp5, tmp1 >+ pand tmp5, tmp2 >+ pand tmp5, tmp3 >+ psrld $8, ctxc >+ psrld $8, ctxd >+ psrld $8, ctxe >+ pslld $8, tmp1 >+ pslld $8, tmp2 >+ pslld $8, tmp3 >+ por tmp1, ctxc >+ por tmp2, ctxd >+ por tmp3, ctxe >+ MMXMOVE ctxc, tmp1 >+ MMXMOVE ctxd, tmp2 >+ MMXMOVE ctxe, tmp3 >+ psrld $16, ctxc >+ psrld $16, ctxd >+ psrld $16, ctxe >+ pslld $16, tmp1 >+ pslld $16, tmp2 >+ pslld $16, tmp3 >+ por tmp1, ctxc >+ por tmp2, ctxd >+ por tmp3, ctxe >+ >+ MMXMOVE ctxc, 8*MMX_COEF(%eax) >+ MMXMOVE ctxd, 12*MMX_COEF(%eax) >+ MMXMOVE ctxe, 16*MMX_COEF(%eax) >+ >+ //mov %ecx, %eax >+ //movd ctxe, %eax >+ popa >+ emms >+ >+ ret >+ >+/* >+ alternate endianity conversion >+ shouldn't be so slow ... >+ pshuflw $177, ctxa, ctxa >+ pshuflw $177, ctxb, ctxb >+ pshuflw $177, ctxc, ctxc >+ pshuflw $177, ctxd, ctxd >+ pshuflw $177, ctxe, ctxe >+ movq maskf0f0, tmp3 >+ pshufhw $177, ctxa, ctxa >+ pshufhw $177, ctxb, ctxb >+ pshufhw $177, ctxc, ctxc >+ pshufhw $177, ctxd, ctxd >+ pshufhw $177, ctxe, ctxe >+ movq ctxa, tmp1 >+ movq ctxb, tmp2 >+ pand tmp3, ctxa >+ pand tmp3, ctxb >+ movq mask0f0f, tmp3 >+ pand tmp3, tmp1 >+ pand tmp3, tmp2 >+ psrld $8, ctxa >+ psrld $8, ctxb >+ pslld $8, tmp1 >+ pslld $8, tmp2 >+ por tmp1, ctxa >+ por tmp2, ctxb >+ MMXMOVE ctxa, 0(%eax) >+ MMXMOVE ctxb, 4*MMX_COEF(%eax) >+ >+//now 2 more register to play with .. >+#define tmp4 ctxa >+#define tmp5 ctxb >+ movq ctxc, tmp1 >+ movq ctxd, tmp2 >+ movq ctxe, tmp4 >+ pand tmp3, tmp1 >+ pand tmp3, tmp2 >+ pand tmp3, tmp4 >+ movq maskf0f0, tmp3 >+ pand tmp3, ctxc >+ pand tmp3, ctxd >+ pand tmp3, ctxe >+ psrld $8, ctxc >+ psrld $8, ctxd >+ psrld $8, ctxe >+ pslld $8, tmp1 >+ pslld $8, tmp2 >+ pslld $8, tmp4 >+ por tmp1, ctxc >+ por tmp2, ctxd >+ por tmp4, ctxe >+*/ >+#ifdef __ELF__ >+.section .note.GNU-stack,"",@progbits >+#endif >diff -ruN john-1.7.0.1/src/sha1.c john-1.7.0.1-banquise-to-bigpatch-18/src/sha1.c >--- john-1.7.0.1/src/sha1.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/sha1.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,467 @@ >+/* crypto/sha/sha1dgst.c */ >+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) >+ * All rights reserved. >+ * >+ * This package is an SSL implementation written >+ * by Eric Young (eay@cryptsoft.com). >+ * The implementation was written so as to conform with Netscapes SSL. >+ * >+ * This library is free for commercial and non-commercial use as long as >+ * the following conditions are aheared to. The following conditions >+ * apply to all code found in this distribution, be it the RC4, RSA, >+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation >+ * included with this distribution is covered by the same copyright terms >+ * except that the holder is Tim Hudson (tjh@cryptsoft.com). >+ * >+ * Copyright remains Eric Young's, and as such any Copyright notices in >+ * the code are not to be removed. >+ * If this package is used in a product, Eric Young should be given attribution >+ * as the author of the parts of the library used. >+ * This can be in the form of a textual message at program startup or >+ * in documentation (online or textual) provided with the package. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. All advertising materials mentioning features or use of this software >+ * must display the following acknowledgement: >+ * "This product includes cryptographic software written by >+ * Eric Young (eay@cryptsoft.com)" >+ * The word 'cryptographic' can be left out if the rouines from the library >+ * being used are not cryptographic related :-). >+ * 4. If you include any Windows specific code (or a derivative thereof) from >+ * the apps directory (application code) you must include an acknowledgement: >+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" >+ * >+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND >+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE >+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >+ * SUCH DAMAGE. >+ * >+ * The licence and distribution terms for any publically available version or >+ * derivative of this code cannot be changed. i.e. this code cannot simply be >+ * copied and put under another distribution licence >+ * [including the GNU Public Licence.] >+ */ >+ >+#include <stdio.h> >+#include <string.h> >+#undef SHA_0 >+#define SHA_1 >+#include "sha.h" >+#include "sha_locl.h" >+ >+char *SHA1_version="SHA1 part of SSLeay 0.8.2b 08-Jan-1998"; >+ >+/* Implemented from SHA-1 document - The Secure Hash Algorithm >+ */ >+ >+#define INIT_DATA_h0 (unsigned long)0x67452301L >+#define INIT_DATA_h1 (unsigned long)0xefcdab89L >+#define INIT_DATA_h2 (unsigned long)0x98badcfeL >+#define INIT_DATA_h3 (unsigned long)0x10325476L >+#define INIT_DATA_h4 (unsigned long)0xc3d2e1f0L >+ >+#define K_00_19 0x5a827999L >+#define K_20_39 0x6ed9eba1L >+#define K_40_59 0x8f1bbcdcL >+#define K_60_79 0xca62c1d6L >+ >+#ifndef NOPROTO >+# ifdef SHA1_ASM >+ void sha1_block_x86(SHA_CTX *c, register unsigned long *p, int num); >+# define sha1_block sha1_block_x86 >+# else >+ void sha1_block(SHA_CTX *c, register unsigned long *p, int num); >+# endif >+#else >+# ifdef SHA1_ASM >+ void sha1_block_x86(); >+# define sha1_block sha1_block_x86 >+# else >+ void sha1_block(); >+# endif >+#endif >+ >+#if defined(L_ENDIAN) && defined(SHA1_ASM) >+# define M_c2nl c2l >+# define M_p_c2nl p_c2l >+# define M_c2nl_p c2l_p >+# define M_p_c2nl_p p_c2l_p >+# define M_nl2c l2c >+#else >+# define M_c2nl c2nl >+# define M_p_c2nl p_c2nl >+# define M_c2nl_p c2nl_p >+# define M_p_c2nl_p p_c2nl_p >+# define M_nl2c nl2c >+#endif >+ >+void SHA1_Init(c) >+SHA_CTX *c; >+ { >+ c->h0=INIT_DATA_h0; >+ c->h1=INIT_DATA_h1; >+ c->h2=INIT_DATA_h2; >+ c->h3=INIT_DATA_h3; >+ c->h4=INIT_DATA_h4; >+ c->Nl=0; >+ c->Nh=0; >+ c->num=0; >+ } >+ >+void SHA1_Update(c, data, len) >+SHA_CTX *c; >+register unsigned char *data; >+unsigned long len; >+ { >+ register unsigned long *p; >+ int ew,ec,sw,sc; >+ unsigned long l; >+ >+ if (len == 0) return; >+ >+ l=(c->Nl+(len<<3))&0xffffffffL; >+ if (l < c->Nl) /* overflow */ >+ c->Nh++; >+ c->Nh+=(len>>29); >+ c->Nl=l; >+ >+ if (c->num != 0) >+ { >+ p=c->data; >+ sw=c->num>>2; >+ sc=c->num&0x03; >+ >+ if ((c->num+len) >= SHA_CBLOCK) >+ { >+ l= p[sw]; >+ M_p_c2nl(data,l,sc); >+ p[sw++]=l; >+ for (; sw<SHA_LBLOCK; sw++) >+ { >+ M_c2nl(data,l); >+ p[sw]=l; >+ } >+ len-=(SHA_CBLOCK-c->num); >+ >+ sha1_block(c,p,64); >+ c->num=0; >+ /* drop through and do the rest */ >+ } >+ else >+ { >+ c->num+=(int)len; >+ if ((sc+len) < 4) /* ugly, add char's to a word */ >+ { >+ l= p[sw]; >+ M_p_c2nl_p(data,l,sc,len); >+ p[sw]=l; >+ } >+ else >+ { >+ ew=(c->num>>2); >+ ec=(c->num&0x03); >+ l= p[sw]; >+ M_p_c2nl(data,l,sc); >+ p[sw++]=l; >+ for (; sw < ew; sw++) >+ { M_c2nl(data,l); p[sw]=l; } >+ if (ec) >+ { >+ M_c2nl_p(data,l,ec); >+ p[sw]=l; >+ } >+ } >+ return; >+ } >+ } >+ /* We can only do the following code for assember, the reason >+ * being that the sha1_block 'C' version changes the values >+ * in the 'data' array. The assember code avoids this and >+ * copies it to a local array. I should be able to do this for >+ * the C version as well.... >+ */ >+#if 1 >+#if defined(B_ENDIAN) || defined(SHA1_ASM) >+ if ((((unsigned int)data)%sizeof(unsigned long)) == 0) >+ { >+ sw=len/SHA_CBLOCK; >+ if (sw) >+ { >+ sw*=SHA_CBLOCK; >+ sha1_block(c,(unsigned long *)data,sw); >+ data+=sw; >+ len-=sw; >+ } >+ } >+#endif >+#endif >+ /* we now can process the input data in blocks of SHA_CBLOCK >+ * chars and save the leftovers to c->data. */ >+ p=c->data; >+ while (len >= SHA_CBLOCK) >+ { >+#if defined(B_ENDIAN) || defined(L_ENDIAN) >+ if (p != (unsigned long *)data) >+ memcpy(p,data,SHA_CBLOCK); >+ data+=SHA_CBLOCK; >+# ifdef L_ENDIAN >+# ifndef SHA1_ASM /* Will not happen */ >+ for (sw=(SHA_LBLOCK/4); sw; sw--) >+ { >+ Endian_Reverse32(p[0]); >+ Endian_Reverse32(p[1]); >+ Endian_Reverse32(p[2]); >+ Endian_Reverse32(p[3]); >+ p+=4; >+ } >+ p=c->data; >+# endif >+# endif >+#else >+ for (sw=(SHA_BLOCK/4); sw; sw--) >+ { >+ M_c2nl(data,l); *(p++)=l; >+ M_c2nl(data,l); *(p++)=l; >+ M_c2nl(data,l); *(p++)=l; >+ M_c2nl(data,l); *(p++)=l; >+ } >+ p=c->data; >+#endif >+ sha1_block(c,p,64); >+ len-=SHA_CBLOCK; >+ } >+ ec=(int)len; >+ c->num=ec; >+ ew=(ec>>2); >+ ec&=0x03; >+ >+ for (sw=0; sw < ew; sw++) >+ { M_c2nl(data,l); p[sw]=l; } >+ M_c2nl_p(data,l,ec); >+ p[sw]=l; >+ } >+ >+void SHA1_Transform(c,b) >+SHA_CTX *c; >+unsigned char *b; >+ { >+ unsigned long p[16]; >+#ifndef B_ENDIAN >+ unsigned long *q; >+ int i; >+#endif >+ >+#if defined(B_ENDIAN) || defined(L_ENDIAN) >+ memcpy(p,b,64); >+#ifdef L_ENDIAN >+ q=p; >+ for (i=(SHA_LBLOCK/4); i; i--) >+ { >+ Endian_Reverse32(q[0]); >+ Endian_Reverse32(q[1]); >+ Endian_Reverse32(q[2]); >+ Endian_Reverse32(q[3]); >+ q+=4; >+ } >+#endif >+#else >+ q=p; >+ for (i=(SHA_LBLOCK/4); i; i--) >+ { >+ unsigned long l; >+ c2nl(b,l); *(q++)=l; >+ c2nl(b,l); *(q++)=l; >+ c2nl(b,l); *(q++)=l; >+ c2nl(b,l); *(q++)=l; >+ } >+#endif >+ sha1_block(c,p,64); >+ } >+ >+#ifndef SHA1_ASM >+ >+void sha1_block(c, W, num) >+SHA_CTX *c; >+register unsigned long *W; >+int num; >+ { >+ register unsigned long A,B,C,D,E,T; >+ unsigned long X[16]; >+ >+ A=c->h0; >+ B=c->h1; >+ C=c->h2; >+ D=c->h3; >+ E=c->h4; >+ >+ for (;;) >+ { >+ BODY_00_15( 0,A,B,C,D,E,T,W); >+ BODY_00_15( 1,T,A,B,C,D,E,W); >+ BODY_00_15( 2,E,T,A,B,C,D,W); >+ BODY_00_15( 3,D,E,T,A,B,C,W); >+ BODY_00_15( 4,C,D,E,T,A,B,W); >+ BODY_00_15( 5,B,C,D,E,T,A,W); >+ BODY_00_15( 6,A,B,C,D,E,T,W); >+ BODY_00_15( 7,T,A,B,C,D,E,W); >+ BODY_00_15( 8,E,T,A,B,C,D,W); >+ BODY_00_15( 9,D,E,T,A,B,C,W); >+ BODY_00_15(10,C,D,E,T,A,B,W); >+ BODY_00_15(11,B,C,D,E,T,A,W); >+ BODY_00_15(12,A,B,C,D,E,T,W); >+ BODY_00_15(13,T,A,B,C,D,E,W); >+ BODY_00_15(14,E,T,A,B,C,D,W); >+ BODY_00_15(15,D,E,T,A,B,C,W); >+ BODY_16_19(16,C,D,E,T,A,B,W,W,W,W); >+ BODY_16_19(17,B,C,D,E,T,A,W,W,W,W); >+ BODY_16_19(18,A,B,C,D,E,T,W,W,W,W); >+ BODY_16_19(19,T,A,B,C,D,E,W,W,W,X); >+ >+ BODY_20_31(20,E,T,A,B,C,D,W,W,W,X); >+ BODY_20_31(21,D,E,T,A,B,C,W,W,W,X); >+ BODY_20_31(22,C,D,E,T,A,B,W,W,W,X); >+ BODY_20_31(23,B,C,D,E,T,A,W,W,W,X); >+ BODY_20_31(24,A,B,C,D,E,T,W,W,X,X); >+ BODY_20_31(25,T,A,B,C,D,E,W,W,X,X); >+ BODY_20_31(26,E,T,A,B,C,D,W,W,X,X); >+ BODY_20_31(27,D,E,T,A,B,C,W,W,X,X); >+ BODY_20_31(28,C,D,E,T,A,B,W,W,X,X); >+ BODY_20_31(29,B,C,D,E,T,A,W,W,X,X); >+ BODY_20_31(30,A,B,C,D,E,T,W,X,X,X); >+ BODY_20_31(31,T,A,B,C,D,E,W,X,X,X); >+ BODY_32_39(32,E,T,A,B,C,D,X); >+ BODY_32_39(33,D,E,T,A,B,C,X); >+ BODY_32_39(34,C,D,E,T,A,B,X); >+ BODY_32_39(35,B,C,D,E,T,A,X); >+ BODY_32_39(36,A,B,C,D,E,T,X); >+ BODY_32_39(37,T,A,B,C,D,E,X); >+ BODY_32_39(38,E,T,A,B,C,D,X); >+ BODY_32_39(39,D,E,T,A,B,C,X); >+ >+ BODY_40_59(40,C,D,E,T,A,B,X); >+ BODY_40_59(41,B,C,D,E,T,A,X); >+ BODY_40_59(42,A,B,C,D,E,T,X); >+ BODY_40_59(43,T,A,B,C,D,E,X); >+ BODY_40_59(44,E,T,A,B,C,D,X); >+ BODY_40_59(45,D,E,T,A,B,C,X); >+ BODY_40_59(46,C,D,E,T,A,B,X); >+ BODY_40_59(47,B,C,D,E,T,A,X); >+ BODY_40_59(48,A,B,C,D,E,T,X); >+ BODY_40_59(49,T,A,B,C,D,E,X); >+ BODY_40_59(50,E,T,A,B,C,D,X); >+ BODY_40_59(51,D,E,T,A,B,C,X); >+ BODY_40_59(52,C,D,E,T,A,B,X); >+ BODY_40_59(53,B,C,D,E,T,A,X); >+ BODY_40_59(54,A,B,C,D,E,T,X); >+ BODY_40_59(55,T,A,B,C,D,E,X); >+ BODY_40_59(56,E,T,A,B,C,D,X); >+ BODY_40_59(57,D,E,T,A,B,C,X); >+ BODY_40_59(58,C,D,E,T,A,B,X); >+ BODY_40_59(59,B,C,D,E,T,A,X); >+ >+ BODY_60_79(60,A,B,C,D,E,T,X); >+ BODY_60_79(61,T,A,B,C,D,E,X); >+ BODY_60_79(62,E,T,A,B,C,D,X); >+ BODY_60_79(63,D,E,T,A,B,C,X); >+ BODY_60_79(64,C,D,E,T,A,B,X); >+ BODY_60_79(65,B,C,D,E,T,A,X); >+ BODY_60_79(66,A,B,C,D,E,T,X); >+ BODY_60_79(67,T,A,B,C,D,E,X); >+ BODY_60_79(68,E,T,A,B,C,D,X); >+ BODY_60_79(69,D,E,T,A,B,C,X); >+ BODY_60_79(70,C,D,E,T,A,B,X); >+ BODY_60_79(71,B,C,D,E,T,A,X); >+ BODY_60_79(72,A,B,C,D,E,T,X); >+ BODY_60_79(73,T,A,B,C,D,E,X); >+ BODY_60_79(74,E,T,A,B,C,D,X); >+ BODY_60_79(75,D,E,T,A,B,C,X); >+ BODY_60_79(76,C,D,E,T,A,B,X); >+ BODY_60_79(77,B,C,D,E,T,A,X); >+ BODY_60_79(78,A,B,C,D,E,T,X); >+ BODY_60_79(79,T,A,B,C,D,E,X); >+ >+ c->h0=(c->h0+E)&0xffffffffL; >+ c->h1=(c->h1+T)&0xffffffffL; >+ c->h2=(c->h2+A)&0xffffffffL; >+ c->h3=(c->h3+B)&0xffffffffL; >+ c->h4=(c->h4+C)&0xffffffffL; >+ >+ num-=64; >+ if (num <= 0) break; >+ >+ A=c->h0; >+ B=c->h1; >+ C=c->h2; >+ D=c->h3; >+ E=c->h4; >+ >+ W+=16; >+ } >+ } >+#endif >+ >+void SHA1_Final(md, c) >+unsigned char *md; >+SHA_CTX *c; >+ { >+ register int i,j; >+ register unsigned long l; >+ register unsigned long *p; >+ static unsigned char end[4]={0x80,0x00,0x00,0x00}; >+ unsigned char *cp=end; >+ >+ /* c->num should definitly have room for at least one more byte. */ >+ p=c->data; >+ j=c->num; >+ i=j>>2; >+#ifdef PURIFY >+ if ((j&0x03) == 0) p[i]=0; >+#endif >+ l=p[i]; >+ M_p_c2nl(cp,l,j&0x03); >+ p[i]=l; >+ i++; >+ /* i is the next 'undefined word' */ >+ if (c->num >= SHA_LAST_BLOCK) >+ { >+ for (; i<SHA_LBLOCK; i++) >+ p[i]=0; >+ sha1_block(c,p,64); >+ i=0; >+ } >+ for (; i<(SHA_LBLOCK-2); i++) >+ p[i]=0; >+ p[SHA_LBLOCK-2]=c->Nh; >+ p[SHA_LBLOCK-1]=c->Nl; >+#if defined(L_ENDIAN) && defined(SHA1_ASM) >+ Endian_Reverse32(p[SHA_LBLOCK-2]); >+ Endian_Reverse32(p[SHA_LBLOCK-1]); >+#endif >+ sha1_block(c,p,64); >+ cp=md; >+ l=c->h0; nl2c(l,cp); >+ l=c->h1; nl2c(l,cp); >+ l=c->h2; nl2c(l,cp); >+ l=c->h3; nl2c(l,cp); >+ l=c->h4; nl2c(l,cp); >+ >+ /* clear stuff, sha1_block may be leaving some stuff on the stack >+ * but I'm not worried :-) */ >+ c->num=0; >+/* memset((char *)&c,0,sizeof(c));*/ >+ } >+ >diff -ruN john-1.7.0.1/src/sha_locl.h john-1.7.0.1-banquise-to-bigpatch-18/src/sha_locl.h >--- john-1.7.0.1/src/sha_locl.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/sha_locl.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,241 @@ >+/* crypto/sha/sha_locl.h */ >+/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) >+ * All rights reserved. >+ * >+ * This package is an SSL implementation written >+ * by Eric Young (eay@cryptsoft.com). >+ * The implementation was written so as to conform with Netscapes SSL. >+ * >+ * This library is free for commercial and non-commercial use as long as >+ * the following conditions are aheared to. The following conditions >+ * apply to all code found in this distribution, be it the RC4, RSA, >+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation >+ * included with this distribution is covered by the same copyright terms >+ * except that the holder is Tim Hudson (tjh@cryptsoft.com). >+ * >+ * Copyright remains Eric Young's, and as such any Copyright notices in >+ * the code are not to be removed. >+ * If this package is used in a product, Eric Young should be given attribution >+ * as the author of the parts of the library used. >+ * This can be in the form of a textual message at program startup or >+ * in documentation (online or textual) provided with the package. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. All advertising materials mentioning features or use of this software >+ * must display the following acknowledgement: >+ * "This product includes cryptographic software written by >+ * Eric Young (eay@cryptsoft.com)" >+ * The word 'cryptographic' can be left out if the rouines from the library >+ * being used are not cryptographic related :-). >+ * 4. If you include any Windows specific code (or a derivative thereof) from >+ * the apps directory (application code) you must include an acknowledgement: >+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" >+ * >+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND >+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE >+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >+ * SUCH DAMAGE. >+ * >+ * The licence and distribution terms for any publically available version or >+ * derivative of this code cannot be changed. i.e. this code cannot simply be >+ * copied and put under another distribution licence >+ * [including the GNU Public Licence.] >+ */ >+ >+#include <stdlib.h> >+#include <string.h> >+ >+#ifdef undef >+/* one or the other needs to be defined */ >+#ifndef SHA_1 /* FIPE 180-1 */ >+#define SHA_0 /* FIPS 180 */ >+#endif >+#endif >+ >+#ifdef NOCONST >+#define const >+#endif >+ >+#undef c2nl >+#define c2nl(c,l) (l =(((unsigned long)(*((c)++)))<<24), \ >+ l|=(((unsigned long)(*((c)++)))<<16), \ >+ l|=(((unsigned long)(*((c)++)))<< 8), \ >+ l|=(((unsigned long)(*((c)++))) )) >+ >+#undef p_c2nl >+#define p_c2nl(c,l,n) { \ >+ switch (n) { \ >+ case 0: l =((unsigned long)(*((c)++)))<<24; \ >+ case 1: l|=((unsigned long)(*((c)++)))<<16; \ >+ case 2: l|=((unsigned long)(*((c)++)))<< 8; \ >+ case 3: l|=((unsigned long)(*((c)++))); \ >+ } \ >+ } >+ >+#undef c2nl_p >+/* NOTE the pointer is not incremented at the end of this */ >+#define c2nl_p(c,l,n) { \ >+ l=0; \ >+ (c)+=n; \ >+ switch (n) { \ >+ case 3: l =((unsigned long)(*(--(c))))<< 8; \ >+ case 2: l|=((unsigned long)(*(--(c))))<<16; \ >+ case 1: l|=((unsigned long)(*(--(c))))<<24; \ >+ } \ >+ } >+ >+#undef p_c2nl_p >+#define p_c2nl_p(c,l,sc,len) { \ >+ switch (sc) \ >+ { \ >+ case 0: l =((unsigned long)(*((c)++)))<<24; \ >+ if (--len == 0) break; \ >+ case 1: l|=((unsigned long)(*((c)++)))<<16; \ >+ if (--len == 0) break; \ >+ case 2: l|=((unsigned long)(*((c)++)))<< 8; \ >+ } \ >+ } >+ >+#undef nl2c >+#define nl2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ >+ *((c)++)=(unsigned char)(((l)>>16)&0xff), \ >+ *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ >+ *((c)++)=(unsigned char)(((l) )&0xff)) >+ >+#undef c2l >+#define c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \ >+ l|=(((unsigned long)(*((c)++)))<< 8), \ >+ l|=(((unsigned long)(*((c)++)))<<16), \ >+ l|=(((unsigned long)(*((c)++)))<<24)) >+ >+#undef p_c2l >+#define p_c2l(c,l,n) { \ >+ switch (n) { \ >+ case 0: l =((unsigned long)(*((c)++))); \ >+ case 1: l|=((unsigned long)(*((c)++)))<< 8; \ >+ case 2: l|=((unsigned long)(*((c)++)))<<16; \ >+ case 3: l|=((unsigned long)(*((c)++)))<<24; \ >+ } \ >+ } >+ >+#undef c2l_p >+/* NOTE the pointer is not incremented at the end of this */ >+#define c2l_p(c,l,n) { \ >+ l=0; \ >+ (c)+=n; \ >+ switch (n) { \ >+ case 3: l =((unsigned long)(*(--(c))))<<16; \ >+ case 2: l|=((unsigned long)(*(--(c))))<< 8; \ >+ case 1: l|=((unsigned long)(*(--(c)))); \ >+ } \ >+ } >+ >+#undef p_c2l_p >+#define p_c2l_p(c,l,sc,len) { \ >+ switch (sc) \ >+ { \ >+ case 0: l =((unsigned long)(*((c)++))); \ >+ if (--len == 0) break; \ >+ case 1: l|=((unsigned long)(*((c)++)))<< 8; \ >+ if (--len == 0) break; \ >+ case 2: l|=((unsigned long)(*((c)++)))<<16; \ >+ } \ >+ } >+ >+#undef l2c >+#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ >+ *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ >+ *((c)++)=(unsigned char)(((l)>>16)&0xff), \ >+ *((c)++)=(unsigned char)(((l)>>24)&0xff)) >+ >+#undef ROTATE >+#if defined(WIN32) >+#define ROTATE(a,n) _lrotl(a,n) >+#else >+#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) >+#endif >+ >+/* A nice byte order reversal from Wei Dai <weidai@eskimo.com> */ >+#if defined(WIN32) >+/* 5 instructions with rotate instruction, else 9 */ >+#define Endian_Reverse32(a) \ >+ { \ >+ unsigned long l=(a); \ >+ (a)=((ROTATE(l,8)&0x00FF00FF)|(ROTATE(l,24)&0xFF00FF00)); \ >+ } >+#else >+/* 6 instructions with rotate instruction, else 8 */ >+#define Endian_Reverse32(a) \ >+ { \ >+ unsigned long l=(a); \ >+ l=(((l&0xFF00FF00)>>8L)|((l&0x00FF00FF)<<8L)); \ >+ (a)=ROTATE(l,16L); \ >+ } >+#endif >+ >+/* As pointed out by Wei Dai <weidai@eskimo.com>, F() below can be >+ * simplified to the code in F_00_19. Wei attributes these optimisations >+ * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. >+ * #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) >+ * I've just become aware of another tweak to be made, again from Wei Dai, >+ * in F_40_59, (x&a)|(y&a) -> (x|y)&a >+ */ >+#define F_00_19(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) >+#define F_20_39(b,c,d) ((b) ^ (c) ^ (d)) >+#define F_40_59(b,c,d) (((b) & (c)) | (((b)|(c)) & (d))) >+#define F_60_79(b,c,d) F_20_39(b,c,d) >+ >+#ifdef SHA_0 >+#undef Xupdate >+#define Xupdate(a,i,ia,ib,ic,id) X[(i)&0x0f]=(a)=\ >+ (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]); >+#endif >+#ifdef SHA_1 >+#undef Xupdate >+#define Xupdate(a,i,ia,ib,ic,id) (a)=\ >+ (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]);\ >+ X[(i)&0x0f]=(a)=ROTATE((a),1); >+#endif >+ >+#define BODY_00_15(i,a,b,c,d,e,f,xa) \ >+ (f)=xa[i]+(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ >+ (b)=ROTATE((b),30); >+ >+#define BODY_16_19(i,a,b,c,d,e,f,xa,xb,xc,xd) \ >+ Xupdate(f,i,xa,xb,xc,xd); \ >+ (f)+=(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ >+ (b)=ROTATE((b),30); >+ >+#define BODY_20_31(i,a,b,c,d,e,f,xa,xb,xc,xd) \ >+ Xupdate(f,i,xa,xb,xc,xd); \ >+ (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ >+ (b)=ROTATE((b),30); >+ >+#define BODY_32_39(i,a,b,c,d,e,f,xa) \ >+ Xupdate(f,i,xa,xa,xa,xa); \ >+ (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ >+ (b)=ROTATE((b),30); >+ >+#define BODY_40_59(i,a,b,c,d,e,f,xa) \ >+ Xupdate(f,i,xa,xa,xa,xa); \ >+ (f)+=(e)+K_40_59+ROTATE((a),5)+F_40_59((b),(c),(d)); \ >+ (b)=ROTATE((b),30); >+ >+#define BODY_60_79(i,a,b,c,d,e,f,xa) \ >+ Xupdate(f,i,xa,xa,xa,xa); \ >+ (f)=X[(i)&0x0f]+(e)+K_60_79+ROTATE((a),5)+F_60_79((b),(c),(d)); \ >+ (b)=ROTATE((b),30); >diff -ruN john-1.7.0.1/src/smbencrypt.c john-1.7.0.1-banquise-to-bigpatch-18/src/smbencrypt.c >--- john-1.7.0.1/src/smbencrypt.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/smbencrypt.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,94 @@ >+/* >+ Unix SMB/Netbios implementation. >+ Version 1.9. >+ SMB parameters and setup >+ Copyright (C) Andrew Tridgell 1992-1998 >+ Modified by Jeremy Allison 1995. >+ >+ This program is free software; you can redistribute it and/or modify >+ it under the terms of the GNU General Public License as published by >+ the Free Software Foundation; either version 2 of the License, or >+ (at your option) any later version. >+ >+ This program is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ GNU General Public License for more details. >+ >+ You should have received a copy of the GNU General Public License >+ along with this program; if not, write to the Free Software >+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. >+*/ >+ >+ >+#include <sys/types.h> >+#include <string.h> >+#include "arch.h" >+ >+#ifndef uchar >+#define uchar unsigned char >+#endif >+ >+#if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H) >+#if (SIZEOF_SHORT == 4) >+#define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16; >+#else /* SIZEOF_SHORT != 4 */ >+#define uint16 unsigned short >+#endif /* SIZEOF_SHORT != 4 */ >+#endif >+ >+#if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H) >+#if (SIZEOF_SHORT == 4) >+#define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16; >+#else /* SIZEOF_SHORT != 4 */ >+#define int16 short >+#endif /* SIZEOF_SHORT != 4 */ >+#endif >+ >+#include "byteorder.h" >+ >+extern void mdfour(unsigned char *out, unsigned char *in, int n); >+ >+/* >+ * Convert a string into an NT UNICODE string. >+ * Note that regardless of processor type >+ * this must be in intel (little-endian) >+ * format. >+ */ >+ >+int _my_mbstowcs(int16 *dst, uchar *src, int len) >+{ >+ int i; >+ >+ for(i = 0; i < len; i++) { >+#if ARCH_LITTLE_ENDIAN >+ dst[i] = src[i]; >+#else >+ dst[i] = src[i] << 8; >+#endif >+ } >+ return i; >+} >+ >+/* >+ * Creates the MD4 Hash of the users password in NT UNICODE. >+ */ >+ >+void E_md4hash(uchar *passwd, uchar *p16) >+{ >+ int len; >+ int16 wpwd[129]; >+ >+ /* Password cannot be longer than 128 characters */ >+ len = strlen((char *)passwd); >+ if(len > 128) >+ len = 128; >+ /* Password must be converted to NT unicode */ >+ _my_mbstowcs(wpwd, passwd, len); >+ wpwd[len] = 0; /* Ensure string is null terminated */ >+ /* Calculate length in bytes */ >+ //len = _my_wcslen(wpwd) * sizeof(int16); >+ >+ mdfour(p16, (unsigned char *)wpwd, len*2); >+} >+ >diff -ruN john-1.7.0.1/src/sparc.S john-1.7.0.1-banquise-to-bigpatch-18/src/sparc.S >--- john-1.7.0.1/src/sparc.S 2001-01-24 19:24:09.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/sparc.S 2006-03-16 04:55:30.000000000 +0000 >@@ -410,3 +410,6 @@ > .common DES_KS_table, (8 * 128 * 16 * 8), 32 > > #endif >+#ifdef __ELF__ >+.section .note.GNU-stack,"",@progbits >+#endif >diff -ruN john-1.7.0.1/src/stages_mmx_md5.S john-1.7.0.1-banquise-to-bigpatch-18/src/stages_mmx_md5.S >--- john-1.7.0.1/src/stages_mmx_md5.S 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/stages_mmx_md5.S 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,192 @@ >+const_stage_1: >+.long 0xd76aa478 >+.long 0xd76aa478 >+const_stage_2: >+.long 0xe8c7b756 >+.long 0xe8c7b756 >+const_stage_3: >+.long 0x242070db >+.long 0x242070db >+const_stage_4: >+.long 0xc1bdceee >+.long 0xc1bdceee >+const_stage_5: >+.long 0xf57c0faf >+.long 0xf57c0faf >+const_stage_6: >+.long 0x4787c62a >+.long 0x4787c62a >+const_stage_7: >+.long 0xa8304613 >+.long 0xa8304613 >+const_stage_8: >+.long 0xfd469501 >+.long 0xfd469501 >+const_stage_9: >+.long 0x698098d8 >+.long 0x698098d8 >+const_stage_10: >+.long 0x8b44f7af >+.long 0x8b44f7af >+const_stage_11: >+.long 0xffff5bb1 >+.long 0xffff5bb1 >+const_stage_12: >+.long 0x895cd7be >+.long 0x895cd7be >+const_stage_13: >+.long 0x6b901122 >+.long 0x6b901122 >+const_stage_14: >+.long 0xfd987193 >+.long 0xfd987193 >+const_stage_15: >+.long 0xa679438e >+.long 0xa679438e >+const_stage_16: >+.long 0x49b40821 >+.long 0x49b40821 >+const_stage_17: >+.long 0xf61e2562 >+.long 0xf61e2562 >+const_stage_18: >+.long 0xc040b340 >+.long 0xc040b340 >+const_stage_19: >+.long 0x265e5a51 >+.long 0x265e5a51 >+const_stage_20: >+.long 0xe9b6c7aa >+.long 0xe9b6c7aa >+const_stage_21: >+.long 0xd62f105d >+.long 0xd62f105d >+const_stage_22: >+.long 0x02441453 >+.long 0x02441453 >+const_stage_23: >+.long 0xd8a1e681 >+.long 0xd8a1e681 >+const_stage_24: >+.long 0xe7d3fbc8 >+.long 0xe7d3fbc8 >+const_stage_25: >+.long 0x21e1cde6 >+.long 0x21e1cde6 >+const_stage_26: >+.long 0xc33707d6 >+.long 0xc33707d6 >+const_stage_27: >+.long 0xf4d50d87 >+.long 0xf4d50d87 >+const_stage_28: >+.long 0x455a14ed >+.long 0x455a14ed >+const_stage_29: >+.long 0xa9e3e905 >+.long 0xa9e3e905 >+const_stage_30: >+.long 0xfcefa3f8 >+.long 0xfcefa3f8 >+const_stage_31: >+.long 0x676f02d9 >+.long 0x676f02d9 >+const_stage_32: >+.long 0x8d2a4c8a >+.long 0x8d2a4c8a >+const_stage_33: >+.long 0xfffa3942 >+.long 0xfffa3942 >+const_stage_34: >+.long 0x8771f681 >+.long 0x8771f681 >+const_stage_35: >+.long 0x6d9d6122 >+.long 0x6d9d6122 >+const_stage_36: >+.long 0xfde5380c >+.long 0xfde5380c >+const_stage_37: >+.long 0xa4beea44 >+.long 0xa4beea44 >+const_stage_38: >+.long 0x4bdecfa9 >+.long 0x4bdecfa9 >+const_stage_39: >+.long 0xf6bb4b60 >+.long 0xf6bb4b60 >+const_stage_40: >+.long 0xbebfbc70 >+.long 0xbebfbc70 >+const_stage_41: >+.long 0x289b7ec6 >+.long 0x289b7ec6 >+const_stage_42: >+.long 0xeaa127fa >+.long 0xeaa127fa >+const_stage_43: >+.long 0xd4ef3085 >+.long 0xd4ef3085 >+const_stage_44: >+.long 0x04881d05 >+.long 0x04881d05 >+const_stage_45: >+.long 0xd9d4d039 >+.long 0xd9d4d039 >+const_stage_46: >+.long 0xe6db99e5 >+.long 0xe6db99e5 >+const_stage_47: >+.long 0x1fa27cf8 >+.long 0x1fa27cf8 >+const_stage_48: >+.long 0xc4ac5665 >+.long 0xc4ac5665 >+const_stage_49: >+.long 0xf4292244 >+.long 0xf4292244 >+const_stage_50: >+.long 0x432aff97 >+.long 0x432aff97 >+const_stage_51: >+.long 0xab9423a7 >+.long 0xab9423a7 >+const_stage_52: >+.long 0xfc93a039 >+.long 0xfc93a039 >+const_stage_53: >+.long 0x655b59c3 >+.long 0x655b59c3 >+const_stage_54: >+.long 0x8f0ccc92 >+.long 0x8f0ccc92 >+const_stage_55: >+.long 0xffeff47d >+.long 0xffeff47d >+const_stage_56: >+.long 0x85845dd1 >+.long 0x85845dd1 >+const_stage_57: >+.long 0x6fa87e4f >+.long 0x6fa87e4f >+const_stage_58: >+.long 0xfe2ce6e0 >+.long 0xfe2ce6e0 >+const_stage_59: >+.long 0xa3014314 >+.long 0xa3014314 >+const_stage_60: >+.long 0x4e0811a1 >+.long 0x4e0811a1 >+const_stage_61: >+.long 0xf7537e82 >+.long 0xf7537e82 >+const_stage_62: >+.long 0xbd3af235 >+.long 0xbd3af235 >+const_stage_63: >+.long 0x2ad7d2bb >+.long 0x2ad7d2bb >+const_stage_64: >+.long 0xeb86d391 >+.long 0xeb86d391 >diff -ruN john-1.7.0.1/src/stages_sse2_md5.S john-1.7.0.1-banquise-to-bigpatch-18/src/stages_sse2_md5.S >--- john-1.7.0.1/src/stages_sse2_md5.S 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/stages_sse2_md5.S 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,320 @@ >+const_stage_1: >+.long 0xd76aa478 >+.long 0xd76aa478 >+.long 0xd76aa478 >+.long 0xd76aa478 >+const_stage_2: >+.long 0xe8c7b756 >+.long 0xe8c7b756 >+.long 0xe8c7b756 >+.long 0xe8c7b756 >+const_stage_3: >+.long 0x242070db >+.long 0x242070db >+.long 0x242070db >+.long 0x242070db >+const_stage_4: >+.long 0xc1bdceee >+.long 0xc1bdceee >+.long 0xc1bdceee >+.long 0xc1bdceee >+const_stage_5: >+.long 0xf57c0faf >+.long 0xf57c0faf >+.long 0xf57c0faf >+.long 0xf57c0faf >+const_stage_6: >+.long 0x4787c62a >+.long 0x4787c62a >+.long 0x4787c62a >+.long 0x4787c62a >+const_stage_7: >+.long 0xa8304613 >+.long 0xa8304613 >+.long 0xa8304613 >+.long 0xa8304613 >+const_stage_8: >+.long 0xfd469501 >+.long 0xfd469501 >+.long 0xfd469501 >+.long 0xfd469501 >+const_stage_9: >+.long 0x698098d8 >+.long 0x698098d8 >+.long 0x698098d8 >+.long 0x698098d8 >+const_stage_10: >+.long 0x8b44f7af >+.long 0x8b44f7af >+.long 0x8b44f7af >+.long 0x8b44f7af >+const_stage_11: >+.long 0xffff5bb1 >+.long 0xffff5bb1 >+.long 0xffff5bb1 >+.long 0xffff5bb1 >+const_stage_12: >+.long 0x895cd7be >+.long 0x895cd7be >+.long 0x895cd7be >+.long 0x895cd7be >+const_stage_13: >+.long 0x6b901122 >+.long 0x6b901122 >+.long 0x6b901122 >+.long 0x6b901122 >+const_stage_14: >+.long 0xfd987193 >+.long 0xfd987193 >+.long 0xfd987193 >+.long 0xfd987193 >+const_stage_15: >+.long 0xa679438e >+.long 0xa679438e >+.long 0xa679438e >+.long 0xa679438e >+const_stage_16: >+.long 0x49b40821 >+.long 0x49b40821 >+.long 0x49b40821 >+.long 0x49b40821 >+const_stage_17: >+.long 0xf61e2562 >+.long 0xf61e2562 >+.long 0xf61e2562 >+.long 0xf61e2562 >+const_stage_18: >+.long 0xc040b340 >+.long 0xc040b340 >+.long 0xc040b340 >+.long 0xc040b340 >+const_stage_19: >+.long 0x265e5a51 >+.long 0x265e5a51 >+.long 0x265e5a51 >+.long 0x265e5a51 >+const_stage_20: >+.long 0xe9b6c7aa >+.long 0xe9b6c7aa >+.long 0xe9b6c7aa >+.long 0xe9b6c7aa >+const_stage_21: >+.long 0xd62f105d >+.long 0xd62f105d >+.long 0xd62f105d >+.long 0xd62f105d >+const_stage_22: >+.long 0x02441453 >+.long 0x02441453 >+.long 0x02441453 >+.long 0x02441453 >+const_stage_23: >+.long 0xd8a1e681 >+.long 0xd8a1e681 >+.long 0xd8a1e681 >+.long 0xd8a1e681 >+const_stage_24: >+.long 0xe7d3fbc8 >+.long 0xe7d3fbc8 >+.long 0xe7d3fbc8 >+.long 0xe7d3fbc8 >+const_stage_25: >+.long 0x21e1cde6 >+.long 0x21e1cde6 >+.long 0x21e1cde6 >+.long 0x21e1cde6 >+const_stage_26: >+.long 0xc33707d6 >+.long 0xc33707d6 >+.long 0xc33707d6 >+.long 0xc33707d6 >+const_stage_27: >+.long 0xf4d50d87 >+.long 0xf4d50d87 >+.long 0xf4d50d87 >+.long 0xf4d50d87 >+const_stage_28: >+.long 0x455a14ed >+.long 0x455a14ed >+.long 0x455a14ed >+.long 0x455a14ed >+const_stage_29: >+.long 0xa9e3e905 >+.long 0xa9e3e905 >+.long 0xa9e3e905 >+.long 0xa9e3e905 >+const_stage_30: >+.long 0xfcefa3f8 >+.long 0xfcefa3f8 >+.long 0xfcefa3f8 >+.long 0xfcefa3f8 >+const_stage_31: >+.long 0x676f02d9 >+.long 0x676f02d9 >+.long 0x676f02d9 >+.long 0x676f02d9 >+const_stage_32: >+.long 0x8d2a4c8a >+.long 0x8d2a4c8a >+.long 0x8d2a4c8a >+.long 0x8d2a4c8a >+const_stage_33: >+.long 0xfffa3942 >+.long 0xfffa3942 >+.long 0xfffa3942 >+.long 0xfffa3942 >+const_stage_34: >+.long 0x8771f681 >+.long 0x8771f681 >+.long 0x8771f681 >+.long 0x8771f681 >+const_stage_35: >+.long 0x6d9d6122 >+.long 0x6d9d6122 >+.long 0x6d9d6122 >+.long 0x6d9d6122 >+const_stage_36: >+.long 0xfde5380c >+.long 0xfde5380c >+.long 0xfde5380c >+.long 0xfde5380c >+const_stage_37: >+.long 0xa4beea44 >+.long 0xa4beea44 >+.long 0xa4beea44 >+.long 0xa4beea44 >+const_stage_38: >+.long 0x4bdecfa9 >+.long 0x4bdecfa9 >+.long 0x4bdecfa9 >+.long 0x4bdecfa9 >+const_stage_39: >+.long 0xf6bb4b60 >+.long 0xf6bb4b60 >+.long 0xf6bb4b60 >+.long 0xf6bb4b60 >+const_stage_40: >+.long 0xbebfbc70 >+.long 0xbebfbc70 >+.long 0xbebfbc70 >+.long 0xbebfbc70 >+const_stage_41: >+.long 0x289b7ec6 >+.long 0x289b7ec6 >+.long 0x289b7ec6 >+.long 0x289b7ec6 >+const_stage_42: >+.long 0xeaa127fa >+.long 0xeaa127fa >+.long 0xeaa127fa >+.long 0xeaa127fa >+const_stage_43: >+.long 0xd4ef3085 >+.long 0xd4ef3085 >+.long 0xd4ef3085 >+.long 0xd4ef3085 >+const_stage_44: >+.long 0x04881d05 >+.long 0x04881d05 >+.long 0x04881d05 >+.long 0x04881d05 >+const_stage_45: >+.long 0xd9d4d039 >+.long 0xd9d4d039 >+.long 0xd9d4d039 >+.long 0xd9d4d039 >+const_stage_46: >+.long 0xe6db99e5 >+.long 0xe6db99e5 >+.long 0xe6db99e5 >+.long 0xe6db99e5 >+const_stage_47: >+.long 0x1fa27cf8 >+.long 0x1fa27cf8 >+.long 0x1fa27cf8 >+.long 0x1fa27cf8 >+const_stage_48: >+.long 0xc4ac5665 >+.long 0xc4ac5665 >+.long 0xc4ac5665 >+.long 0xc4ac5665 >+const_stage_49: >+.long 0xf4292244 >+.long 0xf4292244 >+.long 0xf4292244 >+.long 0xf4292244 >+const_stage_50: >+.long 0x432aff97 >+.long 0x432aff97 >+.long 0x432aff97 >+.long 0x432aff97 >+const_stage_51: >+.long 0xab9423a7 >+.long 0xab9423a7 >+.long 0xab9423a7 >+.long 0xab9423a7 >+const_stage_52: >+.long 0xfc93a039 >+.long 0xfc93a039 >+.long 0xfc93a039 >+.long 0xfc93a039 >+const_stage_53: >+.long 0x655b59c3 >+.long 0x655b59c3 >+.long 0x655b59c3 >+.long 0x655b59c3 >+const_stage_54: >+.long 0x8f0ccc92 >+.long 0x8f0ccc92 >+.long 0x8f0ccc92 >+.long 0x8f0ccc92 >+const_stage_55: >+.long 0xffeff47d >+.long 0xffeff47d >+.long 0xffeff47d >+.long 0xffeff47d >+const_stage_56: >+.long 0x85845dd1 >+.long 0x85845dd1 >+.long 0x85845dd1 >+.long 0x85845dd1 >+const_stage_57: >+.long 0x6fa87e4f >+.long 0x6fa87e4f >+.long 0x6fa87e4f >+.long 0x6fa87e4f >+const_stage_58: >+.long 0xfe2ce6e0 >+.long 0xfe2ce6e0 >+.long 0xfe2ce6e0 >+.long 0xfe2ce6e0 >+const_stage_59: >+.long 0xa3014314 >+.long 0xa3014314 >+.long 0xa3014314 >+.long 0xa3014314 >+const_stage_60: >+.long 0x4e0811a1 >+.long 0x4e0811a1 >+.long 0x4e0811a1 >+.long 0x4e0811a1 >+const_stage_61: >+.long 0xf7537e82 >+.long 0xf7537e82 >+.long 0xf7537e82 >+.long 0xf7537e82 >+const_stage_62: >+.long 0xbd3af235 >+.long 0xbd3af235 >+.long 0xbd3af235 >+.long 0xbd3af235 >+const_stage_63: >+.long 0x2ad7d2bb >+.long 0x2ad7d2bb >+.long 0x2ad7d2bb >+.long 0x2ad7d2bb >+const_stage_64: >+.long 0xeb86d391 >+.long 0xeb86d391 >+.long 0xeb86d391 >+.long 0xeb86d391 >diff -ruN john-1.7.0.1/src/undrop.c john-1.7.0.1-banquise-to-bigpatch-18/src/undrop.c >--- john-1.7.0.1/src/undrop.c 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/undrop.c 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,73 @@ >+/* >+ * Eggdrop userfile converter >+ * Copyright (c) 2002 by Sun-Zero <sun-zero@freemail.hu> >+ * This is a free software distributable under terms of the GNU GPL. >+ * See the file COPYING for details. >+ * >+ * 2003-04-21 >+*/ >+ >+#include <stdio.h> >+#include <string.h> >+#include <unistd.h> >+ >+ >+#define USERFILE_HEADER "#4v:" >+#define USERNAME_LENGTH 11 >+#define PASSWORD_LENGTH 13 >+#define MAX_FLAGS_LENGTH 32 >+#define BUFSIZE 512 >+ >+int undrop(int argc, char *argv[]) { >+ >+ FILE *userfile; >+ char username[USERNAME_LENGTH]; >+ char password[PASSWORD_LENGTH]; >+ char flags[MAX_FLAGS_LENGTH]; >+ char t_username[BUFSIZE]; >+ char t_flags[BUFSIZE]; >+ char t_line[BUFSIZE]; >+ >+ if (argc != 2) { >+ userfile = stdin; >+ printf("# userfile reading from stdin\n"); >+ } else { >+ if ((userfile = fopen(argv[1], "rt")) == NULL) { >+ fprintf(stderr, "opening userfile\n"); >+ userfile = stdin; >+ } >+ } >+ >+ >+ if (fgets(t_line, sizeof(t_line) - 1, userfile) == NULL) >+ return 1; >+ >+ if (strncmp(t_line, USERFILE_HEADER, strlen(USERFILE_HEADER)) != 0) { >+ fprintf(stderr, "usefile format is wrong\n"); >+ return 1; >+ } else { >+ printf("# userfile format OK\n\n"); >+ } >+ >+ while (fgets(t_line, sizeof(t_line) - 1, userfile) != NULL) { >+ if (sscanf(t_line, "%10s - %24s\n", t_username, t_flags) == 2) { >+ if (strncmp(t_username, "! ", 2) != 0 && >+ strncmp(t_username, "--", 2) != 0 && >+ strncmp(t_username, "&&", 2) != 0 && >+ strncmp(t_username, "::", 2) != 0 && >+ strncmp(t_username, "$$", 2) != 0 >+ ) { >+ strncpy(username, t_username, USERNAME_LENGTH); >+ strncpy(flags, t_flags, MAX_FLAGS_LENGTH); >+ } >+ } >+ >+ if (strncmp(t_line, "--PASS +", 8) == 0) { >+ sscanf(t_line, "--PASS %s", password); >+ printf("%s:%s:::%s:\n", username, password, flags); >+ } >+ fflush(stdout); >+ } >+ fclose(userfile); >+ return 0; >+} >diff -ruN john-1.7.0.1/src/x86-mmx.S john-1.7.0.1-banquise-to-bigpatch-18/src/x86-mmx.S >--- john-1.7.0.1/src/x86-mmx.S 2005-09-01 16:03:24.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/x86-mmx.S 2006-03-16 04:59:19.000000000 +0000 >@@ -2,7 +2,7 @@ > * This file is part of John the Ripper password cracker, > * Copyright (c) 2000-2001,2005 by Solar Designer and others: > * >- * The MMX DES S-box code is by Bruce Ford and Rémi Guyomarch, originally >+ * The MMX DES S-box code is by Bruce Ford and R�i Guyomarch, originally > * for use in the distributed.net clients, included here with permission. > * Only minor modifications have been made to their S-box code. Optimized > * S-box expressions are based on work by Matthew Kwan (see nonstd.c). >@@ -1309,3 +1309,6 @@ > emms > #endif > ret >+#ifdef __ELF__ >+.section .note.GNU-stack,"",@progbits >+#endif >diff -ruN john-1.7.0.1/src/x86-mmx.h john-1.7.0.1-banquise-to-bigpatch-18/src/x86-mmx.h >--- john-1.7.0.1/src/x86-mmx.h 2002-04-11 17:55:55.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/x86-mmx.h 2006-03-16 04:58:50.000000000 +0000 >@@ -58,4 +58,7 @@ > #define BF_ASM 1 > #define BF_SCALE 1 > >+#define MMX_COEF 2 >+#define MMX_TYPE "(MMX 2x)" >+ > #endif >diff -ruN john-1.7.0.1/src/x86-sse2.h john-1.7.0.1-banquise-to-bigpatch-18/src/x86-sse2.h >--- john-1.7.0.1/src/x86-sse2.h 2006-03-17 17:32:44.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/x86-sse2.h 2006-03-16 03:07:04.000000000 +0000 >@@ -0,0 +1,64 @@ >+/* >+ * This file is part of John the Ripper password cracker, >+ * Copyright (c) 1996-2002 by Solar Designer >+ */ >+ >+/* >+ * Architecture specific parameters for x86 with MMX. >+ */ >+ >+#ifndef _JOHN_ARCH_H >+#define _JOHN_ARCH_H >+ >+#define ARCH_WORD long >+#define ARCH_SIZE 4 >+#define ARCH_BITS 32 >+#define ARCH_BITS_LOG 5 >+#define ARCH_BITS_STR "32" >+#define ARCH_LITTLE_ENDIAN 1 >+#define ARCH_INT_GT_32 0 >+#define ARCH_ALLOWS_UNALIGNED 1 >+#define ARCH_INDEX(x) ((unsigned int)(unsigned char)(x)) >+ >+#if defined(__CYGWIN32__) || defined(__BEOS__) >+#define OS_TIMER 0 >+#else >+#define OS_TIMER 1 >+#endif >+#define OS_FLOCK 1 >+ >+#define CPU_DETECT 1 >+#define CPU_REQ 1 >+#define CPU_NAME "MMX" >+#ifndef CPU_FALLBACK >+#define CPU_FALLBACK 0 >+#endif >+#if CPU_FALLBACK >+#define CPU_FALLBACK_BINARY "john-non-mmx" >+#endif >+ >+#define DES_ASM 1 >+#define DES_128K 0 >+#define DES_X2 1 >+#define DES_MASK 1 >+#define DES_SCALE 0 >+#define DES_EXTB 0 >+#define DES_COPY 1 >+#define DES_STD_ALGORITHM_NAME "48/64 4K MMX" >+#define DES_BS_ASM 1 >+#define DES_BS 1 >+#define DES_BS_VECTOR 2 >+#define DES_BS_EXPAND 1 >+#define DES_BS_ALGORITHM_NAME "64/64 BS MMX" >+ >+#define MD5_ASM 1 >+#define MD5_X2 0 >+#define MD5_IMM 1 >+ >+#define BF_ASM 1 >+#define BF_SCALE 1 >+ >+#define MMX_COEF 4 >+#define MMX_TYPE " (SSE2 4x)" >+ >+#endif >diff -ruN john-1.7.0.1/src/x86.S john-1.7.0.1-banquise-to-bigpatch-18/src/x86.S >--- john-1.7.0.1/src/x86.S 2006-02-27 03:46:56.000000000 +0000 >+++ john-1.7.0.1-banquise-to-bigpatch-18/src/x86.S 2006-03-16 05:00:27.000000000 +0000 >@@ -1355,3 +1355,6 @@ > CPU_detect_ret: > popl %ebx > ret >+#ifdef __ELF__ >+.section .note.GNU-stack,"",@progbits >+#endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 122435
:
79941
|
82399
| 82400 |
82401
|
84655