[Pkg-john-commits] r164 - in trunk/debian: . man patches

hanska-guest at alioth.debian.org hanska-guest at alioth.debian.org
Sun Jun 1 15:22:13 UTC 2008


Author: hanska-guest
Date: 2008-06-01 17:15:27 +0200 (Sun, 01 Jun 2008)
New Revision: 164

Added:
   trunk/debian/john.lintian-overrides
   trunk/debian/patches/00-remove_funroll-loops.patch
   trunk/debian/patches/01-add_NTLM-MD4.patch
   trunk/debian/patches/02-add_MS-Credential-Cache.patch
   trunk/debian/patches/03-add_NetLM-NetNTLM.patch
   trunk/debian/patches/04-amd64.patch
   trunk/debian/patches/05-mipsel.patch
   trunk/debian/patches/06-fix_paths.patch
   trunk/debian/patches/07-update_FAQ.patch
Removed:
   trunk/debian/patches/01-amd64.patch
   trunk/debian/patches/02-mipsel.patch
   trunk/debian/patches/03-fix_paths.patch
Modified:
   trunk/debian/changelog
   trunk/debian/compat
   trunk/debian/control
   trunk/debian/copyright
   trunk/debian/man/john.8
   trunk/debian/patches/series
   trunk/debian/rules
Log:
Committing initial 1.7.2-3 files.
Ready for group maintainance.


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/changelog	2008-06-01 15:15:27 UTC (rev 164)
@@ -1,3 +1,31 @@
+john (1.7.2-3) UNRELEASED; urgency=low
+
+  * Merged debian/changelog from old experimental version (1.7-1 and
+    1.7-2).
+  * debian/patches/:
+    - 06-fix_paths.patch updated.
+    - 07-update_FAQ.patch added: point users to README.wordlists.
+    - added support for Microsoft Windows NT/2000/XP/2003 NTLM (MD4) hash
+      (patch by Alain Espinosa <alainesp at gmail.com>)
+    - added support for Windows 2000/XP/2003 credentials cache hash (patch
+      by Alain Espinosa <alainesp at gmail.com>)
+    - added support for LM/NTLMv1 challenge/response (ported from 1.7.0.2)
+      (patch by by JoMo-Kun <jmk at foofus.net>)
+  * debian/control:
+    - set "John Packaging Team" as the Maintainer
+    - moved myself to Uploaders
+    - debhelper dependency bumped to >= 6.0.7~ (dh_lintian)
+    - added Build-Depends on libssl-dev
+  * debian/man/john.8 fixed (Closes: #482886)
+  * debian/rules updated:
+    - binary-common target added, binary-{arch,indep} depending on it
+      (Closes: #477450)
+  * debian/compat bumped to 6
+  * debian/copyright updated:
+    - included files created by patches
+
+ -- David Paleino <d.paleino at gmail.com>  Sat, 10 May 2008 17:32:50 +0200
+
 john (1.7.2-2) unstable; urgency=low
 
   * Fixing undeclared conflict between john-data and previous versions
@@ -110,6 +138,49 @@
 
  -- Guilherme de S. Pastore <gpastore at debian.org>  Tue, 18 Apr 2006 23:40:20 -0300
 
+john (1.7-2) experimental; urgency=low
+
+  * Patches changes:
+    - Drop the am64 patch (the AMD 64 bugs are fixed upstream and the patch
+      introduced new bugs)
+    - Drop the makefile patch (test code, should have been removed a long
+      time ago)
+    Neither are needed for these release any more
+  * Build changes:
+    - Use the MMX for i386 and amd64 and let john use the runtime fallback
+      if MMX is not present
+    - Introduce a build-john-stamp target in debian/rules to prevent cdbs from running the
+      build/john target twice (lead to FTBFS)
+  * Documentation changeS:
+    - Add doc/CONTACT to the documentation under debian/docs
+    - Added a debian/TODO
+    - Ofuscate the email addresses in the Debian manpages as 
+      requested by Solar Designer
+    - Review the manpage and add double dashes to all options and equal
+      signs (GNU-style syntax). It still needs to be reviewed to adapt
+      it to 1.7...
+
+ -- Javier Fernandez-Sanguino Pen~a <jfs at computer.org>  Mon, 20 Feb 2006 18:10:28 +0100
+
+john (1.7-1) experimental; urgency=low
+
+  * New upstream release (Closes: #353151)
+  * Fix debian/copyright with information from doc/LICENSE, the
+    debian/copyright file said it was GPLv2 or later and the LICENSE
+    does not. Include other information from that file missing.
+  * Modify debian/patches/faq.diff since the fix is already applied
+    upstream
+  * Modify debian/patches/makefile.diff since the fix is carried upstesam
+  * Adjust debian/patches/systemwide.diff so that it uses the new SYSTEM_WIDE
+    definition
+  * Disable the MMX target for i386 (it does not work for the moment) and
+    use a single generic binary as with other architectures
+  * Create a link for /usr/share/john/john.conf that points to
+    /etc/john/john.conf (even though we have a systemwide configuration
+    pointing there, just in case)
+
+ -- Javier Fernandez-Sanguino Pen~a <jfs at computer.org>  Thu, 16 Feb 2006 14:53:36 +0100
+
 john (1.6-39) unstable; urgency=low
 
   * debian/man/john.8:

Modified: trunk/debian/compat
===================================================================
--- trunk/debian/compat	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/compat	2008-06-01 15:15:27 UTC (rev 164)
@@ -1 +1 @@
-5
+6

Modified: trunk/debian/control
===================================================================
--- trunk/debian/control	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/control	2008-06-01 15:15:27 UTC (rev 164)
@@ -1,9 +1,10 @@
 Source: john
 Section: admin
 Priority: optional
-Maintainer: David Paleino <d.paleino at gmail.com>
+Maintainer: John Packaging Team <pkg-john-devel at lists.alioth.debian.org>
+Uploaders: David Paleino <d.paleino at gmail.com>
 Standards-Version: 3.7.3
-Build-Depends: debhelper (>= 5), quilt
+Build-Depends: debhelper (>= 6.0.7~), quilt, libssl-dev
 Homepage: http://www.openwall.com/john/
 Vcs-Svn: svn://svn.debian.org/svn/collab-maint/deb-maint/john/trunk/
 Vcs-Browser: http://svn.debian.org/wsvn/collab-maint/deb-maint/john/trunk/?rev=0&sc=0

Modified: trunk/debian/copyright
===================================================================
--- trunk/debian/copyright	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/copyright	2008-06-01 15:15:27 UTC (rev 164)
@@ -1,5 +1,39 @@
 Source: http://www.openwall.com/john/
 
+Files: src/NT_fmt.c (from debian/patches/01-add_NTLM-MD4.patch)
+       src/mscash_fmt.c (from debian/patches/02-add_MS-Credential-Cache.patch)
+Copyright: © 2007, Alain Espinosa <alainesp at gmail.com>
+License: PD
+==> NT_fmt.c <==
+ /* NTLM patch for john (performance improvement)
+  *
+  * Written by Alain Espinosa <alainesp at gmail.com> in 2007
+  * and placed in the public domain.
+  */
+==> mscash_fmt.c <==
+ /* MSCASH patch for john (performance improvement)
+  *
+  * Written by Alain Espinosa <alainesp at gmail.com> in 2007
+  * and placed in the public domain.
+  */
+
+Files: src/NETLM_fmt.c (from debian/patches/03-add_NetLM-NetNTLM.patch)
+       src/NETNTLM_fmt.c (from debian/patches/03-add_NetLM-NetNTLM.patch)
+Copyright: © 2007, JoMo-Kun <jmk at foofus.net>
+License: PD
+==> NETLM_fmt.c <==
+ /*
+  * NETLM_fmt.c -- LM Challenge/Response
+  *
+  * Written by JoMo-Kun <jmk at foofus.net> in 2007
+  * and placed in the public domain.
+==> NETNTLM_fmt.c <==
+ /*
+  * NETNTLM_fmt.c -- NTLM Challenge/Response
+  *
+  * Written by JoMo-Kun <jmk at foofus.net> in 2007
+  * and placed in the public domain.
+
 Files: debian/*
 Copyright: © 2008, David Paleino <d.paleino at gmail.com>
            © 2004-2006, Guilherme de S. Pastore <gpastore at debian.org>

Added: trunk/debian/john.lintian-overrides
===================================================================
--- trunk/debian/john.lintian-overrides	                        (rev 0)
+++ trunk/debian/john.lintian-overrides	2008-06-01 15:15:27 UTC (rev 164)
@@ -0,0 +1,2 @@
+# the code depending on openssl is Public Domain
+john: possible-gpl-code-linked-with-openssl

Modified: trunk/debian/man/john.8
===================================================================
--- trunk/debian/man/john.8	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/man/john.8	2008-06-01 15:15:27 UTC (rev 164)
@@ -169,7 +169,7 @@
 list can be used to invert the check (that is, load all the users that
 aren't listed).
 .TP
-.B \-wordfile:FILE
+.B \-wordlist:FILE
 These are used to enable the wordlist mode, reading words from FILE.
 .SH MODES
 John can work in the following modes:

Added: trunk/debian/patches/00-remove_funroll-loops.patch
===================================================================
--- trunk/debian/patches/00-remove_funroll-loops.patch	                        (rev 0)
+++ trunk/debian/patches/00-remove_funroll-loops.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -0,0 +1,15 @@
+--- john.orig/src/Makefile
++++ john/src/Makefile
+@@ -18,7 +18,11 @@
+ CFLAGS = -c -Wall -O2 -fomit-frame-pointer
+ ASFLAGS = -c
+ LDFLAGS = -s
+-OPT_NORMAL = -funroll-loops
++
++# -funroll-loops set in debian/rules, for failed build on ARM.
++# Please see #476460
++#OPT_NORMAL = -funroll-loops
++OPT_NORMAL =
+ OPT_INLINE = -finline-functions
+ 
+ JOHN_OBJS_MINIMAL = \

Added: trunk/debian/patches/01-add_NTLM-MD4.patch
===================================================================
--- trunk/debian/patches/01-add_NTLM-MD4.patch	                        (rev 0)
+++ trunk/debian/patches/01-add_NTLM-MD4.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -0,0 +1,1255 @@
+--- john.orig/src/Makefile
++++ john/src/Makefile
+@@ -32,6 +32,7 @@
+ 	BF_fmt.o BF_std.o \
+ 	AFS_fmt.o \
+ 	LM_fmt.o \
++	NT_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 \
+--- /dev/null
++++ john/src/NT_fmt.c
+@@ -0,0 +1,613 @@
++/* NTLM patch for john (performance improvement)
++ *
++ * Written by Alain Espinosa <alainesp at gmail.com> in 2007
++ * and placed in the public domain.
++ */
++
++#include <string.h>
++#include "arch.h"
++#include "misc.h"
++#include "memory.h"
++#include "common.h"
++#include "formats.h"
++
++//Init values
++#define INIT_A 0x67452301
++#define INIT_B 0xefcdab89
++#define INIT_C 0x98badcfe
++#define INIT_D 0x10325476
++
++#define SQRT_2 0x5a827999
++#define SQRT_3 0x6ed9eba1
++
++
++#define FORMAT_LABEL			"nt"
++#define FORMAT_NAME			"NT MD4"
++
++#define BENCHMARK_COMMENT		""
++#define BENCHMARK_LENGTH		-1
++
++#define PLAINTEXT_LENGTH		27
++#define CIPHERTEXT_LENGTH		36
++
++static struct fmt_tests tests[] = {
++	{"$NT$b7e4b9022cd45f275334bbdb83bb5be5", "John the Ripper"},
++	{"$NT$8846f7eaee8fb117ad06bdd830b7586c", "password"},
++	{"$NT$0cb6948805f797bf2a82807973b89537", "test"},
++	{"$NT$31d6cfe0d16ae931b73c59d7e0c089c0", ""},
++	{NULL}
++};
++
++#define BINARY_SIZE			16
++#define SALT_SIZE			0
++
++#if defined (NT_X86_64)
++	#define NT_NUM_KEYS	32
++
++	unsigned int nt_buffer8x[16*NT_NUM_KEYS] __attribute__ ((aligned(16)));
++	unsigned int output8x[4*NT_NUM_KEYS] __attribute__ ((aligned(16)));
++
++	#define ALGORITHM_NAME		"X86-64 SSE2 8x"
++	#define NT_CRYPT_FUN		nt_crypt_all_x86_64
++	extern void nt_crypt_all_x86_64(int count);
++#elif defined (NT_SSE2)
++	#define NT_NUM_KEYS	40
++	#define NT_NUM_KEYS1	8
++	#define NT_NUM_KEYS4	32
++
++	unsigned int nt_buffer4x[64*NT_NUM_KEYS1] __attribute__ ((aligned(16)));
++	unsigned int output4x[16*NT_NUM_KEYS1] __attribute__ ((aligned(16)));
++
++	unsigned int nt_buffer1x[16*NT_NUM_KEYS1];
++	unsigned int output1x[4*NT_NUM_KEYS1];
++
++	#define ALGORITHM_NAME		"X86 SSE2 5x"
++	#define NT_CRYPT_FUN		nt_crypt_all_sse2
++	extern void nt_crypt_all_sse2(int count);
++#else
++	#define NT_NUM_KEYS		64
++	unsigned int nt_buffer1x[16*NT_NUM_KEYS];
++	unsigned int output1x[4*NT_NUM_KEYS];
++
++	#define ALGORITHM_NAME		"Generic 1x"
++	#define NT_CRYPT_FUN		nt_crypt_all_generic
++	static void nt_crypt_all_generic(int count)
++	{
++		unsigned int a;
++		unsigned int b;
++		unsigned int c;
++		unsigned int d;
++		unsigned int i=0;
++
++		for(;i<NT_NUM_KEYS;i++)
++		{
++			/* Round 1 */
++			a = 		0xFFFFFFFF 		 +nt_buffer1x[i*16+0];a=(a<<3 )|(a>>29);
++			d = INIT_D+(INIT_C ^ (a & 0x77777777))   +nt_buffer1x[i*16+1];d=(d<<7 )|(d>>25);
++			c = INIT_C+(INIT_B ^ (d & (a ^ INIT_B))) +nt_buffer1x[i*16+2];c=(c<<11)|(c>>21);
++			b = INIT_B + (a ^ (c & (d ^ a))) 	 +nt_buffer1x[i*16+3];b=(b<<19)|(b>>13);
++
++			a += (d ^ (b & (c ^ d)))  +  nt_buffer1x[i*16+4]  ;a = (a << 3 ) | (a >> 29);
++			d += (c ^ (a & (b ^ c)))  +  nt_buffer1x[i*16+5]  ;d = (d << 7 ) | (d >> 25);
++			c += (b ^ (d & (a ^ b)))  +  nt_buffer1x[i*16+6]  ;c = (c << 11) | (c >> 21);
++			b += (a ^ (c & (d ^ a)))  +  nt_buffer1x[i*16+7]  ;b = (b << 19) | (b >> 13);
++
++			a += (d ^ (b & (c ^ d)))  +  nt_buffer1x[i*16+8]  ;a = (a << 3 ) | (a >> 29);
++			d += (c ^ (a & (b ^ c)))  +  nt_buffer1x[i*16+9]  ;d = (d << 7 ) | (d >> 25);
++			c += (b ^ (d & (a ^ b)))  +  nt_buffer1x[i*16+10] ;c = (c << 11) | (c >> 21);
++			b += (a ^ (c & (d ^ a)))  +  nt_buffer1x[i*16+11] ;b = (b << 19) | (b >> 13);
++
++			a += (d ^ (b & (c ^ d)))  +  nt_buffer1x[i*16+12] ;a = (a << 3 ) | (a >> 29);
++			d += (c ^ (a & (b ^ c)))  +  nt_buffer1x[i*16+13] ;d = (d << 7 ) | (d >> 25);
++			c += (b ^ (d & (a ^ b)))  +  nt_buffer1x[i*16+14] ;c = (c << 11) | (c >> 21);
++			b += (a ^ (c & (d ^ a)));b = (b << 19) | (b >> 13);
++
++			/* Round 2 */
++			a += ((b & (c | d)) | (c & d))+nt_buffer1x[i*16+0] +SQRT_2;a = (a<<3 ) | (a>>29);
++			d += ((a & (b | c)) | (b & c))+nt_buffer1x[i*16+4] +SQRT_2;d = (d<<5 ) | (d>>27);
++			c += ((d & (a | b)) | (a & b))+nt_buffer1x[i*16+8] +SQRT_2;c = (c<<9 ) | (c>>23);
++			b += ((c & (d | a)) | (d & a))+nt_buffer1x[i*16+12]+SQRT_2;b = (b<<13) | (b>>19);
++
++			a += ((b & (c | d)) | (c & d))+nt_buffer1x[i*16+1] +SQRT_2;a = (a<<3 ) | (a>>29);
++			d += ((a & (b | c)) | (b & c))+nt_buffer1x[i*16+5] +SQRT_2;d = (d<<5 ) | (d>>27);
++			c += ((d & (a | b)) | (a & b))+nt_buffer1x[i*16+9] +SQRT_2;c = (c<<9 ) | (c>>23);
++			b += ((c & (d | a)) | (d & a))+nt_buffer1x[i*16+13]+SQRT_2;b = (b<<13) | (b>>19);
++
++			a += ((b & (c | d)) | (c & d))+nt_buffer1x[i*16+2] +SQRT_2;a = (a<<3 ) | (a>>29);
++			d += ((a & (b | c)) | (b & c))+nt_buffer1x[i*16+6] +SQRT_2;d = (d<<5 ) | (d>>27);
++			c += ((d & (a | b)) | (a & b))+nt_buffer1x[i*16+10]+SQRT_2;c = (c<<9 ) | (c>>23);
++			b += ((c & (d | a)) | (d & a))+nt_buffer1x[i*16+14]+SQRT_2;b = (b<<13) | (b>>19);
++
++			a += ((b & (c | d)) | (c & d))+nt_buffer1x[i*16+3] +SQRT_2;a = (a<<3 ) | (a>>29);
++			d += ((a & (b | c)) | (b & c))+nt_buffer1x[i*16+7] +SQRT_2;d = (d<<5 ) | (d>>27);
++			c += ((d & (a | b)) | (a & b))+nt_buffer1x[i*16+11]+SQRT_2;c = (c<<9 ) | (c>>23);
++			b += ((c & (d | a)) | (d & a))			   +SQRT_2;b = (b<<13) | (b>>19);
++
++			/* Round 3 */
++			a += (d ^ c ^ b) + nt_buffer1x[i*16+0]  +  SQRT_3; a = (a << 3 ) | (a >> 29);
++			d += (c ^ b ^ a) + nt_buffer1x[i*16+8]  +  SQRT_3; d = (d << 9 ) | (d >> 23);
++			c += (b ^ a ^ d) + nt_buffer1x[i*16+4]  +  SQRT_3; c = (c << 11) | (c >> 21);
++			b += (a ^ d ^ c) + nt_buffer1x[i*16+12] +  SQRT_3; b = (b << 15) | (b >> 17);
++
++			a += (d ^ c ^ b) + nt_buffer1x[i*16+2]  +  SQRT_3; a = (a << 3 ) | (a >> 29);
++			d += (c ^ b ^ a) + nt_buffer1x[i*16+10] +  SQRT_3; d = (d << 9 ) | (d >> 23);
++			c += (b ^ a ^ d) + nt_buffer1x[i*16+6]  +  SQRT_3; c = (c << 11) | (c >> 21);
++			b += (a ^ d ^ c) + nt_buffer1x[i*16+14] +  SQRT_3; b = (b << 15) | (b >> 17);
++
++			a += (d ^ c ^ b) + nt_buffer1x[i*16+1]  +  SQRT_3; a = (a << 3 ) | (a >> 29);
++			d += (c ^ b ^ a) + nt_buffer1x[i*16+9]  +  SQRT_3; d = (d << 9 ) | (d >> 23);
++			c += (b ^ a ^ d) + nt_buffer1x[i*16+5]  +  SQRT_3; c = (c << 11) | (c >> 21);
++			b += (a ^ d ^ c) + nt_buffer1x[i*16+13];
++
++			output1x[4*i+0]=a;
++			output1x[4*i+1]=b;
++			output1x[4*i+2]=c;
++			output1x[4*i+3]=d;
++		}
++	}
++#endif
++
++unsigned int last_i[NT_NUM_KEYS];
++char saved_plain[32*NT_NUM_KEYS];
++
++#define MIN_KEYS_PER_CRYPT		NT_NUM_KEYS
++#define MAX_KEYS_PER_CRYPT		NT_NUM_KEYS
++
++static void fmt_NT_init(void)
++{
++	memset(last_i,0,4*NT_NUM_KEYS);
++#if defined(NT_X86_64)
++	memset(nt_buffer8x,0,16*4*NT_NUM_KEYS);
++#elif defined(NT_SSE2)
++	memset(nt_buffer4x,0,64*4*NT_NUM_KEYS1);
++	memset(nt_buffer1x,0,16*4*NT_NUM_KEYS1);
++#else
++	memset(nt_buffer1x,0,16*4*NT_NUM_KEYS);
++#endif
++}
++
++static char * nt_split(char *ciphertext, int index)
++{
++	static char out[37];
++
++	if (!strncmp(ciphertext, "$NT$", 4))
++		ciphertext += 4;
++
++	out[0] = '$';
++	out[1] = 'N';
++	out[2] = 'T';
++	out[3] = '$';
++
++	memcpy(&out[4], ciphertext, 32);
++	out[36] = 0;
++
++	strlwr(&out[4]);
++
++	return out;
++}
++
++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 unsigned int out[4];
++	unsigned int i=0;
++	unsigned int temp;
++
++	ciphertext+=4;
++	for (; i<4; i++)
++	{
++ 		temp  = (atoi16[ARCH_INDEX(ciphertext[i*8+0])])<<4;
++ 		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+1])]);
++
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+2])])<<12;
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+3])])<<8;
++
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+4])])<<20;
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+5])])<<16;
++
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+6])])<<28;
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+7])])<<24;
++
++		out[i]=temp;
++	}
++
++	out[0] -= INIT_A;
++	out[1] -= INIT_B;
++	out[2] -= INIT_C;
++	out[3] -= INIT_D;
++
++	out[1]  = (out[1] >> 15) | (out[1] << 17);
++	out[1] -= SQRT_3 + (out[2] ^ out[3] ^ out[0]);
++	out[1]  = (out[1] >> 15) | (out[1] << 17);
++	out[1] -= SQRT_3;
++
++	return out;
++}
++
++static int binary_hash_0(void *binary)
++{
++	return ((unsigned int *)binary)[1] & 0x0F;
++}
++
++static int binary_hash_1(void *binary)
++{
++	return ((unsigned int *)binary)[1] & 0xFF;
++}
++
++static int binary_hash_2(void *binary)
++{
++	return ((unsigned int *)binary)[1] & 0x0FFF;
++}
++
++static int get_hash_0(int index)
++{
++#if defined(NT_X86_64)
++	return output8x[32*(index>>3)+8+index%8] & 0x0F;
++#elif defined(NT_SSE2)
++	if(index<NT_NUM_KEYS4)
++		return output4x[16*(index>>2)+4+index%4] & 0x0F;
++	else
++		return output1x[(index-NT_NUM_KEYS4)*4+1] & 0x0F;
++#else
++	return output1x[(index<<2)+1] & 0x0F;
++#endif
++}
++
++static int get_hash_1(int index)
++{
++#if defined(NT_X86_64)
++	return output8x[32*(index>>3)+8+index%8] & 0xFF;
++#elif defined(NT_SSE2)
++	if(index<NT_NUM_KEYS4)
++		return output4x[16*(index>>2)+4+index%4] & 0xFF;
++	else
++		return output1x[(index-NT_NUM_KEYS4)*4+1] & 0xFF;
++#else
++	return output1x[(index<<2)+1] & 0xFF;
++#endif
++}
++
++static int get_hash_2(int index)
++{
++#if defined(NT_X86_64)
++	return output8x[32*(index>>3)+8+index%8] & 0x0FFF;
++#elif defined(NT_SSE2)
++	if(index<NT_NUM_KEYS4)
++		return output4x[16*(index>>2)+4+index%4] & 0x0FFF;
++	else
++		return output1x[(index-NT_NUM_KEYS4)*4+1] & 0x0FFF;
++#else
++	return output1x[(index<<2)+1] & 0x0FFF;
++#endif
++}
++
++static int cmp_all(void *binary, int count)
++{
++	unsigned int i=0;
++	unsigned int b=((unsigned int *)binary)[1];
++
++#if defined(NT_X86_64)
++	for(;i<(NT_NUM_KEYS/2);i+=4)
++		if(b==output8x[i] || b==output8x[i+1] || b==output8x[i+2] || b==output8x[i+3] || b==output8x[i+4] || b==output8x[i+5] || b==output8x[i+6] || b==output8x[i+7])
++			return 1;
++#elif defined(NT_SSE2)
++	unsigned int pos=4;
++
++	for(;i<NT_NUM_KEYS1;i++,pos+=16)
++		if(b==output4x[pos] || b==output4x[pos+1] || b==output4x[pos+2] || b==output4x[pos+3])
++			return 1;
++	i=1;
++	for(;i<NT_NUM_KEYS4;i+=4)
++		if(b==output1x[i])
++			return 1;
++#else
++	for(;i<NT_NUM_KEYS;i++)
++		if(b==output1x[i*4+1])
++			return 1;
++#endif
++
++	return 0;
++}
++
++static int cmp_one(void * binary, int index)
++{
++	unsigned int *t=(unsigned int *)binary;
++	unsigned int a;
++	unsigned int b;
++	unsigned int c;
++	unsigned int d;
++
++	unsigned int * buffer;
++	int pos1;
++	int pos2;
++	int pos3;
++
++#if defined(NT_X86_64)
++	int temp;
++	buffer=nt_buffer8x;
++
++	temp=32*(index>>3)+index%8;
++
++	a=output8x[temp];
++	b=output8x[temp+8];
++	c=output8x[temp+16];
++	d=output8x[temp+24];
++
++	pos1=24+index%8+128*(index>>3);
++	pos2=64+pos1;
++	pos3=32+pos1;
++#elif defined(NT_SSE2)
++	int temp;
++
++	if(index<NT_NUM_KEYS4)
++	{
++		buffer=nt_buffer4x;
++
++		temp=16*(index>>2)+index%4;
++
++		a=output4x[temp];
++		b=output4x[temp+4];
++		c=output4x[temp+8];
++		d=output4x[temp+12];
++
++		pos1=12+index%4+64*(index>>2);
++		pos2=32+pos1;
++		pos3=16+pos1;
++	}
++	else
++	{
++		buffer=nt_buffer1x;
++
++		temp=4*(index-NT_NUM_KEYS4);
++
++		a=output1x[temp];
++		b=output1x[temp+1];
++		c=output1x[temp+2];
++		d=output1x[temp+3];
++
++		pos1=3+4*temp;
++		pos2=8+pos1;
++		pos3=4+pos1;
++	}
++#else
++	buffer=nt_buffer1x;
++
++	a=output1x[(index<<2)];
++	b=output1x[(index<<2)+1];
++	c=output1x[(index<<2)+2];
++	d=output1x[(index<<2)+3];
++
++	pos1=(index<<4)+3;
++	pos2=8+pos1;
++	pos3=4+pos1;
++#endif
++	if(b!=t[1])
++		return 0;
++	b += SQRT_3;b = (b << 15) | (b >> 17);
++
++	a += (b ^ c ^ d) + buffer[pos1] + SQRT_3; a = (a << 3 ) | (a >> 29);
++	if(a!=t[0])
++		return 0;
++
++	d += (a ^ b ^ c) + buffer[pos2] + SQRT_3; d = (d << 9 ) | (d >> 23);
++	if(d!=t[3])
++		return 0;
++
++	c += (d ^ a ^ b) + buffer[pos3] + SQRT_3; c = (c << 11) | (c >> 21);
++	return c==t[2];
++}
++
++static int cmp_exact(char *source, int index)
++{
++	return 1;
++}
++
++static void set_salt(void *salt)
++{
++}
++
++static void set_key(char *key, int index)
++{
++	unsigned int i=0;
++	unsigned int md4_size=0;
++	unsigned int saved_base=index<<5;
++	unsigned int temp;
++	int buff_base;
++#if defined(NT_X86_64)
++	unsigned int last_lenght=last_i[index]<<2;
++
++	buff_base=128*(index>>3)+index%8;
++
++	for(;key[md4_size] && md4_size<PLAINTEXT_LENGTH;i+=8,md4_size++)
++	{
++		saved_plain[saved_base+md4_size]=key[md4_size];
++		temp=key[++md4_size];
++		saved_plain[saved_base+md4_size]=temp;
++
++		if(temp)
++		{
++			nt_buffer8x[i+buff_base] = key[md4_size-1] | (temp<<16);
++		}
++		else
++		{
++			nt_buffer8x[i+buff_base] = key[md4_size-1] | 0x800000;
++			goto key_cleaning;
++		}
++	}
++
++	nt_buffer8x[i+buff_base]=0x80;
++	saved_plain[saved_base+md4_size]=0;
++
++key_cleaning:
++	i+=8;
++	for(;i<=last_lenght;i+=8)
++		nt_buffer8x[i+buff_base]=0;
++
++	last_i[index]=md4_size;
++
++	nt_buffer8x[112+buff_base] = md4_size << 4;
++#elif defined(NT_SSE2)
++	unsigned int last_lenght=last_i[index]<<1;
++
++	if(index<NT_NUM_KEYS4)
++	{
++		buff_base=64*(index>>2)+index%4;
++
++		for(;key[md4_size] && md4_size<PLAINTEXT_LENGTH;i+=4,md4_size++)
++		{
++			saved_plain[saved_base+md4_size]=key[md4_size];
++			temp=key[++md4_size];
++			saved_plain[saved_base+md4_size]=temp;
++
++			if(temp)
++			{
++				nt_buffer4x[i+buff_base] = key[md4_size-1] | (temp<<16);
++			}
++			else
++			{
++				nt_buffer4x[i+buff_base] = key[md4_size-1] | 0x800000;
++				goto key_cleaning;
++			}
++		}
++
++		nt_buffer4x[i+buff_base]=0x80;
++		saved_plain[saved_base+md4_size]=0;
++
++	key_cleaning:
++		i+=4;
++		for(;i<=last_lenght;i+=4)
++			nt_buffer4x[i+buff_base]=0;
++
++		last_i[index]=md4_size;
++
++		nt_buffer4x[56+buff_base] = md4_size << 4;
++	}
++	else
++	{
++		buff_base=16*(index-NT_NUM_KEYS4);
++
++		for(;key[md4_size] && md4_size<PLAINTEXT_LENGTH;i++,md4_size++)
++		{
++			saved_plain[saved_base+md4_size]=key[md4_size];
++			temp=key[++md4_size];
++			saved_plain[saved_base+md4_size]=temp;
++
++			if(temp)
++			{
++				nt_buffer1x[i+buff_base] = key[md4_size-1] | (temp<<16);
++			}
++			else
++			{
++				nt_buffer1x[i+buff_base] = key[md4_size-1] | 0x800000;
++				goto key_cleaning1;
++			}
++		}
++
++		nt_buffer1x[i+buff_base]=0x80;
++		saved_plain[saved_base+md4_size]=0;
++
++	key_cleaning1:
++		i++;
++		last_lenght>>=1;
++
++		for(;i<=last_lenght;i++)
++			nt_buffer1x[i+buff_base]=0;
++
++		last_i[index]=md4_size>>1;
++
++		nt_buffer1x[14+buff_base] = md4_size << 4;
++	}
++#else
++	buff_base=index<<4;
++
++	for(;key[md4_size] && md4_size<PLAINTEXT_LENGTH;i++,md4_size++)
++	{
++		saved_plain[saved_base+md4_size]=key[md4_size];
++		temp=key[++md4_size];
++		saved_plain[saved_base+md4_size]=temp;
++
++		if(temp)
++		{
++			nt_buffer1x[buff_base+i] = key[md4_size-1] | (temp<<16);
++		}
++		else
++		{
++			nt_buffer1x[buff_base+i] = key[md4_size-1] | 0x800000;
++			goto key_cleaning;
++		}
++	}
++
++	nt_buffer1x[buff_base+i]=0x80;
++	saved_plain[saved_base+md4_size]=0;
++
++key_cleaning:
++	i++;
++	for(;i<=last_i[index];i++)
++		nt_buffer1x[buff_base+i]=0;
++
++	last_i[index]=md4_size>>1;
++
++	nt_buffer1x[buff_base+14] = md4_size << 4;
++#endif
++}
++
++static char *get_key(int index)
++{
++	return saved_plain+(index<<5);
++}
++
++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 | FMT_SPLIT_UNIFIES_CASE,
++		tests
++	}, {
++		fmt_NT_init,
++		valid,
++		nt_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,
++		NT_CRYPT_FUN,
++		{
++			get_hash_0,
++			get_hash_1,
++			get_hash_2
++		},
++		cmp_all,
++		cmp_one,
++		cmp_exact
++	}
++};
+--- john.orig/src/john.c
++++ john/src/john.c
+@@ -38,6 +38,7 @@
+ 
+ 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_NT;
+ 
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -64,6 +65,8 @@
+ 	john_register_one(&fmt_BF);
+ 	john_register_one(&fmt_AFS);
+ 	john_register_one(&fmt_LM);
++	john_register_one(&fmt_NT);
++
+ 
+ 	if (!fmt_list) {
+ 		fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john.orig/src/loader.c
++++ john/src/loader.c
+@@ -18,6 +18,7 @@
+ #include "signals.h"
+ #include "formats.h"
+ #include "loader.h"
++#include "options.h"
+ 
+ /*
+  * Flags for read_file().
+@@ -183,7 +184,7 @@
+ static int ldr_split_line(char **login, char **ciphertext,
+ 	char **gecos, char **home,
+ 	char *source, struct fmt_main **format,
+-	struct db_options *options, char *line)
++	struct db_options *db_options, char *line)
+ {
+ 	char *uid = NULL, *gid = NULL, *shell = NULL;
+ 	char *tmp;
+@@ -206,10 +207,31 @@
+ 		if (!strncmp(*ciphertext, "NO PASSWORD", 11))
+ 			*ciphertext = "";
+ 
++		/* NT loader hack starts here ! */
++
++		if (options.format && (strncmp(options.format, "nt", 2)==0)) {
++
++			tmp = ldr_get_field(&line);
++			*ciphertext = tmp;
++
++			if (!strncmp(*ciphertext, "NO PASSWORD", 11))
++				*ciphertext = "";
++			else if(strlen(*ciphertext) == 32) {
++				*ciphertext -= 4;
++				strncpy(*ciphertext,"$NT$",4);
++			}
++			else {
++				return 0;
++			}
++
++		}
++
++		/* NT loader hack ends here ! */
++
+ 		if (source) sprintf(source, "%s:%s", uid, line);
+ 	}
+ 
+-	if (options->flags & DB_WORDS || options->shells->head) {
++	if (db_options->flags & DB_WORDS || db_options->shells->head) {
+ 		gid = ldr_get_field(&line);
+ 		do {
+ 			*gecos = ldr_get_field(&line);
+@@ -218,13 +240,13 @@
+ 		} while (!**gecos &&
+ 			!strcmp(*home, "0") && !strcmp(shell, "0"));
+ 	} else
+-	if (options->groups->head) {
++	if (db_options->groups->head) {
+ 		gid = ldr_get_field(&line);
+ 	}
+ 
+-	if (ldr_check_list(options->users, *login, uid)) return 0;
+-	if (ldr_check_list(options->groups, gid, gid)) return 0;
+-	if (ldr_check_shells(options->shells, shell)) return 0;
++	if (ldr_check_list(db_options->users, *login, uid)) return 0;
++	if (ldr_check_list(db_options->groups, gid, gid)) return 0;
++	if (ldr_check_shells(db_options->shells, shell)) return 0;
+ 
+ 	if (*format) return (*format)->methods.valid(*ciphertext);
+ 
+--- john.orig/src/options.c
++++ john/src/options.c
+@@ -60,7 +60,7 @@
+ 	{"salts", FLG_SALTS, FLG_SALTS, FLG_PASSWD, OPT_REQ_PARAM,
+ 		"%d", &options.loader.min_pps},
+ 	{"format", FLG_FORMAT, FLG_FORMAT,
+-		FLG_CRACKING_SUP,
++		0,
+ 		FLG_MAKECHR_CHK | FLG_STDOUT | OPT_REQ_PARAM,
+ 		OPT_FMT_STR_ALLOC, &options.format},
+ 	{"save-memory", FLG_SAVEMEM, FLG_SAVEMEM, 0, OPT_REQ_PARAM,
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT           load salts with[out] at least COUNT passwords " \
+ 	"only\n" \
+ "--format=NAME              force ciphertext format NAME: " \
+-	"DES/BSDI/MD5/BF/AFS/LM\n" \
++	"DES/BSDI/MD5/BF/AFS/LM/NT\n" \
+ "--save-memory=LEVEL        enable memory saving, at LEVEL 1..3\n"
+ 
+ void opt_init(char *name, int argc, char **argv)
+--- john.orig/src/x86-64.S
++++ john/src/x86-64.S
+@@ -13,6 +13,9 @@
+ #define DES_bs_crypt			_DES_bs_crypt
+ #define DES_bs_crypt_25			_DES_bs_crypt_25
+ #define DES_bs_crypt_LM			_DES_bs_crypt_LM
++#define nt_buffer8x			_nt_buffer8x
++#define output8x			_output8x
++#define nt_crypt_all_x86_64		_nt_crypt_all_x86_64
+ #endif
+ 
+ #ifdef ALIGN_LOG
+@@ -1040,3 +1043,236 @@
+ 	subl $1,rounds
+ 	jnz DES_bs_crypt_LM_loop
+ 	ret
++
++
++/*
++extern nt_crypt_all_x86_64(int count);
++*/
++
++.globl nt_crypt_all_x86_64
++
++.data
++DO_ALIGN(6)
++const_init_a:
++.long 0xFFFFFFFF
++.long 0xFFFFFFFF
++.long 0xFFFFFFFF
++.long 0xFFFFFFFF
++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
++
++#define a  %xmm0
++#define b  %xmm1
++#define c  %xmm2
++#define d  %xmm3
++#define t1 %xmm4
++#define t2 %xmm5
++#define t3 %xmm6
++#define t4 %xmm7
++
++#undef a3
++#define a3  %xmm8
++#define b3  %xmm9
++#define c3  %xmm10
++#define d3  %xmm11
++#define t13 %xmm12
++#define t23 %xmm13
++
++/*
++#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)
++
++#define STEP(f, a, b, c, d, x, s)
++	a += f(b, c, d) + x;
++	a = (a << s) | (a >> (32 - s));
++*/
++#define STEP1(aa, bb, cc, dd, aa3, bb3, cc3, dd3, x, s, base)	\
++	paddd (512*base)+(x*32)+nt_buffer8x, aa;		\
++	paddd (512*base)+(x*32)+16+nt_buffer8x, aa3;		\
++	movdqa cc, t1;						\
++	movdqa cc3, t13;					\
++	pxor dd, t1;						\
++	pxor dd3, t13;						\
++	pand bb, t1;						\
++	pand bb3, t13;						\
++	pxor dd, t1;						\
++	pxor dd3, t13;						\
++        paddd t1, aa;						\
++	paddd t13, aa3;						\
++        movdqa aa, t2;						\
++	movdqa aa3, t23;					\
++        pslld $s, aa;						\
++	pslld $s, aa3;						\
++        psrld $(32-s), t2;					\
++	psrld $(32-s), t23;					\
++        por t2, aa;						\
++	por t23, aa3;
++
++#define STEP2(aa, bb, cc, dd, aa3, bb3, cc3, dd3, x, s, base)	\
++	paddd (512*base)+(x*32)+nt_buffer8x, aa;		\
++	paddd (512*base)+(x*32)+16+nt_buffer8x, aa3;		\
++	movdqa cc, t1;						\
++	movdqa cc3, t13;					\
++	movdqa cc, t2;						\
++	movdqa cc3, t23;					\
++	por dd, t1;						\
++	por dd3, t13;						\
++	pand dd, t2;						\
++	pand dd3, t23;						\
++	pand bb, t1;						\
++	pand bb3, t13;						\
++	paddd t3, aa;						\
++	paddd t3, aa3;						\
++	por t2, t1;						\
++	por t23, t13;						\
++	paddd t1, aa;						\
++	paddd t13, aa3;						\
++	movdqa aa, t1;						\
++	movdqa aa3, t13;					\
++	pslld $s, aa;						\
++	pslld $s, aa3;						\
++	psrld $(32-s), t1;					\
++	psrld $(32-s), t13;					\
++	por t1, aa;						\
++	por t13, aa3;
++
++#define STEP3(aa, bb, cc, dd, aa3, bb3, cc3, dd3, x, s, base)	\
++	paddd (512*base)+(x*32)+nt_buffer8x, aa;		\
++	paddd (512*base)+(x*32)+16+nt_buffer8x, aa3;		\
++	movdqa dd, t1;						\
++	movdqa dd3, t13;					\
++	pxor cc, t1;						\
++	pxor cc3, t13;						\
++	paddd t4, aa;						\
++	paddd t4, aa3;						\
++	pxor bb, t1;						\
++	pxor bb3, t13;						\
++	paddd t1, aa;						\
++	paddd t13, aa3;						\
++	movdqa aa, t1;						\
++	movdqa aa3, t13;					\
++	pslld $s, aa;						\
++	pslld $s, aa3;						\
++	psrld $(32-s), t1;					\
++	psrld $(32-s), t13;					\
++	por t1, aa;						\
++	por t13, aa3;
++
++#define NT_CRYPT_BODY(base)					\
++	movdqa const_init_a, a;					\
++	movdqa const_init_a, a3;				\
++	movdqa const_init_b, b;					\
++	movdqa const_init_b, b3;				\
++	movdqa const_init_c, c;					\
++	movdqa const_init_c, c3;				\
++	movdqa const_init_d, d;					\
++	movdqa const_init_d, d3;				\
++								\
++	paddd (512*base)+nt_buffer8x, a;			\
++	paddd (512*base)+16+nt_buffer8x, a3;			\
++	pslld $3, a;						\
++	pslld $3, a3;						\
++								\
++	STEP1(d, a, b, c, d3, a3, b3, c3, 1 , 7 , base)		\
++	STEP1(c, d, a, b, c3, d3, a3, b3, 2 , 11, base)		\
++	STEP1(b, c, d, a, b3, c3, d3, a3, 3 , 19, base)		\
++	STEP1(a, b, c, d, a3, b3, c3, d3, 4 , 3 , base)		\
++	STEP1(d, a, b, c, d3, a3, b3, c3, 5 , 7 , base)		\
++	STEP1(c, d, a, b, c3, d3, a3, b3, 6 , 11, base)		\
++	STEP1(b, c, d, a, b3, c3, d3, a3, 7 , 19, base)		\
++	STEP1(a, b, c, d, a3, b3, c3, d3, 8 , 3 , base)		\
++	STEP1(d, a, b, c, d3, a3, b3, c3, 9 , 7 , base)		\
++	STEP1(c, d, a, b, c3, d3, a3, b3, 10, 11, base)		\
++	STEP1(b, c, d, a, b3, c3, d3, a3, 11, 19, base)		\
++	STEP1(a, b, c, d, a3, b3, c3, d3, 12, 3 , base)		\
++	STEP1(d, a, b, c, d3, a3, b3, c3, 13, 7 , base)		\
++	STEP1(c, d, a, b, c3, d3, a3, b3, 14, 11, base)		\
++	STEP1(b, c, d, a, b3, c3, d3, a3, 15, 19, base)		\
++								\
++	STEP2(a, b, c, d, a3, b3, c3, d3, 0 , 3 , base)		\
++	STEP2(d, a, b, c, d3, a3, b3, c3, 4 , 5 , base)		\
++	STEP2(c, d, a, b, c3, d3, a3, b3, 8 , 9 , base)		\
++	STEP2(b, c, d, a, b3, c3, d3, a3, 12, 13, base)		\
++	STEP2(a, b, c, d, a3, b3, c3, d3, 1 , 3 , base)		\
++	STEP2(d, a, b, c, d3, a3, b3, c3, 5 , 5 , base)		\
++	STEP2(c, d, a, b, c3, d3, a3, b3, 9 , 9 , base)		\
++	STEP2(b, c, d, a, b3, c3, d3, a3, 13, 13, base)		\
++	STEP2(a, b, c, d, a3, b3, c3, d3, 2 , 3 , base)		\
++	STEP2(d, a, b, c, d3, a3, b3, c3, 6 , 5 , base)		\
++	STEP2(c, d, a, b, c3, d3, a3, b3, 10, 9 , base)		\
++	STEP2(b, c, d, a, b3, c3, d3, a3, 14, 13, base)		\
++	STEP2(a, b, c, d, a3, b3, c3, d3, 3 , 3 , base)		\
++	STEP2(d, a, b, c, d3, a3, b3, c3, 7 , 5 , base)		\
++	STEP2(c, d, a, b, c3, d3, a3, b3, 11, 9 , base)		\
++	STEP2(b, c, d, a, b3, c3, d3, a3, 15, 13, base)		\
++								\
++	STEP3(a, b, c, d, a3, b3, c3, d3, 0 , 3 , base)		\
++	STEP3(d, a, b, c, d3, a3, b3, c3, 8 , 9 , base)		\
++	STEP3(c, d, a, b, c3, d3, a3, b3, 4 , 11, base)		\
++	STEP3(b, c, d, a, b3, c3, d3, a3, 12, 15, base)		\
++	STEP3(a, b, c, d, a3, b3, c3, d3, 2 , 3 , base)		\
++	STEP3(d, a, b, c, d3, a3, b3, c3, 10, 9 , base)		\
++	STEP3(c, d, a, b, c3, d3, a3, b3, 6 , 11, base)		\
++	STEP3(b, c, d, a, b3, c3, d3, a3, 14, 15, base)		\
++	STEP3(a, b, c, d, a3, b3, c3, d3, 1 , 3 , base)		\
++	STEP3(d, a, b, c, d3, a3, b3, c3, 9 , 9 , base)		\
++	STEP3(c, d, a, b, c3, d3, a3, b3, 5 , 11, base)		\
++	movdqa a, t1;						\
++	movdqa a3, t13;						\
++	paddd (512*base)+416+nt_buffer8x, b;			\
++	paddd (512*base)+416+16+nt_buffer8x, b3;		\
++	pxor d, t1;						\
++	pxor d3,t13;						\
++	pxor c, t1;						\
++	pxor c3,t13;						\
++	paddd t1, b;						\
++	paddd t13,b3;						\
++								\
++	movdqa a,  (128*base)+output8x;				\
++	movdqa a3,  (128*base)+16+output8x;			\
++	movdqa b, (128*base)+32+output8x;			\
++	movdqa b3, (128*base)+32+16+output8x;			\
++	movdqa c, (128*base)+64+output8x;			\
++	movdqa c3, (128*base)+64+16+output8x;			\
++	movdqa d, (128*base)+96+output8x;			\
++	movdqa d3, (128*base)+96+16+output8x;
++
++.text
++
++DO_ALIGN(6)
++
++nt_crypt_all_x86_64:
++	movdqa const_stage2, t3
++	movdqa const_stage3, t4
++
++	NT_CRYPT_BODY(0)
++	NT_CRYPT_BODY(1)
++	NT_CRYPT_BODY(2)
++	NT_CRYPT_BODY(3)
++
++	ret
+--- john.orig/src/x86-64.h
++++ john/src/x86-64.h
+@@ -45,4 +45,6 @@
+ #define BF_ASM				0
+ #define BF_SCALE			1
+ 
++#define NT_X86_64
++
+ #endif
+--- john.orig/src/x86-sse.S
++++ john/src/x86-sse.S
+@@ -15,6 +15,11 @@
+ #define DES_bs_crypt			_DES_bs_crypt
+ #define DES_bs_crypt_25			_DES_bs_crypt_25
+ #define DES_bs_crypt_LM			_DES_bs_crypt_LM
++#define nt_crypt_all_sse2		_nt_crypt_all_sse2
++#define nt_buffer4x			_nt_buffer4x
++#define nt_buffer1x			_nt_buffer1x
++#define output4x			_output4x
++#define output1x			_output1x
+ #endif
+ 
+ /*
+@@ -1289,3 +1294,238 @@
+ 	jnz DES_bs_crypt_LM_loop
+ 	popl %esi
+ 	ret
++
++
++
++/*
++extern nt_crypt_all_sse2(int count);
++*/
++
++.globl nt_crypt_all_sse2
++
++.data
++DO_ALIGN(6)
++const_init_a:
++.long 0xFFFFFFFF
++.long 0xFFFFFFFF
++.long 0xFFFFFFFF
++.long 0xFFFFFFFF
++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
++
++#define a  %xmm0
++#define b  %xmm1
++#define c  %xmm2
++#define d  %xmm3
++#define t1 %xmm4
++#define t2 %xmm5
++#define t3 %xmm6
++#define t4 %xmm7
++
++#undef a3
++#define a3  %eax
++#define b3  %ebx
++#define c3  %ecx
++#define d3  %edx
++#define t13 %esi
++#define t23 %edi
++#define Q2 $0x5a827999
++#define Q3 $0x6ed9eba1
++
++/*
++#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)
++
++#define STEP(f, a, b, c, d, x, s)
++	a += f(b, c, d) + x;
++	a = (a << s) | (a >> (32 - s));
++*/
++#define STEP1(aa, bb, cc, dd, aa3, bb3, cc3, dd3, x, s, base)	\
++	paddd (256*base)+(x*16)+nt_buffer4x, aa;		\
++	add (64*base)+(x*4)+nt_buffer1x, aa3;			\
++	movdqa cc, t1;						\
++	mov cc3, t13;						\
++	pxor dd, t1;						\
++	xor dd3, t13;						\
++	pand bb, t1;						\
++	and bb3, t13;						\
++	pxor dd, t1;						\
++	xor dd3, t13;						\
++        paddd t1, aa;						\
++	add t13, aa3;						\
++        movdqa aa, t2;						\
++	rol $s, aa3;						\
++        pslld $s, aa;						\
++        psrld $(32-s), t2;					\
++        por t2, aa;
++
++#define STEP2(aa, bb, cc, dd, aa3, bb3, cc3, dd3, x, s, base)	\
++	paddd (256*base)+(x*16)+nt_buffer4x, aa;		\
++	add (64*base)+(x*4)+nt_buffer1x, aa3;			\
++	movdqa cc, t1;						\
++	mov cc3, t13;						\
++	movdqa cc, t2;						\
++	mov cc3, t23;						\
++	por dd, t1;						\
++	or dd3, t13;						\
++	pand dd, t2;						\
++	and dd3, t23;						\
++	pand bb, t1;						\
++	and bb3, t13;						\
++	paddd t3, aa;						\
++	add Q2, aa3;						\
++	por t2, t1;						\
++	or t23, t13;						\
++	paddd t1, aa;						\
++	add t13, aa3;						\
++	movdqa aa, t1;						\
++	rol $s, aa3;						\
++	pslld $s, aa;						\
++	psrld $(32-s), t1;					\
++	por t1, aa;
++
++#define STEP3(aa, bb, cc, dd, aa3, bb3, cc3, dd3, x, s, base)	\
++	paddd (256*base)+(x*16)+nt_buffer4x, aa;		\
++	add (64*base)+(x*4)+nt_buffer1x, aa3;			\
++	movdqa dd, t1;						\
++	mov dd3, t13;						\
++	pxor cc, t1;						\
++	xor cc3, t13;						\
++	paddd t4, aa;						\
++	add Q3, aa3;						\
++	pxor bb, t1;						\
++	xor bb3, t13;						\
++	paddd t1, aa;						\
++	add t13, aa3;						\
++	movdqa aa, t1;						\
++	rol $s, aa3;						\
++	pslld $s, aa;						\
++	psrld $(32-s), t1;					\
++	por t1, aa;
++
++#define NT_CRYPT_BODY(base)					\
++	movdqa const_init_a, a;					\
++	mov const_init_a, a3;					\
++	movdqa const_init_b, b;					\
++	mov const_init_b, b3;					\
++	movdqa const_init_c, c;					\
++	mov const_init_c, c3;					\
++	movdqa const_init_d, d;					\
++	mov const_init_d, d3;					\
++								\
++	paddd (256*base)+nt_buffer4x, a;			\
++	add (64*base)+nt_buffer1x, a3;				\
++	pslld $3, a;						\
++	rol   $3, a3;						\
++								\
++	STEP1(d, a, b, c, d3, a3, b3, c3, 1 , 7 , base)		\
++	STEP1(c, d, a, b, c3, d3, a3, b3, 2 , 11, base)		\
++	STEP1(b, c, d, a, b3, c3, d3, a3, 3 , 19, base)		\
++	STEP1(a, b, c, d, a3, b3, c3, d3, 4 , 3 , base)		\
++	STEP1(d, a, b, c, d3, a3, b3, c3, 5 , 7 , base)		\
++	STEP1(c, d, a, b, c3, d3, a3, b3, 6 , 11, base)		\
++	STEP1(b, c, d, a, b3, c3, d3, a3, 7 , 19, base)		\
++	STEP1(a, b, c, d, a3, b3, c3, d3, 8 , 3 , base)		\
++	STEP1(d, a, b, c, d3, a3, b3, c3, 9 , 7 , base)		\
++	STEP1(c, d, a, b, c3, d3, a3, b3, 10, 11, base)		\
++	STEP1(b, c, d, a, b3, c3, d3, a3, 11, 19, base)		\
++	STEP1(a, b, c, d, a3, b3, c3, d3, 12, 3 , base)		\
++	STEP1(d, a, b, c, d3, a3, b3, c3, 13, 7 , base)		\
++	STEP1(c, d, a, b, c3, d3, a3, b3, 14, 11, base)		\
++	STEP1(b, c, d, a, b3, c3, d3, a3, 15, 19, base)		\
++								\
++	STEP2(a, b, c, d, a3, b3, c3, d3, 0 , 3 , base)		\
++	STEP2(d, a, b, c, d3, a3, b3, c3, 4 , 5 , base)		\
++	STEP2(c, d, a, b, c3, d3, a3, b3, 8 , 9 , base)		\
++	STEP2(b, c, d, a, b3, c3, d3, a3, 12, 13, base)		\
++	STEP2(a, b, c, d, a3, b3, c3, d3, 1 , 3 , base)		\
++	STEP2(d, a, b, c, d3, a3, b3, c3, 5 , 5 , base)		\
++	STEP2(c, d, a, b, c3, d3, a3, b3, 9 , 9 , base)		\
++	STEP2(b, c, d, a, b3, c3, d3, a3, 13, 13, base)		\
++	STEP2(a, b, c, d, a3, b3, c3, d3, 2 , 3 , base)		\
++	STEP2(d, a, b, c, d3, a3, b3, c3, 6 , 5 , base)		\
++	STEP2(c, d, a, b, c3, d3, a3, b3, 10, 9 , base)		\
++	STEP2(b, c, d, a, b3, c3, d3, a3, 14, 13, base)		\
++	STEP2(a, b, c, d, a3, b3, c3, d3, 3 , 3 , base)		\
++	STEP2(d, a, b, c, d3, a3, b3, c3, 7 , 5 , base)		\
++	STEP2(c, d, a, b, c3, d3, a3, b3, 11, 9 , base)		\
++	STEP2(b, c, d, a, b3, c3, d3, a3, 15, 13, base)		\
++								\
++	STEP3(a, b, c, d, a3, b3, c3, d3, 0 , 3 , base)		\
++	STEP3(d, a, b, c, d3, a3, b3, c3, 8 , 9 , base)		\
++	STEP3(c, d, a, b, c3, d3, a3, b3, 4 , 11, base)		\
++	STEP3(b, c, d, a, b3, c3, d3, a3, 12, 15, base)		\
++	STEP3(a, b, c, d, a3, b3, c3, d3, 2 , 3 , base)		\
++	STEP3(d, a, b, c, d3, a3, b3, c3, 10, 9 , base)		\
++	STEP3(c, d, a, b, c3, d3, a3, b3, 6 , 11, base)		\
++	STEP3(b, c, d, a, b3, c3, d3, a3, 14, 15, base)		\
++	STEP3(a, b, c, d, a3, b3, c3, d3, 1 , 3 , base)		\
++	STEP3(d, a, b, c, d3, a3, b3, c3, 9 , 9 , base)		\
++	STEP3(c, d, a, b, c3, d3, a3, b3, 5 , 11, base)		\
++	movdqa a, t1;						\
++	mov a3, t13;						\
++	paddd (256*base)+208+nt_buffer4x, b;			\
++	add (64*base)+52+nt_buffer1x, b3;			\
++	pxor d, t1;						\
++	xor d3,t13;						\
++	pxor c, t1;						\
++	xor c3,t13;						\
++	paddd t1, b;						\
++	add t13,b3;						\
++								\
++	movdqa a,  (64*base)+output4x;				\
++	mov a3,  (16*base)+output1x;				\
++	movdqa b, (64*base)+16+output4x;			\
++	mov b3,  (16*base)+4+output1x;				\
++	movdqa c, (64*base)+32+output4x;			\
++	mov c3,  (16*base)+8+output1x;				\
++	movdqa d, (64*base)+48+output4x;			\
++	mov d3,  (16*base)+12+output1x;
++
++.text
++
++DO_ALIGN(6)
++
++nt_crypt_all_sse2:
++	pusha
++
++	movdqa const_stage2, t3
++	movdqa const_stage3, t4
++
++	NT_CRYPT_BODY(0)
++	NT_CRYPT_BODY(1)
++	NT_CRYPT_BODY(2)
++	NT_CRYPT_BODY(3)
++	NT_CRYPT_BODY(4)
++	NT_CRYPT_BODY(5)
++	NT_CRYPT_BODY(6)
++	NT_CRYPT_BODY(7)
++
++	popa
++
++	ret
+--- john.orig/src/x86-sse.h
++++ john/src/x86-sse.h
+@@ -58,4 +58,6 @@
+ #define BF_ASM				1
+ #define BF_SCALE			1
+ 
++#define NT_SSE2
++
+ #endif

Deleted: trunk/debian/patches/01-amd64.patch
===================================================================
--- trunk/debian/patches/01-amd64.patch	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/patches/01-amd64.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -1,104 +0,0 @@
---- john.orig/src/loader.c
-+++ john/src/loader.c
-@@ -31,7 +31,7 @@
- #define issep \
- 	"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\177"
- 
--static char issep_map[0x100];
-+static unsigned char issep_map[0x100];
- static int issep_initialized = 0;
- 
- static void read_file(struct db_main *db, char *name, int flags,
-@@ -67,7 +67,7 @@
- 
- static void ldr_init_issep(void)
- {
--	char *pos;
-+	unsigned char *pos;
- 
- 	if (issep_initialized) return;
- 
-@@ -241,7 +241,7 @@
- 
- static void ldr_split_string(struct list_main *dst, char *src)
- {
--	char *word, *pos;
-+	unsigned char *word, *pos;
- 
- 	pos = src;
- 	do {
---- john.orig/src/rules.c
-+++ john/src/rules.c
-@@ -126,9 +126,9 @@
- 	for (pos = 0; (out[pos] = (conv)[ARCH_INDEX(in[pos])]); pos++); \
- }
- 
--static void rules_init_class(char name, char *valid)
-+static void rules_init_class(unsigned char name, char *valid)
- {
--	char *pos, inv;
-+	unsigned char *pos, inv;
- 
- 	rules_classes[ARCH_INDEX(name)] =
- 		mem_alloc_tiny(0x100, MEM_ALIGN_NONE);
-@@ -163,7 +163,7 @@
- 	rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_DIGITS);
- }
- 
--static char *rules_init_conv(char *src, char *dst)
-+static char *rules_init_conv(unsigned char *src, char *dst)
- {
- 	char *conv;
- 	int pos;
-@@ -215,7 +215,7 @@
- 	rules_errno = RULES_ERROR_NONE;
- }
- 
--char *rules_reject(char *rule, struct db_main *db)
-+char *rules_reject(unsigned char *rule, struct db_main *db)
- {
- 	while (RULE)
- 	switch (LAST) {
-@@ -257,10 +257,10 @@
- 	return rule - 1;
- }
- 
--char *rules_apply(char *word, char *rule, int split)
-+char *rules_apply(char *word, unsigned char *rule, int split)
- {
--	static char buffer[3][RULE_WORD_SIZE * 2];
--	char *in = buffer[0], *out = buffer[1];
-+	static unsigned char buffer[3][RULE_WORD_SIZE * 2];
-+	unsigned char *in = buffer[0], *out = buffer[1];
- 	char memory[RULE_WORD_SIZE];
- 	int memory_empty, which;
- 	char value, *class;
-@@ -653,7 +653,7 @@
- int rules_check(struct rpp_context *start, int split)
- {
- 	struct rpp_context ctx;
--	char *rule;
-+	unsigned char *rule;
- 	int count;
- 
- 	rules_errno = RULES_ERROR_NONE;
---- john.orig/src/rules.h
-+++ john/src/rules.h
-@@ -51,7 +51,7 @@
-  * error. If the database is NULL, all rules are accepted (to be used
-  * for syntax checking).
-  */
--extern char *rules_reject(char *rule, struct db_main *db);
-+extern char *rules_reject(unsigned char *rule, struct db_main *db);
- 
- /*
-  * Applies rule to a word. Returns the updated word, or NULL if rejected or
-@@ -61,7 +61,7 @@
-  * split == 0	"single crack" mode, only one word
-  * split < 0	other cracking modes, "single crack" mode rules are invalid
-  */
--extern char *rules_apply(char *word, char *rule, int split);
-+extern char *rules_apply(char *word, unsigned char *rule, int split);
- 
- /*
-  * Checks if all the rules for context are valid. Returns the number of rules,

Added: trunk/debian/patches/02-add_MS-Credential-Cache.patch
===================================================================
--- trunk/debian/patches/02-add_MS-Credential-Cache.patch	                        (rev 0)
+++ trunk/debian/patches/02-add_MS-Credential-Cache.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -0,0 +1,631 @@
+--- john.orig/src/Makefile
++++ john/src/Makefile
+@@ -33,6 +33,7 @@
+ 	AFS_fmt.o \
+ 	LM_fmt.o \
+ 	NT_fmt.o \
++	mscash_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 \
+--- john.orig/src/loader.c
++++ john/src/loader.c
+@@ -308,6 +308,7 @@
+ 	struct db_password *current_pw, *last_pw;
+ 	struct list_main *words;
+ 	size_t pw_size, salt_size;
++	extern struct fmt_main fmt_mscash;
+ 
+ 	count = ldr_split_line(&login, &ciphertext, &gecos, &home,
+ 		NULL, &db->format, db->options, line);
+@@ -333,6 +334,13 @@
+ 	}
+ 
+ 	for (index = 0; index < count; index++) {
++		if (db->format == &fmt_mscash)
++		{
++			piece = (char *) mem_alloc(strlen(login) + strlen(ciphertext) + 4);
++			sprintf(piece, "M$%s#%s", login, ciphertext);
++			ciphertext = piece;
++		}
++
+ 		piece = format->methods.split(ciphertext, index);
+ 
+ 		binary = format->methods.binary(piece);
+@@ -665,6 +673,7 @@
+ 	int pass, found, chars;
+ 	int hash;
+ 	struct db_cracked *current;
++	extern struct fmt_main fmt_mscash;
+ 
+ 	format = NULL;
+ 	count = ldr_split_line(&login, &ciphertext, &gecos, &home,
+@@ -676,6 +685,12 @@
+ 	if (format) {
+ 		split = format->methods.split;
+ 		unify = format->params.flags & FMT_SPLIT_UNIFIES_CASE;
++		if(format == &fmt_mscash)
++                {
++                        char * ciphertext2 = (char *) mem_alloc(strlen(login) + strlen(ciphertext) + 4);
++                        sprintf(ciphertext2, "M$%s#%s", login, ciphertext);
++                        ciphertext = ciphertext2;
++                }
+ 	} else {
+ 		split = fmt_default_split;
+ 		count = 1;
+--- /dev/null
++++ john/src/mscash_fmt.c
+@@ -0,0 +1,544 @@
++/* MSCASH patch for john (performance improvement)
++ *
++ * Written by Alain Espinosa <alainesp at gmail.com> in 2007
++ * and placed in the public domain.
++ */
++
++#include <string.h>
++#include "arch.h"
++#include "misc.h"
++#include "memory.h"
++#include "common.h"
++#include "formats.h"
++
++#define FORMAT_LABEL			"mscash"
++#define FORMAT_NAME			"M$ Cache Hash"
++
++#define BENCHMARK_COMMENT		""
++#define BENCHMARK_LENGTH		0
++
++#define PLAINTEXT_LENGTH		27
++#define MAX_CIPHERTEXT_LENGTH		(2 + 32 + 1 + 32)
++
++
++static struct fmt_tests tests[] = {
++	{"M$test1#64cd29e36a8431a2b111378564a10631", "test1" },
++	{"M$test2#ab60bdb4493822b175486810ac2abe63", "test2" },
++	{"M$test3#14dd041848e12fc48c0aa7a416a4a00c", "test3" },
++	{"M$test4#b945d24866af4b01a6d89b9d932a153c", "test4" },
++	{NULL}
++};
++
++#define ALGORITHM_NAME			"Generic 1x"
++
++#define BINARY_SIZE			16
++#define SALT_SIZE			(11*4)
++
++#define MS_NUM_KEYS			64
++#define MIN_KEYS_PER_CRYPT		MS_NUM_KEYS
++#define MAX_KEYS_PER_CRYPT		MS_NUM_KEYS
++
++
++unsigned int ms_buffer1x[16*MS_NUM_KEYS];
++unsigned int output1x[4*MS_NUM_KEYS];
++
++unsigned int crypt[4*MS_NUM_KEYS];
++unsigned int last[4*MS_NUM_KEYS];
++
++unsigned int last_i[MS_NUM_KEYS];
++char saved_plain[32*MS_NUM_KEYS];
++
++unsigned int *salt_buffer;
++unsigned int new_key;
++
++//Init values
++#define INIT_A 0x67452301
++#define INIT_B 0xefcdab89
++#define INIT_C 0x98badcfe
++#define INIT_D 0x10325476
++
++#define SQRT_2 0x5a827999
++#define SQRT_3 0x6ed9eba1
++
++static void init(void)
++{
++	memset(ms_buffer1x,0,64*MS_NUM_KEYS);
++	memset(last_i,0,4*MS_NUM_KEYS);
++	new_key=1;
++}
++
++static char * ms_split(char *ciphertext, int index)
++{
++	static char out[MAX_CIPHERTEXT_LENGTH + 1];
++	int i=0;
++
++	for(; ciphertext[i] && i < MAX_CIPHERTEXT_LENGTH; i++)
++		out[i]=ciphertext[i];
++
++	out[i]=0;
++
++	if (i >= 32)
++		strlwr(&out[i-32]);
++
++	return out;
++}
++
++static int valid(char *ciphertext)
++{
++	unsigned int i;
++	unsigned 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 (!strncmp(ciphertext, "M$", 2))
++	{
++		l = strlen(ciphertext);
++		if (l <= 32 || l > MAX_CIPHERTEXT_LENGTH)
++			return 0;
++		l -= 32;
++		if(ciphertext[l-1]!='#')
++			return 0;
++	}
++	else
++	{
++		if(strlen(ciphertext)!=32)
++			return 0;
++		l = 0;
++	}
++	for (i = l; i < l + 32; i++)
++		if (atoi16[ARCH_INDEX(ciphertext[i])] == 0x7F)
++			return 0;
++
++	return 1;
++}
++
++static void set_salt(void *salt) {
++	salt_buffer=salt;
++}
++
++static void * get_salt(char * ciphertext)
++{
++	//lenght=11 for save memory
++	//last position = 0
++	//4 first position are crypt[?]
++	static unsigned int out[11];
++	unsigned int md4_size=0;
++
++	memset(out,0,44);
++
++	ciphertext+=2;
++
++	for(;;md4_size++)
++		if(ciphertext[md4_size]!='#' && md4_size < 19)
++		{
++			md4_size++;
++
++			out[md4_size>>1] = ciphertext[md4_size-1] | ((ciphertext[md4_size]!='#') ? (ciphertext[md4_size]<<16) : 0x800000);
++
++			if(ciphertext[md4_size]=='#')
++				break;
++		}
++		else
++		{
++			out[md4_size>>1] = 0x80;
++			break;
++		}
++
++	out[10] = (8 + md4_size) << 4;
++
++	return out;
++}
++
++static void *get_binary(char *ciphertext)
++{
++	static unsigned int out[4];
++	unsigned int i=0;
++	unsigned int temp;
++	unsigned int * salt=get_salt(ciphertext);
++
++	for(;ciphertext[0]!='#';ciphertext++);
++
++	ciphertext++;
++
++	for(; i<4 ;i++)
++	{
++		temp  = (atoi16[ARCH_INDEX(ciphertext[i*8+0])])<<4;
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+1])]);
++
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+2])])<<12;
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+3])])<<8;
++
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+4])])<<20;
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+5])])<<16;
++
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+6])])<<28;
++		temp |= (atoi16[ARCH_INDEX(ciphertext[i*8+7])])<<24;
++
++		out[i]=temp;
++	}
++
++	out[0] -= INIT_A;
++	out[1] -= INIT_B;
++	out[2] -= INIT_C;
++	out[3] -= INIT_D;
++
++	// Reversed	b += (c ^ d ^ a) + salt_buffer[11] +  SQRT_3; b = (b << 15) | (b >> 17);
++	out[1]  = (out[1] >> 15) | (out[1] << 17);
++	out[1] -= SQRT_3 + (out[2] ^ out[3] ^ out[0]);
++	// Reversed	c += (d ^ a ^ b) + salt_buffer[3]  +  SQRT_3; c = (c << 11) | (c >> 21);
++	out[2] = (out[2] << 21) | (out[2] >> 11);
++	out[2]-= SQRT_3 + (out[3] ^ out[0] ^ out[1]) + salt[3];
++	// Reversed	d += (a ^ b ^ c) + salt_buffer[7]  +  SQRT_3; d = (d << 9 ) | (d >> 23);
++	out[3]  = (out[3] << 23) | (out[3] >> 9);
++	out[3] -= SQRT_3 + (out[0] ^ out[1] ^ out[2]) + salt[7];
++	//+ SQRT_3; d = (d << 9 ) | (d >> 23);
++	out[3]=(out[3] << 23 ) | (out[3] >> 9);
++	out[3]-=SQRT_3;
++
++	return out;
++}
++
++static int binary_hash_0(void *binary)
++{
++	return ((unsigned int*)binary)[3] & 0x0F;
++}
++
++static int binary_hash_1(void *binary)
++{
++	return ((unsigned int*)binary)[3] & 0xFF;
++}
++
++static int binary_hash_2(void *binary)
++{
++	return ((unsigned int*)binary)[3] & 0x0FFF;
++}
++
++static int get_hash_0(int index)
++{
++	return output1x[4*index+3] & 0x0F;
++}
++
++static int get_hash_1(int index)
++{
++	return output1x[4*index+3] & 0xFF;
++}
++
++static int get_hash_2(int index)
++{
++	return output1x[4*index+3] & 0x0FFF;
++}
++
++void nt_hash(void)
++{
++	unsigned int a;
++	unsigned int b;
++	unsigned int c;
++	unsigned int d;
++	unsigned int i=0;
++
++	for(;i<MS_NUM_KEYS;i++)
++	{
++		/* Round 1 */
++		a = 		0xFFFFFFFF 		  + ms_buffer1x[16*i+0];a = (a << 3 ) | (a >> 29);
++		d = INIT_D + (INIT_C ^ (a & 0x77777777))  + ms_buffer1x[16*i+1];d = (d << 7 ) | (d >> 25);
++		c = INIT_C + (INIT_B ^ (d & (a ^ INIT_B)))+ ms_buffer1x[16*i+2];c = (c << 11) | (c >> 21);
++		b =    INIT_B + (a ^ (c & (d ^ a))) 	  + ms_buffer1x[16*i+3];b = (b << 19) | (b >> 13);
++
++		a += (d ^ (b & (c ^ d))) + ms_buffer1x[16*i+4]  ;a = (a << 3 ) | (a >> 29);
++		d += (c ^ (a & (b ^ c))) + ms_buffer1x[16*i+5]  ;d = (d << 7 ) | (d >> 25);
++		c += (b ^ (d & (a ^ b))) + ms_buffer1x[16*i+6]  ;c = (c << 11) | (c >> 21);
++		b += (a ^ (c & (d ^ a))) + ms_buffer1x[16*i+7]  ;b = (b << 19) | (b >> 13);
++
++		a += (d ^ (b & (c ^ d))) + ms_buffer1x[16*i+8]  ;a = (a << 3 ) | (a >> 29);
++		d += (c ^ (a & (b ^ c))) + ms_buffer1x[16*i+9]  ;d = (d << 7 ) | (d >> 25);
++		c += (b ^ (d & (a ^ b))) + ms_buffer1x[16*i+10] ;c = (c << 11) | (c >> 21);
++		b += (a ^ (c & (d ^ a))) + ms_buffer1x[16*i+11] ;b = (b << 19) | (b >> 13);
++
++		a += (d ^ (b & (c ^ d))) + ms_buffer1x[16*i+12] ;a = (a << 3 ) | (a >> 29);
++		d += (c ^ (a & (b ^ c))) + ms_buffer1x[16*i+13] ;d = (d << 7 ) | (d >> 25);
++		c += (b ^ (d & (a ^ b))) + ms_buffer1x[16*i+14] ;c = (c << 11) | (c >> 21);
++		b += (a ^ (c & (d ^ a)))/*+ms_buffer1x[16*i+15]*/;b = (b << 19) | (b >> 13);
++
++		/* Round 2 */
++		a += ((b & (c | d)) | (c & d)) + ms_buffer1x[16*i+0]  + SQRT_2; a = (a << 3 ) | (a >> 29);
++		d += ((a & (b | c)) | (b & c)) + ms_buffer1x[16*i+4]  + SQRT_2; d = (d << 5 ) | (d >> 27);
++		c += ((d & (a | b)) | (a & b)) + ms_buffer1x[16*i+8]  + SQRT_2; c = (c << 9 ) | (c >> 23);
++		b += ((c & (d | a)) | (d & a)) + ms_buffer1x[16*i+12] + SQRT_2; b = (b << 13) | (b >> 19);
++
++		a += ((b & (c | d)) | (c & d)) + ms_buffer1x[16*i+1]  + SQRT_2; a = (a << 3 ) | (a >> 29);
++		d += ((a & (b | c)) | (b & c)) + ms_buffer1x[16*i+5]  + SQRT_2; d = (d << 5 ) | (d >> 27);
++		c += ((d & (a | b)) | (a & b)) + ms_buffer1x[16*i+9]  + SQRT_2; c = (c << 9 ) | (c >> 23);
++		b += ((c & (d | a)) | (d & a)) + ms_buffer1x[16*i+13] + SQRT_2; b = (b << 13) | (b >> 19);
++
++		a += ((b & (c | d)) | (c & d)) + ms_buffer1x[16*i+2]  + SQRT_2; a = (a << 3 ) | (a >> 29);
++		d += ((a & (b | c)) | (b & c)) + ms_buffer1x[16*i+6]  + SQRT_2; d = (d << 5 ) | (d >> 27);
++		c += ((d & (a | b)) | (a & b)) + ms_buffer1x[16*i+10] + SQRT_2; c = (c << 9 ) | (c >> 23);
++		b += ((c & (d | a)) | (d & a)) + ms_buffer1x[16*i+14] + SQRT_2; b = (b << 13) | (b >> 19);
++
++		a += ((b & (c | d)) | (c & d)) + ms_buffer1x[16*i+3]  + SQRT_2; a = (a << 3 ) | (a >> 29);
++		d += ((a & (b | c)) | (b & c)) + ms_buffer1x[16*i+7]  + SQRT_2; d = (d << 5 ) | (d >> 27);
++		c += ((d & (a | b)) | (a & b)) + ms_buffer1x[16*i+11] + SQRT_2; c = (c << 9 ) | (c >> 23);
++		b += ((c & (d | a)) | (d & a))/*+ms_buffer1x[16*i+15]*/+SQRT_2; b = (b << 13) | (b >> 19);
++
++		/* Round 3 */
++		a += (b ^ c ^ d) + ms_buffer1x[16*i+0]  + SQRT_3; a = (a << 3 ) | (a >> 29);
++		d += (a ^ b ^ c) + ms_buffer1x[16*i+8]  + SQRT_3; d = (d << 9 ) | (d >> 23);
++		c += (d ^ a ^ b) + ms_buffer1x[16*i+4]  + SQRT_3; c = (c << 11) | (c >> 21);
++		b += (c ^ d ^ a) + ms_buffer1x[16*i+12] + SQRT_3; b = (b << 15) | (b >> 17);
++
++		a += (b ^ c ^ d) + ms_buffer1x[16*i+2]  + SQRT_3; a = (a << 3 ) | (a >> 29);
++		d += (a ^ b ^ c) + ms_buffer1x[16*i+10] + SQRT_3; d = (d << 9 ) | (d >> 23);
++		c += (d ^ a ^ b) + ms_buffer1x[16*i+6]  + SQRT_3; c = (c << 11) | (c >> 21);
++		b += (c ^ d ^ a) + ms_buffer1x[16*i+14] + SQRT_3; b = (b << 15) | (b >> 17);
++
++		a += (b ^ c ^ d) + ms_buffer1x[16*i+1]  + SQRT_3; a = (a << 3 ) | (a >> 29);
++		d += (a ^ b ^ c) + ms_buffer1x[16*i+9]  + SQRT_3; d = (d << 9 ) | (d >> 23);
++		c += (d ^ a ^ b) + ms_buffer1x[16*i+5]  + SQRT_3; c = (c << 11) | (c >> 21);
++		b += (c ^ d ^ a) + ms_buffer1x[16*i+13] + SQRT_3; b = (b << 15) | (b >> 17);
++
++		a += (b ^ c ^ d) + ms_buffer1x[16*i+3]  + SQRT_3; a = (a << 3 ) | (a >> 29);
++		d += (a ^ b ^ c) + ms_buffer1x[16*i+11] + SQRT_3; d = (d << 9 ) | (d >> 23);
++		c += (d ^ a ^ b) + ms_buffer1x[16*i+7]  + SQRT_3; c = (c << 11) | (c >> 21);
++		b += (c ^ d ^ a) /*+ ms_buffer1x[16*i+15] */+ SQRT_3; b = (b << 15) | (b >> 17);
++
++		crypt[4*i+0] = a + INIT_A;
++		crypt[4*i+1] = b + INIT_B;
++		crypt[4*i+2] = c + INIT_C;
++		crypt[4*i+3] = d + INIT_D;
++
++		//Another MD4_crypt for the salt
++		/* Round 1 */
++		a= 	        0xFFFFFFFF 	            +crypt[4*i+0]; a=(a<<3 )|(a>>29);
++		d=INIT_D + ( INIT_C ^ ( a & 0x77777777))    +crypt[4*i+1]; d=(d<<7 )|(d>>25);
++		c=INIT_C + ( INIT_B ^ ( d & ( a ^ INIT_B))) +crypt[4*i+2]; c=(c<<11)|(c>>21);
++		b=INIT_B + (    a   ^ ( c & ( d ^    a  ))) +crypt[4*i+3]; b=(b<<19)|(b>>13);
++
++		last[4*i+0]=a;
++		last[4*i+1]=b;
++		last[4*i+2]=c;
++		last[4*i+3]=d;
++	}
++}
++
++static void crypt_all(int count)
++{
++	unsigned int a;
++	unsigned int b;
++	unsigned int c;
++	unsigned int d;
++	unsigned int i=0;
++
++	if(new_key)
++	{
++		new_key=0;
++		nt_hash();
++	}
++
++	for(;i<MS_NUM_KEYS;i++)
++	{
++		a = last[4*i+0];
++		b = last[4*i+1];
++		c = last[4*i+2];
++		d = last[4*i+3];
++
++		a += (d ^ (b & (c ^ d)))  + salt_buffer[0]  ;a = (a << 3 ) | (a >> 29);
++		d += (c ^ (a & (b ^ c)))  + salt_buffer[1]  ;d = (d << 7 ) | (d >> 25);
++		c += (b ^ (d & (a ^ b)))  + salt_buffer[2]  ;c = (c << 11) | (c >> 21);
++		b += (a ^ (c & (d ^ a)))  + salt_buffer[3]  ;b = (b << 19) | (b >> 13);
++
++		a += (d ^ (b & (c ^ d)))  + salt_buffer[4]  ;a = (a << 3 ) | (a >> 29);
++		d += (c ^ (a & (b ^ c)))  + salt_buffer[5]  ;d = (d << 7 ) | (d >> 25);
++		c += (b ^ (d & (a ^ b)))  + salt_buffer[6]  ;c = (c << 11) | (c >> 21);
++		b += (a ^ (c & (d ^ a)))  + salt_buffer[7]  ;b = (b << 19) | (b >> 13);
++
++		a += (d ^ (b & (c ^ d)))  + salt_buffer[8]  ;a = (a << 3 ) | (a >> 29);
++		d += (c ^ (a & (b ^ c)))  + salt_buffer[9]  ;d = (d << 7 ) | (d >> 25);
++		c += (b ^ (d & (a ^ b)))  + salt_buffer[10] ;c = (c << 11) | (c >> 21);
++		b += (a ^ (c & (d ^ a)))/*+salt_buffer[11]*/;b = (b << 19) | (b >> 13);
++
++		/* Round 2 */
++		a += ((b & (c | d)) | (c & d))  +  crypt[4*i+0]    + SQRT_2; a = (a << 3 ) | (a >> 29);
++		d += ((a & (b | c)) | (b & c))  +  salt_buffer[0]  + SQRT_2; d = (d << 5 ) | (d >> 27);
++		c += ((d & (a | b)) | (a & b))  +  salt_buffer[4]  + SQRT_2; c = (c << 9 ) | (c >> 23);
++		b += ((c & (d | a)) | (d & a))  +  salt_buffer[8]  + SQRT_2; b = (b << 13) | (b >> 19);
++
++		a += ((b & (c | d)) | (c & d))  +  crypt[4*i+1]    + SQRT_2; a = (a << 3 ) | (a >> 29);
++		d += ((a & (b | c)) | (b & c))  +  salt_buffer[1]  + SQRT_2; d = (d << 5 ) | (d >> 27);
++		c += ((d & (a | b)) | (a & b))  +  salt_buffer[5]  + SQRT_2; c = (c << 9 ) | (c >> 23);
++		b += ((c & (d | a)) | (d & a))  +  salt_buffer[9]  + SQRT_2; b = (b << 13) | (b >> 19);
++
++		a += ((b & (c | d)) | (c & d))  +  crypt[4*i+2]    + SQRT_2; a = (a << 3 ) | (a >> 29);
++		d += ((a & (b | c)) | (b & c))  +  salt_buffer[2]  + SQRT_2; d = (d << 5 ) | (d >> 27);
++		c += ((d & (a | b)) | (a & b))  +  salt_buffer[6]  + SQRT_2; c = (c << 9 ) | (c >> 23);
++		b += ((c & (d | a)) | (d & a))  +  salt_buffer[10] + SQRT_2; b = (b << 13) | (b >> 19);
++
++		a += ((b & (c | d)) | (c & d))  +  crypt[4*i+3]    + SQRT_2; a = (a << 3 ) | (a >> 29);
++		d += ((a & (b | c)) | (b & c))  +  salt_buffer[3]  + SQRT_2; d = (d << 5 ) | (d >> 27);
++		c += ((d & (a | b)) | (a & b))  +  salt_buffer[7]  + SQRT_2; c = (c << 9 ) | (c >> 23);
++		b += ((c & (d | a)) | (d & a))/*+ salt_buffer[11]*/+ SQRT_2; b = (b << 13) | (b >> 19);
++
++		/* Round 3 */
++		a += (b ^ c ^ d) + crypt[4*i+0]    +  SQRT_3; a = (a << 3 ) | (a >> 29);
++		d += (a ^ b ^ c) + salt_buffer[4]  +  SQRT_3; d = (d << 9 ) | (d >> 23);
++		c += (d ^ a ^ b) + salt_buffer[0]  +  SQRT_3; c = (c << 11) | (c >> 21);
++		b += (c ^ d ^ a) + salt_buffer[8]  +  SQRT_3; b = (b << 15) | (b >> 17);
++
++		a += (b ^ c ^ d) + crypt[4*i+2]    +  SQRT_3; a = (a << 3 ) | (a >> 29);
++		d += (a ^ b ^ c) + salt_buffer[6]  +  SQRT_3; d = (d << 9 ) | (d >> 23);
++		c += (d ^ a ^ b) + salt_buffer[2]  +  SQRT_3; c = (c << 11) | (c >> 21);
++		b += (c ^ d ^ a) + salt_buffer[10] +  SQRT_3; b = (b << 15) | (b >> 17);
++
++		a += (b ^ c ^ d) + crypt[4*i+1]    +  SQRT_3; a = (a << 3 ) | (a >> 29);
++		d += (a ^ b ^ c) + salt_buffer[5];
++
++		output1x[4*i+0]=a;
++		output1x[4*i+1]=b;
++		output1x[4*i+2]=c;
++		output1x[4*i+3]=d;
++	}
++}
++
++static int cmp_all(void *binary, int count)
++{
++	unsigned int i=0;
++	unsigned int d=((unsigned int *)binary)[3];
++
++	for(;i<MS_NUM_KEYS;i++)
++		if(d==output1x[i*4+3])
++			return 1;
++
++	return 0;
++}
++
++static int cmp_one(void * binary, int index)
++{
++	unsigned int *t=(unsigned int *)binary;
++	unsigned int a=output1x[4*index+0];
++	unsigned int b=output1x[4*index+1];
++	unsigned int c=output1x[4*index+2];
++	unsigned int d=output1x[4*index+3];
++
++	if(d!=t[3])
++		return 0;
++	d+=SQRT_3;d = (d << 9 ) | (d >> 23);
++
++	c += (d ^ a ^ b) + salt_buffer[1]  +  SQRT_3; c = (c << 11) | (c >> 21);
++	if(c!=t[2])
++		return 0;
++
++	b += (c ^ d ^ a) + salt_buffer[9]  +  SQRT_3; b = (b << 15) | (b >> 17);
++	if(b!=t[1])
++		return 0;
++
++	a += (b ^ c ^ d) + crypt[4*index+3]+  SQRT_3; a = (a << 3 ) | (a >> 29);
++	return (a==t[0]);
++}
++
++static int cmp_exact(char *source, int index)
++{
++	// This check its for the unreal case of collisions.
++	// It verify that the salts its the same.
++	unsigned int *salt=get_salt(source);
++	unsigned int i=0;
++	for(;i<11;i++)
++		if(salt[i]!=salt_buffer[i])
++			return 0;
++	return 1;
++}
++
++static void set_key(char *key, int index)
++{
++	unsigned int md4_size=0;
++	unsigned int i=0;
++	unsigned int temp;
++	unsigned int saved_base=index<<5;
++	unsigned int buff_base=index<<4;
++
++	for(;key[md4_size] && md4_size<PLAINTEXT_LENGTH;i++,md4_size++)
++	{
++		saved_plain[saved_base+md4_size]=key[md4_size];
++		temp=key[++md4_size];
++		saved_plain[saved_base+md4_size]=temp;
++
++		if(temp)
++		{
++			ms_buffer1x[buff_base+i] = key[md4_size-1] | (temp<<16);
++		}
++		else
++		{
++			ms_buffer1x[buff_base+i] = key[md4_size-1] | 0x800000;
++			goto key_cleaning;
++		}
++	}
++
++	ms_buffer1x[buff_base+i]=0x80;
++	saved_plain[saved_base+md4_size]=0;
++
++key_cleaning:
++	i++;
++	for(;i<=last_i[index];i++)
++		ms_buffer1x[buff_base+i]=0;
++
++	last_i[index]=md4_size>>1;
++
++	ms_buffer1x[buff_base+14] = md4_size << 4;
++
++	//new password_candidate
++	new_key=1;
++}
++
++static char *get_key(int index)
++{
++	return saved_plain+(index<<5);
++}
++
++int salt_hash(void *salt)
++{
++	return ((unsigned char*)salt)[0];
++}
++
++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 | FMT_SPLIT_UNIFIES_CASE,
++		tests
++	}, {
++		init,
++		valid,
++		ms_split,
++		get_binary,
++		get_salt,
++		{
++			binary_hash_0,
++			binary_hash_1,
++			binary_hash_2
++		},
++		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
++	}
++};
+--- john.orig/src/options.c
++++ john/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT           load salts with[out] at least COUNT passwords " \
+ 	"only\n" \
+ "--format=NAME              force ciphertext format NAME: " \
+-	"DES/BSDI/MD5/BF/AFS/LM/NT\n" \
++	"DES/BSDI/MD5/BF/AFS/LM/NT/mscash\n" \
+ "--save-memory=LEVEL        enable memory saving, at LEVEL 1..3\n"
+ 
+ void opt_init(char *name, int argc, char **argv)
+--- john.orig/src/john.c
++++ john/src/john.c
+@@ -39,6 +39,7 @@
+ 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_NT;
++extern struct fmt_main fmt_mscash;
+ 
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -66,6 +67,7 @@
+ 	john_register_one(&fmt_AFS);
+ 	john_register_one(&fmt_LM);
+ 	john_register_one(&fmt_NT);
++	john_register_one(&fmt_mscash);
+ 
+ 
+ 	if (!fmt_list) {

Deleted: trunk/debian/patches/02-mipsel.patch
===================================================================
--- trunk/debian/patches/02-mipsel.patch	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/patches/02-mipsel.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -1,120 +0,0 @@
---- john.orig/src/Makefile
-+++ john/src/Makefile
-@@ -88,6 +88,8 @@
- 	@echo "linux-ppc32              Linux, PowerPC 32-bit"
- #	@echo "linux-ppc64-altivec      Linux, PowerPC 64-bit w/AltiVec"
- 	@echo "linux-ppc64              Linux, PowerPC 64-bit"
-+	@echo "linux-mips               Linux, MIPS"
-+	@echo "linux-mipsel             Linux, MIPSel"
- 	@echo "freebsd-x86-sse2         FreeBSD, x86 with SSE2 (best)"
- 	@echo "freebsd-x86-mmx          FreeBSD, x86 with MMX"
- 	@echo "freebsd-x86-any          FreeBSD, x86"
-@@ -245,6 +247,16 @@
- 		JOHN_OBJS="$(JOHN_OBJS) x86.o" \
- 		ASFLAGS="$(ASFLAGS) -DBSD"
- 
-+linux-mips: mips.h
-+	$(LN) mips.h arch.h
-+	$(MAKE) $(PROJ) \
-+		JOHN_OBJS="$(BITSLICE_OBJS) $(JOHN_OBJS)"
-+
-+linux-mipsel: mipsel.h
-+	$(LN) mipsel.h arch.h
-+	$(MAKE) $(PROJ) \
-+		JOHN_OBJS="$(BITSLICE_OBJS) $(JOHN_OBJS)"
-+
- freebsd-x86-any-a.out:
- 	$(LN) x86-any.h arch.h
- 	$(MAKE) $(PROJ) \
---- /dev/null
-+++ john/src/mipsel.h
-@@ -0,0 +1,43 @@
-+/*
-+ * This file is part of John the Ripper password cracker,
-+ * Copyright (c) 1996-98 by Solar Designer
-+ */
-+
-+/*
-+ * Architecture specific parameters for little-endian MIPS.
-+ */
-+
-+#ifndef _JOHN_ARCH_H
-+#define _JOHN_ARCH_H
-+
-+#define ARCH_GENERIC			1
-+#define ARCH_WORD			long
-+#define ARCH_SIZE			4
-+#define ARCH_BITS			32
-+#define ARCH_BITS_STR			"32"
-+#define ARCH_LITTLE_ENDIAN		1
-+#define ARCH_INT_GT_32			0
-+#define ARCH_ALLOWS_UNALIGNED		0
-+#define ARCH_INDEX			unsigned int
-+
-+#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			0
-+#define DES_SCALE			1
-+#define DES_EXTB			0
-+#define DES_COPY			1
-+#define DES_BS				0
-+
-+#define MD5_ASM				0
-+#define MD5_IMM				0
-+
-+#define BF_ASM				0
-+#define BF_SCALE			0
-+
-+#endif
---- /dev/null
-+++ john/src/mips.h
-@@ -0,0 +1,43 @@
-+/*
-+ * This file is part of John the Ripper password cracker,
-+ * Copyright (c) 1996-98 by Solar Designer
-+ */
-+
-+/*
-+ * Architecture specific parameters for big-endian MIPS.
-+ */
-+
-+#ifndef _JOHN_ARCH_H
-+#define _JOHN_ARCH_H
-+
-+#define ARCH_GENERIC			1
-+#define ARCH_WORD			long
-+#define ARCH_SIZE			4
-+#define ARCH_BITS			32
-+#define ARCH_BITS_STR			"32"
-+#define ARCH_LITTLE_ENDIAN		0
-+#define ARCH_INT_GT_32			0
-+#define ARCH_ALLOWS_UNALIGNED		0
-+#define ARCH_INDEX			unsigned int
-+
-+#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			0
-+#define DES_SCALE			1
-+#define DES_EXTB			0
-+#define DES_COPY			1
-+#define DES_BS				0
-+
-+#define MD5_ASM				0
-+#define MD5_IMM				0
-+
-+#define BF_ASM				0
-+#define BF_SCALE			0
-+
-+#endif

Added: trunk/debian/patches/03-add_NetLM-NetNTLM.patch
===================================================================
--- trunk/debian/patches/03-add_NetLM-NetNTLM.patch	                        (rev 0)
+++ trunk/debian/patches/03-add_NetLM-NetNTLM.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -0,0 +1,1264 @@
+--- john.orig/src/Makefile
++++ john/src/Makefile
+@@ -18,6 +18,7 @@
+ CFLAGS = -c -Wall -O2 -fomit-frame-pointer
+ ASFLAGS = -c
+ LDFLAGS = -s
++LIBS = -lcrypto
+ 
+ # -funroll-loops set in debian/rules, for failed build on ARM.
+ # Please see #476460
+@@ -34,6 +35,9 @@
+ 	LM_fmt.o \
+ 	NT_fmt.o \
+ 	mscash_fmt.o \
++	NETLM_fmt.o \
++	NETNTLM_fmt.o \
++	md4.o smbencrypt.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 \
+@@ -663,7 +667,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
+--- /dev/null
++++ john/src/NETLM_fmt.c
+@@ -0,0 +1,249 @@
++/*
++ * NETLM_fmt.c -- LM Challenge/Response
++ *
++ * Written by JoMo-Kun <jmk at foofus.net> in 2007
++ * and placed in the public domain.
++ *
++ * This algorithm is designed for performing brute-force cracking of the LM
++ * challenge/response pairs exchanged during network-based authentication
++ * attempts [1]. The captured challenge/response pairs from these attempts
++ * should be stored using the L0phtCrack 2.0 LC format, specifically:
++ * username:unused:unused:lm response:ntlm response:challenge. For example:
++ *
++ * CORP\Administrator:::25B2B477CE101D83648BB087CE7A1C217F51C7FC64C0EBB1::
++ * C8BD0C1630A9ECF7A95F494A8F0B2CB4A3F25B1225514304:1122334455667788
++ *
++ * It should be noted that a LM authentication response is not same as a LM
++ * password hash, which can be extracted using tools such as FgDump [2]. LM
++ * responses can be gathered via normal network capture or via tools which
++ * perform layer 2 attacks, such as Ettercap [3] and Cain [4]. The responses can
++ * also be harvested using a modified Samba service [5] in conjunction with
++ * some trickery to convince the user to connect to it. I leave what that
++ * trickery may actually be as an exercise for the reader (HINT: Karma, NMB
++ * broadcasts, IE, Outlook, social engineering, ...).
++ *
++ * [1] http://davenport.sourceforge.net/ntlm.html#theLmResponse
++ * [2] http://www.foofus.net/fizzgig/fgdump/
++ * [3] http://ettercap.sourceforge.net/
++ * [4] http://www.oxid.it/cain.html
++ * [5] http://www.foofus.net/jmk/smbchallenge.html
++ *
++ */
++
++#include <stdio.h>
++#include <string.h>
++
++#include "misc.h"
++#include "common.h"
++#include "formats.h"
++
++#include <openssl/des.h>
++
++#ifndef uchar
++#define uchar unsigned char
++#endif
++
++#define FORMAT_LABEL         "netlm"
++#define FORMAT_NAME          "LM C/R DES"
++#define ALGORITHM_NAME       "netlm"
++#define BENCHMARK_COMMENT    ""
++#define BENCHMARK_LENGTH     0
++#define PLAINTEXT_LENGTH     14
++#define BINARY_SIZE          24
++#define SALT_SIZE            8
++#define CIPHERTEXT_LENGTH    48
++#define TOTAL_LENGTH         8 + 2 * SALT_SIZE + CIPHERTEXT_LENGTH
++#define MIN_KEYS_PER_CRYPT   1
++#define MAX_KEYS_PER_CRYPT   1
++
++static struct fmt_tests tests[] = {
++  {"$NETLM$1122334455667788$6E1EC36D3417CE9E09A4424309F116C4C991948DAEB4ADAD", "G3RG3P00!"},
++  {"$NETLM$1122334455667788$16A7FDFE0CA109B937BFFB041F0E5B2D8B94A97D3FCA1A18", "HIYAGERGE"},
++  {"$NETLM$1122334455667788$B3A1B87DBBD4DF3CFA296198DD390C2F4E2E93C5C07B1D8B", "MEDUSAFGDUMP12"},
++  {"$NETLM$1122334455667788$0836F085B124F33895875FB1951905DD2F85252CC731BB25", "CORY21"},
++  {NULL}
++};
++
++static char saved_plain[PLAINTEXT_LENGTH + 1];
++static uchar challenge[SALT_SIZE + 1];
++static uchar output[BINARY_SIZE + 1];
++
++static int netlm_valid(char *ciphertext)
++{
++  char *pos;
++
++  if (strncmp(ciphertext, "$NETLM$", 5)!=0) return 0;
++  if (ciphertext[23] != '$') return 0;
++
++  for (pos = &ciphertext[24]; atoi16[ARCH_INDEX(*pos)] != 0x7F; pos++);
++    if (!*pos && pos - ciphertext - 24 == CIPHERTEXT_LENGTH)
++      return 1;
++    else
++      return 0;
++}
++
++static char *netlm_split(char *ciphertext, int index)
++{
++  static char out[TOTAL_LENGTH + 1];
++
++  memset(out, 0, TOTAL_LENGTH + 1);
++  memcpy(&out, ciphertext, TOTAL_LENGTH);
++  strlwr(&out[6]); /* Exclude: $NETLM$ */
++
++  return out;
++}
++
++static void *netlm_get_binary(char *ciphertext)
++{
++  static uchar binary[BINARY_SIZE];
++  int i;
++
++  ciphertext+=24;
++  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;
++}
++
++void setup_des_key(unsigned char key_56[], des_key_schedule *ks)
++{
++  des_cblock key;
++
++  key[0] = key_56[0];
++  key[1] = (key_56[0] << 7) | (key_56[1] >> 1);
++  key[2] = (key_56[1] << 6) | (key_56[2] >> 2);
++  key[3] = (key_56[2] << 5) | (key_56[3] >> 3);
++  key[4] = (key_56[3] << 4) | (key_56[4] >> 4);
++  key[5] = (key_56[4] << 3) | (key_56[5] >> 5);
++  key[6] = (key_56[5] << 2) | (key_56[6] >> 6);
++  key[7] = (key_56[6] << 1);
++
++  des_set_key(&key, *ks);
++}
++
++static void netlm_crypt_all(int count)
++{
++  static unsigned char magic[] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
++  des_key_schedule ks;
++  unsigned char password[14 + 1];
++  unsigned char lm[21];
++
++  memset(password, 0, 14 + 1);
++  memset(lm, 0, 21);
++  memset(output, 0, 24);
++
++  strncpy((char *) password, saved_plain, 14);
++
++  /* Generate 16-byte LM hash */
++  setup_des_key(password, &ks);
++  des_ecb_encrypt((des_cblock*)magic, (des_cblock*)lm, ks, DES_ENCRYPT);
++  setup_des_key(&password[7], &ks);
++  des_ecb_encrypt((des_cblock*)magic, (des_cblock*)&lm[8], ks, DES_ENCRYPT);
++
++  /*
++    NULL-pad 16-byte LM hash to 21-bytes
++    Split resultant value into three 7-byte thirds
++    DES-encrypt challenge using each third as a key
++    Concatenate three 8-byte resulting values to form 24-byte LM response
++  */
++  setup_des_key(lm, &ks);
++  des_ecb_encrypt((des_cblock*)challenge, (des_cblock*)output, ks, DES_ENCRYPT);
++  setup_des_key(&lm[7], &ks);
++  des_ecb_encrypt((des_cblock*)challenge, (des_cblock*)&output[8], ks, DES_ENCRYPT);
++  setup_des_key(&lm[14], &ks);
++  des_ecb_encrypt((des_cblock*)challenge, (des_cblock*)&output[16], ks, DES_ENCRYPT);
++}
++
++static int netlm_cmp_all(void *binary, int count)
++{
++  return !memcmp(output, binary, BINARY_SIZE);
++}
++
++static int netlm_cmp_one(void *binary, int index)
++{
++  return !memcmp(output, binary, BINARY_SIZE);
++}
++
++static int netlm_cmp_exact(char *source, int index)
++{
++  return !memcmp(output, netlm_get_binary(source), BINARY_SIZE);
++}
++
++static void *netlm_get_salt(char *ciphertext)
++{
++  static unsigned char binary_salt[SALT_SIZE];
++  int i;
++
++  ciphertext += 7;
++  for (i = 0; i < SALT_SIZE; ++i)
++    binary_salt[i] = (atoi16[ARCH_INDEX(ciphertext[i*2])] << 4) + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
++
++  return (void*)binary_salt;
++}
++
++static void netlm_set_salt(void *salt)
++{
++  memcpy(challenge, salt, SALT_SIZE);
++}
++
++static void netlm_set_key(char *key, int index)
++{
++  int i;
++
++  memset(saved_plain, 0, PLAINTEXT_LENGTH + 1);
++  strncpy(saved_plain, key, PLAINTEXT_LENGTH);
++
++  /* Upper-case password */
++  for(i=0; i<PLAINTEXT_LENGTH; i++)
++    if ((saved_plain[i] >= 'a') && (saved_plain[i] <= 'z')) saved_plain[i] ^= 0x20;
++}
++
++static char *netlm_get_key(int index)
++{
++  return saved_plain;
++}
++
++struct fmt_main fmt_NETLM = {
++  {
++    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 | FMT_BS | FMT_SPLIT_UNIFIES_CASE,
++    tests
++  }, {
++    fmt_default_init,
++    netlm_valid,
++    netlm_split,
++    netlm_get_binary,
++    netlm_get_salt,
++    {
++      fmt_default_binary_hash,
++      fmt_default_binary_hash,
++      fmt_default_binary_hash
++    },
++    fmt_default_salt_hash,
++    netlm_set_salt,
++    netlm_set_key,
++    netlm_get_key,
++    fmt_default_clear_keys,
++    netlm_crypt_all,
++    {
++      fmt_default_get_hash,
++      fmt_default_get_hash,
++      fmt_default_get_hash
++    },
++    netlm_cmp_all,
++    netlm_cmp_one,
++    netlm_cmp_exact
++  }
++};
+--- /dev/null
++++ john/src/NETNTLM_fmt.c
+@@ -0,0 +1,223 @@
++/*
++ * NETNTLM_fmt.c -- NTLM Challenge/Response
++ *
++ * Written by JoMo-Kun <jmk at foofus.net> in 2007
++ * and placed in the public domain.
++ *
++ * This algorithm is designed for performing brute-force cracking of the NTLM
++ * (version 1) challenge/response pairs exchanged during network-based
++ * authentication attempts [1]. The captured challenge/response pairs from these
++ * attempts should be stored using the L0phtCrack 2.0 LC format, specifically:
++ * username:unused:unused:lm response:ntlm response:challenge. For example:
++ *
++ * CORP\Administrator:::25B2B477CE101D83648BB087CE7A1C217F51C7FC64C0EBB1::
++ * C8BD0C1630A9ECF7A95F494A8F0B2CB4A3F25B1225514304:1122334455667788
++ *
++ * It should be noted that a NTLM authentication response is not same as a NTLM
++ * password hash, which can be extracted using tools such as FgDump [2]. NTLM
++ * responses can be gathered via normal network capture or via tools which
++ * perform layer 2 attacks, such as Ettercap [3] and Cain [4]. The responses can
++ * also be harvested using a modified Samba service [5] in conjunction with
++ * some trickery to convince the user to connect to it. I leave what that
++ * trickery may actually be as an exercise for the reader (HINT: Karma, NMB
++ * broadcasts, IE, Outlook, social engineering, ...).
++ *
++ * [1] http://davenport.sourceforge.net/ntlm.html#theNtLmResponse
++ * [2] http://www.foofus.net/fizzgig/fgdump/
++ * [3] http://ettercap.sourceforge.net/
++ * [4] http://www.oxid.it/cain.html
++ * [5] http://www.foofus.net/jmk/smbchallenge.html
++ *
++ */
++
++#include <stdio.h>
++#include <string.h>
++
++#include "misc.h"
++#include "common.h"
++#include "formats.h"
++
++#include <openssl/des.h>
++
++#ifndef uchar
++#define uchar unsigned char
++#endif
++
++#define FORMAT_LABEL         "netntlm"
++#define FORMAT_NAME          "NTLMv1 C/R MD4 DES"
++#define ALGORITHM_NAME       "netntlm"
++#define BENCHMARK_COMMENT    ""
++#define BENCHMARK_LENGTH     0
++#define PLAINTEXT_LENGTH     54 /* ?127? */
++#define BINARY_SIZE          24
++#define SALT_SIZE            8
++#define CIPHERTEXT_LENGTH    48
++#define TOTAL_LENGTH         10 + 2 * SALT_SIZE + CIPHERTEXT_LENGTH
++#define MIN_KEYS_PER_CRYPT   1
++#define MAX_KEYS_PER_CRYPT   1
++
++static struct fmt_tests tests[] = {
++  {"$NETNTLM$1122334455667788$BFCCAF26128EC95F9999C9792F49434267A1D9B0EF89BFFB", "g3rg3g3rg3g3rg3"},
++  {"$NETNTLM$1122334455667788$E463FAA5D868ECE20CAE622474A2F440A652D642156AF863", "M1xedC4se%^&*@)##(blahblah!@#"},
++  {"$NETNTLM$1122334455667788$35B62750E1B9B3205C50D6BA351092C12A1B9B3CDC65D44A", "FooBarGerg"},
++  {"$NETNTLM$1122334455667788$A4765EBFE83D345A7CB1660B8899251905164029F8086DDE", "visit www.foofus.net"},
++  {"$NETNTLM$1122334455667788$B2B2220790F40C88BCFF347C652F67A7C4A70D3BEBD70233", "cory21"},
++  {NULL}
++};
++
++static char saved_plain[PLAINTEXT_LENGTH + 1];
++static uchar challenge[SALT_SIZE + 1];
++static uchar output[BINARY_SIZE + 1];
++
++extern void E_md4hash(uchar *passwd, uchar *p16);
++extern void setup_des_key(unsigned char key_56[], des_key_schedule *ks);
++
++static int netntlm_valid(char *ciphertext)
++{
++  char *pos;
++
++  if (strncmp(ciphertext, "$NETNTLM$", 9)!=0) return 0;
++  if (ciphertext[25] != '$') return 0;
++
++  for (pos = &ciphertext[26]; atoi16[ARCH_INDEX(*pos)] != 0x7F; pos++);
++    if (!*pos && pos - ciphertext - 26 == CIPHERTEXT_LENGTH)
++      return 1;
++    else
++      return 0;
++}
++
++static char *netntlm_split(char *ciphertext, int index)
++{
++  static char out[TOTAL_LENGTH + 1];
++
++  memset(out, 0, TOTAL_LENGTH + 1);
++  memcpy(&out, ciphertext, TOTAL_LENGTH);
++  strlwr(&out[8]); /* Exclude: $NETNTLM$ */
++
++  return out;
++}
++
++static void *netntlm_get_binary(char *ciphertext)
++{
++  static uchar binary[BINARY_SIZE];
++  int i;
++
++  ciphertext+=26;
++  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 void netntlm_crypt_all(int count)
++{
++  des_key_schedule ks;
++  unsigned char ntlm[21];
++
++  memset(output, 0, 24);
++  memset(ntlm, 0, 21);
++
++  /* Generate 16-byte NTLM hash */
++  E_md4hash((unsigned char *) saved_plain, ntlm);
++
++  /* Hash is NULL padded to 21-bytes */
++  ntlm[16] = ntlm[17] = ntlm[18] = ntlm[19] = ntlm[20] = 0;
++
++  /* Split into three 7-byte segments for use as DES keys
++     Use each key to DES encrypt challenge
++     Concatenate output to for 24-byte NTLM response */
++  setup_des_key(ntlm, &ks);
++  des_ecb_encrypt((des_cblock*)challenge, (des_cblock*)output, ks, DES_ENCRYPT);
++  setup_des_key(&ntlm[7], &ks);
++  des_ecb_encrypt((des_cblock*)challenge, (des_cblock*)&output[8], ks, DES_ENCRYPT);
++  setup_des_key(&ntlm[14], &ks);
++  des_ecb_encrypt((des_cblock*)challenge, (des_cblock*)&output[16], ks, DES_ENCRYPT);
++}
++
++static int netntlm_cmp_all(void *binary, int count)
++{
++  return !memcmp(output, binary, BINARY_SIZE);
++}
++
++static int netntlm_cmp_one(void *binary, int index)
++{
++  return !memcmp(output, binary, BINARY_SIZE);
++}
++
++static int netntlm_cmp_exact(char *source, int index)
++{
++  return !memcmp(output, netntlm_get_binary(source), BINARY_SIZE);
++}
++
++static void *netntlm_get_salt(char *ciphertext)
++{
++  static unsigned char binary_salt[SALT_SIZE];
++  int i;
++
++  ciphertext += 9;
++  for (i = 0; i < SALT_SIZE; ++i)
++    binary_salt[i] = (atoi16[ARCH_INDEX(ciphertext[i*2])] << 4) + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
++
++  return (void*)binary_salt;
++}
++
++static void netntlm_set_salt(void *salt)
++{
++  memcpy(challenge, salt, SALT_SIZE);
++}
++
++static void netntlm_set_key(char *key, int index)
++{
++  strncpy(saved_plain, key, PLAINTEXT_LENGTH);
++  saved_plain[PLAINTEXT_LENGTH] = 0;
++}
++
++static char *netntlm_get_key(int index)
++{
++  return saved_plain;
++}
++
++struct fmt_main fmt_NETNTLM = {
++  {
++    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 | FMT_SPLIT_UNIFIES_CASE,
++    tests
++  }, {
++    fmt_default_init,
++    netntlm_valid,
++    netntlm_split,
++    netntlm_get_binary,
++    netntlm_get_salt,
++    {
++      fmt_default_binary_hash,
++      fmt_default_binary_hash,
++      fmt_default_binary_hash
++    },
++    fmt_default_salt_hash,
++    netntlm_set_salt,
++    netntlm_set_key,
++    netntlm_get_key,
++    fmt_default_clear_keys,
++    netntlm_crypt_all,
++    {
++      fmt_default_get_hash,
++      fmt_default_get_hash,
++      fmt_default_get_hash
++    },
++    netntlm_cmp_all,
++    netntlm_cmp_one,
++    netntlm_cmp_exact
++  }
++};
+--- /dev/null
++++ john/src/byteorder.h
+@@ -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 */
+--- john.orig/src/inc.c
++++ john/src/inc.c
+@@ -23,6 +23,7 @@
+ #include "cracker.h"
+ 
+ extern struct fmt_main fmt_LM;
++extern struct fmt_main fmt_NETLM;
+ 
+ typedef char (*char2_table)
+ 	[CHARSET_SIZE + 1][CHARSET_SIZE + 1];
+@@ -377,6 +378,8 @@
+ 	if (!mode) {
+ 		if (db->format == &fmt_LM)
+ 			mode = "LanMan";
++		else if (db->format == &fmt_NETLM)
++			mode = "LanMan";
+ 		else
+ 			mode = "All";
+ 	}
+--- john.orig/src/john.c
++++ john/src/john.c
+@@ -40,6 +40,8 @@
+ extern struct fmt_main fmt_AFS, fmt_LM;
+ extern struct fmt_main fmt_NT;
+ extern struct fmt_main fmt_mscash;
++extern struct fmt_main fmt_NETLM;
++extern struct fmt_main fmt_NETNTLM;
+ 
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -68,7 +70,8 @@
+ 	john_register_one(&fmt_LM);
+ 	john_register_one(&fmt_NT);
+ 	john_register_one(&fmt_mscash);
+-
++	john_register_one(&fmt_NETLM);
++	john_register_one(&fmt_NETNTLM);
+ 
+ 	if (!fmt_list) {
+ 		fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john.orig/src/loader.c
++++ john/src/loader.c
+@@ -230,6 +230,25 @@
+ 
+ 		if (source) sprintf(source, "%s:%s", uid, line);
+ 	}
++	else if (options.format && ((strncmp(options.format, "netlm", 5) == 0) ||
++								(strncmp(options.format, "netntlm", 7) == 0))) {
++		char *netlm = ldr_get_field(&line);
++		char *netntlm = ldr_get_field(&line);
++		char *challenge = ldr_get_field(&line);
++
++		if (strncmp(options.format, "netlm", 5) == 0) {
++			tmp = (char *) mem_alloc(7 + strlen(challenge) + strlen(netlm) + 1);
++			memset(tmp, 0, 7 + strlen(challenge) + strlen(netlm) + 1);
++			sprintf(tmp, "$NETLM$%s$%s", challenge, netlm);
++			*ciphertext = tmp;
++		}
++		else {
++			tmp = (char *) mem_alloc(9 + strlen(challenge) + strlen(netntlm) + 1);
++			memset(tmp, 0, 9 + strlen(challenge) + strlen(netntlm) + 1);
++			sprintf(tmp, "$NETNTLM$%s$%s", challenge, netntlm);
++			*ciphertext = tmp;
++		}
++	}
+ 
+ 	if (db_options->flags & DB_WORDS || db_options->shells->head) {
+ 		gid = ldr_get_field(&line);
+--- /dev/null
++++ john/src/md4.c
+@@ -0,0 +1,254 @@
++/*
++ * 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 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 "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 that tolerate unaligned
++ * memory accesses is just an optimization.  Nothing will break if it
++ * doesn't work.
++ */
++#if defined(__i386__) || defined(__x86_64__) || 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 are 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;
++	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
+--- /dev/null
++++ john/src/md4.h
+@@ -0,0 +1,30 @@
++/*
++ * 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 2001, and placed
++ * in the public domain.  There's absolutely no warranty.
++ *
++ * 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 int 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);
++
++#endif
+--- john.orig/src/options.c
++++ john/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT           load salts with[out] at least COUNT passwords " \
+ 	"only\n" \
+ "--format=NAME              force ciphertext format NAME: " \
+-	"DES/BSDI/MD5/BF/AFS/LM/NT/mscash\n" \
++	"DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM\n" \
+ "--save-memory=LEVEL        enable memory saving, at LEVEL 1..3\n"
+ 
+ void opt_init(char *name, int argc, char **argv)
+--- /dev/null
++++ john/src/smbencrypt.c
+@@ -0,0 +1,108 @@
++/*
++   Unix SMB/Netbios implementation.
++   Version 1.9.
++   SMB parameters and setup
++   Copyright (C) Andrew Tridgell 1992-1998
++   Modified by Jeremy Allison 1995.
++   (and hacked further by others)
++
++   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>
++
++
++#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"
++
++#include "md4.h"
++
++/* Routines for Windows NT MD4 Hash functions. */
++static int _my_wcslen(int16 *str)
++{
++	int len = 0;
++	while(*str++ != 0)
++		len++;
++	return len;
++}
++
++/*
++ * 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;
++	int16 val;
++
++	for(i = 0; i < len; i++) {
++		val = *src;
++		SSVAL(dst,0,val);
++		dst++;
++		src++;
++		if(val == 0)
++			break;
++	}
++	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];
++	MD4_CTX ctx;
++
++	/* 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);
++
++	MD4_Init(&ctx);
++	MD4_Update(&ctx, (unsigned char *)wpwd, len);
++	MD4_Final(p16, &ctx);
++}

Deleted: trunk/debian/patches/03-fix_paths.patch
===================================================================
--- trunk/debian/patches/03-fix_paths.patch	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/patches/03-fix_paths.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -1,15 +0,0 @@
---- john-1.7.2.orig/src/params.h
-+++ john-1.7.2/src/params.h
-@@ -54,10 +54,10 @@
- 
- #if JOHN_SYSTEMWIDE
- #ifndef JOHN_SYSTEMWIDE_EXEC /* please refer to the notes above */
--#define JOHN_SYSTEMWIDE_EXEC		"/usr/libexec/john"
-+#define JOHN_SYSTEMWIDE_EXEC		"/usr/lib/john"
- #endif
- #ifndef JOHN_SYSTEMWIDE_HOME
--#define JOHN_SYSTEMWIDE_HOME		"/usr/share/john"
-+#define JOHN_SYSTEMWIDE_HOME		"/etc/john"
- #endif
- #define JOHN_PRIVATE_HOME		"~/.john"
- #endif

Added: trunk/debian/patches/04-amd64.patch
===================================================================
--- trunk/debian/patches/04-amd64.patch	                        (rev 0)
+++ trunk/debian/patches/04-amd64.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -0,0 +1,104 @@
+--- john.orig/src/loader.c
++++ john/src/loader.c
+@@ -32,7 +32,7 @@
+ #define issep \
+ 	"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\177"
+ 
+-static char issep_map[0x100];
++static unsigned char issep_map[0x100];
+ static int issep_initialized = 0;
+ 
+ static void read_file(struct db_main *db, char *name, int flags,
+@@ -68,7 +68,7 @@
+ 
+ static void ldr_init_issep(void)
+ {
+-	char *pos;
++	unsigned char *pos;
+ 
+ 	if (issep_initialized) return;
+ 
+@@ -282,7 +282,7 @@
+ 
+ static void ldr_split_string(struct list_main *dst, char *src)
+ {
+-	char *word, *pos;
++	unsigned char *word, *pos;
+ 
+ 	pos = src;
+ 	do {
+--- john.orig/src/rules.c
++++ john/src/rules.c
+@@ -126,9 +126,9 @@
+ 	for (pos = 0; (out[pos] = (conv)[ARCH_INDEX(in[pos])]); pos++); \
+ }
+ 
+-static void rules_init_class(char name, char *valid)
++static void rules_init_class(unsigned char name, char *valid)
+ {
+-	char *pos, inv;
++	unsigned char *pos, inv;
+ 
+ 	rules_classes[ARCH_INDEX(name)] =
+ 		mem_alloc_tiny(0x100, MEM_ALIGN_NONE);
+@@ -163,7 +163,7 @@
+ 	rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_DIGITS);
+ }
+ 
+-static char *rules_init_conv(char *src, char *dst)
++static char *rules_init_conv(unsigned char *src, char *dst)
+ {
+ 	char *conv;
+ 	int pos;
+@@ -215,7 +215,7 @@
+ 	rules_errno = RULES_ERROR_NONE;
+ }
+ 
+-char *rules_reject(char *rule, struct db_main *db)
++char *rules_reject(unsigned char *rule, struct db_main *db)
+ {
+ 	while (RULE)
+ 	switch (LAST) {
+@@ -257,10 +257,10 @@
+ 	return rule - 1;
+ }
+ 
+-char *rules_apply(char *word, char *rule, int split)
++char *rules_apply(char *word, unsigned char *rule, int split)
+ {
+-	static char buffer[3][RULE_WORD_SIZE * 2];
+-	char *in = buffer[0], *out = buffer[1];
++	static unsigned char buffer[3][RULE_WORD_SIZE * 2];
++	unsigned char *in = buffer[0], *out = buffer[1];
+ 	char memory[RULE_WORD_SIZE];
+ 	int memory_empty, which;
+ 	char value, *class;
+@@ -653,7 +653,7 @@
+ int rules_check(struct rpp_context *start, int split)
+ {
+ 	struct rpp_context ctx;
+-	char *rule;
++	unsigned char *rule;
+ 	int count;
+ 
+ 	rules_errno = RULES_ERROR_NONE;
+--- john.orig/src/rules.h
++++ john/src/rules.h
+@@ -51,7 +51,7 @@
+  * error. If the database is NULL, all rules are accepted (to be used
+  * for syntax checking).
+  */
+-extern char *rules_reject(char *rule, struct db_main *db);
++extern char *rules_reject(unsigned char *rule, struct db_main *db);
+ 
+ /*
+  * Applies rule to a word. Returns the updated word, or NULL if rejected or
+@@ -61,7 +61,7 @@
+  * split == 0	"single crack" mode, only one word
+  * split < 0	other cracking modes, "single crack" mode rules are invalid
+  */
+-extern char *rules_apply(char *word, char *rule, int split);
++extern char *rules_apply(char *word, unsigned char *rule, int split);
+ 
+ /*
+  * Checks if all the rules for context are valid. Returns the number of rules,

Added: trunk/debian/patches/05-mipsel.patch
===================================================================
--- trunk/debian/patches/05-mipsel.patch	                        (rev 0)
+++ trunk/debian/patches/05-mipsel.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -0,0 +1,120 @@
+--- john.orig/src/Makefile
++++ john/src/Makefile
+@@ -98,6 +98,8 @@
+ 	@echo "linux-ppc32              Linux, PowerPC 32-bit"
+ #	@echo "linux-ppc64-altivec      Linux, PowerPC 64-bit w/AltiVec"
+ 	@echo "linux-ppc64              Linux, PowerPC 64-bit"
++	@echo "linux-mips               Linux, MIPS"
++	@echo "linux-mipsel             Linux, MIPSel"
+ 	@echo "freebsd-x86-sse2         FreeBSD, x86 with SSE2 (best)"
+ 	@echo "freebsd-x86-mmx          FreeBSD, x86 with MMX"
+ 	@echo "freebsd-x86-any          FreeBSD, x86"
+@@ -255,6 +257,16 @@
+ 		JOHN_OBJS="$(JOHN_OBJS) x86.o" \
+ 		ASFLAGS="$(ASFLAGS) -DBSD"
+ 
++linux-mips: mips.h
++	$(LN) mips.h arch.h
++	$(MAKE) $(PROJ) \
++		JOHN_OBJS="$(BITSLICE_OBJS) $(JOHN_OBJS)"
++
++linux-mipsel: mipsel.h
++	$(LN) mipsel.h arch.h
++	$(MAKE) $(PROJ) \
++		JOHN_OBJS="$(BITSLICE_OBJS) $(JOHN_OBJS)"
++
+ freebsd-x86-any-a.out:
+ 	$(LN) x86-any.h arch.h
+ 	$(MAKE) $(PROJ) \
+--- /dev/null
++++ john/src/mipsel.h
+@@ -0,0 +1,43 @@
++/*
++ * This file is part of John the Ripper password cracker,
++ * Copyright (c) 1996-98 by Solar Designer
++ */
++
++/*
++ * Architecture specific parameters for little-endian MIPS.
++ */
++
++#ifndef _JOHN_ARCH_H
++#define _JOHN_ARCH_H
++
++#define ARCH_GENERIC			1
++#define ARCH_WORD			long
++#define ARCH_SIZE			4
++#define ARCH_BITS			32
++#define ARCH_BITS_STR			"32"
++#define ARCH_LITTLE_ENDIAN		1
++#define ARCH_INT_GT_32			0
++#define ARCH_ALLOWS_UNALIGNED		0
++#define ARCH_INDEX			unsigned int
++
++#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			0
++#define DES_SCALE			1
++#define DES_EXTB			0
++#define DES_COPY			1
++#define DES_BS				0
++
++#define MD5_ASM				0
++#define MD5_IMM				0
++
++#define BF_ASM				0
++#define BF_SCALE			0
++
++#endif
+--- /dev/null
++++ john/src/mips.h
+@@ -0,0 +1,43 @@
++/*
++ * This file is part of John the Ripper password cracker,
++ * Copyright (c) 1996-98 by Solar Designer
++ */
++
++/*
++ * Architecture specific parameters for big-endian MIPS.
++ */
++
++#ifndef _JOHN_ARCH_H
++#define _JOHN_ARCH_H
++
++#define ARCH_GENERIC			1
++#define ARCH_WORD			long
++#define ARCH_SIZE			4
++#define ARCH_BITS			32
++#define ARCH_BITS_STR			"32"
++#define ARCH_LITTLE_ENDIAN		0
++#define ARCH_INT_GT_32			0
++#define ARCH_ALLOWS_UNALIGNED		0
++#define ARCH_INDEX			unsigned int
++
++#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			0
++#define DES_SCALE			1
++#define DES_EXTB			0
++#define DES_COPY			1
++#define DES_BS				0
++
++#define MD5_ASM				0
++#define MD5_IMM				0
++
++#define BF_ASM				0
++#define BF_SCALE			0
++
++#endif

Added: trunk/debian/patches/06-fix_paths.patch
===================================================================
--- trunk/debian/patches/06-fix_paths.patch	                        (rev 0)
+++ trunk/debian/patches/06-fix_paths.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -0,0 +1,72 @@
+--- john.orig/src/params.h
++++ john/src/params.h
+@@ -54,10 +54,10 @@
+ 
+ #if JOHN_SYSTEMWIDE
+ #ifndef JOHN_SYSTEMWIDE_EXEC /* please refer to the notes above */
+-#define JOHN_SYSTEMWIDE_EXEC		"/usr/libexec/john"
++#define JOHN_SYSTEMWIDE_EXEC		"/usr/lib/john"
+ #endif
+ #ifndef JOHN_SYSTEMWIDE_HOME
+-#define JOHN_SYSTEMWIDE_HOME		"/usr/share/john"
++#define JOHN_SYSTEMWIDE_HOME		"/etc/john"
+ #endif
+ #define JOHN_PRIVATE_HOME		"~/.john"
+ #endif
+@@ -116,7 +116,7 @@
+ #endif
+ #define LOG_SUFFIX			".log"
+ #define RECOVERY_SUFFIX			".rec"
+-#define WORDLIST_NAME			"$JOHN/password.lst"
++#define WORDLIST_NAME			"/usr/share/john/password.lst"
+ 
+ /*
+  * Configuration file section names.
+--- john.orig/run/john.conf
++++ john/run/john.conf
+@@ -5,7 +5,7 @@
+ 
+ [Options]
+ # Wordlist file name, to be used in batch mode
+-Wordlist = $JOHN/password.lst
++Wordlist = /usr/share/john/password.lst
+ # Use idle cycles only
+ Idle = N
+ # Crash recovery file saving delay in seconds
+@@ -323,31 +323,31 @@
+ 
+ # Incremental modes
+ [Incremental:All]
+-File = $JOHN/all.chr
++File = /usr/share/john/all.chr
+ MinLen = 0
+ MaxLen = 8
+ CharCount = 95
+ 
+ [Incremental:Alpha]
+-File = $JOHN/alpha.chr
++File = /usr/share/john/alpha.chr
+ MinLen = 1
+ MaxLen = 8
+ CharCount = 26
+ 
+ [Incremental:Digits]
+-File = $JOHN/digits.chr
++File = /usr/share/john/digits.chr
+ MinLen = 1
+ MaxLen = 8
+ CharCount = 10
+ 
+ [Incremental:Alnum]
+-File = $JOHN/alnum.chr
++File = /usr/share/john/alnum.chr
+ MinLen = 1
+ MaxLen = 8
+ CharCount = 36
+ 
+ [Incremental:LanMan]
+-File = $JOHN/lanman.chr
++File = /usr/share/john/lanman.chr
+ MinLen = 0
+ MaxLen = 7
+ CharCount = 69

Added: trunk/debian/patches/07-update_FAQ.patch
===================================================================
--- trunk/debian/patches/07-update_FAQ.patch	                        (rev 0)
+++ trunk/debian/patches/07-update_FAQ.patch	2008-06-01 15:15:27 UTC (rev 164)
@@ -0,0 +1,11 @@
+--- john.orig/doc/FAQ
++++ john/doc/FAQ
+@@ -70,6 +70,8 @@
+ 
+ Q: Where do I get wordlists for use with John?
+ A: http://www.openwall.com/wordlists/
++A: Please also read /usr/share/doc/john/README.wordlists for more
++information on getting wordlists to use with John.
+ 
+ Q: Where do I get new versions of John the Ripper?
+ Q: Where do I get the source code for John?

Modified: trunk/debian/patches/series
===================================================================
--- trunk/debian/patches/series	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/patches/series	2008-06-01 15:15:27 UTC (rev 164)
@@ -1,3 +1,8 @@
-01-amd64.patch
-02-mipsel.patch
-03-fix_paths.patch
+00-remove_funroll-loops.patch
+01-add_NTLM-MD4.patch
+02-add_MS-Credential-Cache.patch
+03-add_NetLM-NetNTLM.patch
+04-amd64.patch
+05-mipsel.patch
+06-fix_paths.patch
+07-update_FAQ.patch

Modified: trunk/debian/rules
===================================================================
--- trunk/debian/rules	2008-06-01 14:38:27 UTC (rev 163)
+++ trunk/debian/rules	2008-06-01 15:15:27 UTC (rev 164)
@@ -7,6 +7,7 @@
 include /usr/share/quilt/quilt.make
 
 ARCH  := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+#CPU   := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
 CFLAGS = -DJOHN_SYSTEMWIDE -g -c -Wall
 DEST   = $(CURDIR)/debian/john
 
@@ -19,6 +20,12 @@
 	STRIP += -s
 endif
 
+# GCC segfaults on ARM if -funroll-loops is used.
+# Please see #476460
+#ifneq ($(CPU),arm)
+#	CFLAGS += -funroll-loops
+#endif
+
 ifeq ($(ARCH),i386)
 	TARGET := linux-x86-any
 else
@@ -59,7 +66,6 @@
 	dh_install
 
 	chmod -c 755 $(DEST)/usr/share/john/cronjob
-	
 
 ifeq ($(ARCH),i386)
 	install -d $(DEST)/usr/lib/john
@@ -70,8 +76,7 @@
 	install $(STRIP) $(CURDIR)/run/john $(DEST)/usr/sbin/john
 endif
 
-binary-indep: build install
-binary-arch: build install
+binary-common:
 	dh_testdir
 	dh_testroot
 	dh_installchangelogs doc/CHANGES
@@ -80,6 +85,7 @@
 	dh_installcron
 #	dh_installdebconf	
 	dh_installman
+	dh_lintian
 	dh_link
 	dh_strip
 	dh_compress
@@ -90,5 +96,9 @@
 	dh_md5sums
 	dh_builddeb
 
+binary-indep: build install binary-common
+binary-arch: build install binary-common
+
 binary: binary-indep binary-arch
+
 .PHONY: build clean binary-indep binary-arch binary install




More information about the Pkg-john-commits mailing list