[Pkg-john-commits] r184 - in trunk/debian: . patches
hanska-guest at alioth.debian.org
hanska-guest at alioth.debian.org
Tue Dec 9 23:10:59 UTC 2008
Author: hanska-guest
Date: 2008-12-09 23:10:58 +0000 (Tue, 09 Dec 2008)
New Revision: 184
Added:
trunk/debian/patches/08-add_BFEgg.patch
trunk/debian/patches/09-add_KRB5.patch
trunk/debian/patches/10-add_DOMINOSEC.patch
trunk/debian/patches/11-add_lotus5.patch
trunk/debian/patches/12-add_raw-md5.patch
trunk/debian/patches/13-add_raw-sha1.patch
trunk/debian/patches/14-add_IPB2.patch
trunk/debian/patches/15-add_MD5_apache.patch
trunk/debian/patches/16-add_NSLDAP.patch
trunk/debian/patches/17-add_OPENLDAPS.patch
trunk/debian/patches/18-add_HDAA.patch
Modified:
trunk/debian/changelog
trunk/debian/copyright
trunk/debian/docs
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/05-mipsel.patch
trunk/debian/patches/07-update_FAQ.patch
trunk/debian/patches/series
Log:
* debian/patches/:
- 01-add_NTLM-MD4.patch,
02-add_MS-Credential-Cache.patch,
03-add_NetLM-NetNTLM.patch,
05-mipsel.patch,
07-update_FAQ.patch refreshed.
- 08-add_BFEgg.patch,
09-add_KRB5.patch,
10-add_DOMINOSEC.patch,
11-add_lotus5.patch,
12-add_raw-md5.patch,
13-add_raw-sha1.patch,
14-add_IPB2.patch,
15-add_MD5_apache.patch,
16-add_NSLDAP.patch,
17-add_OPENLDAPS.patch,
18-add_HDAA.patch added (from "Jumbo Patch" available on upstream's
homepage).
- series updated
* debian/docs updated
* debian/copyright updated
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-11-26 15:30:16 UTC (rev 183)
+++ trunk/debian/changelog 2008-12-09 23:10:58 UTC (rev 184)
@@ -7,8 +7,29 @@
* debian/extra/:
- john-mailer.conf and cronjob extended to allow per-group password
cracking -- thanks to Fabian Zeindl (see LP194036)
+ * debian/patches/:
+ - 01-add_NTLM-MD4.patch,
+ 02-add_MS-Credential-Cache.patch,
+ 03-add_NetLM-NetNTLM.patch,
+ 05-mipsel.patch,
+ 07-update_FAQ.patch refreshed.
+ - 08-add_BFEgg.patch,
+ 09-add_KRB5.patch,
+ 10-add_DOMINOSEC.patch,
+ 11-add_lotus5.patch,
+ 12-add_raw-md5.patch,
+ 13-add_raw-sha1.patch,
+ 14-add_IPB2.patch,
+ 15-add_MD5_apache.patch,
+ 16-add_NSLDAP.patch,
+ 17-add_OPENLDAPS.patch,
+ 18-add_HDAA.patch added (from "Jumbo Patch" available on upstream's
+ homepage).
+ - series updated
+ * debian/docs updated
+ * debian/copyright updated
- -- David Paleino <d.paleino at gmail.com> Wed, 26 Nov 2008 16:29:47 +0100
+ -- David Paleino <d.paleino at gmail.com> Wed, 26 Nov 2008 20:15:48 +0100
john (1.7.2-3) unstable; urgency=low
Modified: trunk/debian/copyright
===================================================================
--- trunk/debian/copyright 2008-11-26 15:30:16 UTC (rev 183)
+++ trunk/debian/copyright 2008-12-09 23:10:58 UTC (rev 184)
@@ -1,5 +1,16 @@
Source: http://www.openwall.com/john/
+Files: debian/*
+Copyright: © 2008, David Paleino <d.paleino at gmail.com>
+ © 2004-2006, Guilherme de S. Pastore <gpastore at debian.org>
+ © 2003-2004, Javier Fernandez-Sanguino Peña <jfs at computer.org>
+ © 2000-2004, Christian Kurz <shorty at debian.org>
+License: GPL-2+
+ 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.
+
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>
@@ -34,17 +45,88 @@
* 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>
- © 2003-2004, Javier Fernandez-Sanguino Peña <jfs at computer.org>
- © 2000-2004, Christian Kurz <shorty at debian.org>
+Files: src/BFEgg_fmt.c (from debian/patches/08-add_BFEgg.patch)
+TODO: src/bf_tab.h (from debian/patches/08-add_BFEgg.patch)
+TODO: src/blowfish.c (from debian/patches/08-add_BFEgg.patch)
+TODO: src/blowfish.h (from debian/patches/08-add_BFEgg.patch)
+Copyright: © 2002, Sun-Zero <sun-zero at freemail.hu>
License: GPL-2+
- 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.
+==> BFegg.c <==
+ /*
+ * This file is part of Eggdrop blowfish patch for John The Ripper.
+ * Copyright (c) 2002 by Sun-Zero <sun-zero at freemail.hu>
+ * This is a free software distributable under terms of the GNU GPL.
+ */
+Files: src/KRB5_fmt.c (from debian/patches/09-add_KRB5.patch)
+ src/KRB5_std.{c,h} (from debian/patches/09-add_KRB5.patch)
+Copyright: ©, Nasko Oskov <nasko at netsekure.org>
+TODO: seems non-free, or at least non-distributable
+
+Files: src/DOMINOSEC_fmt.c (from debian/patches/10-add_DOMINOSEC.patch)
+Copyright: © 2005, <regenrecht at o2.pl>
+TODO: no licensing statement, no author name
+
+Files: debian/patches/11-add_lotus5.patch
+Copyright: ©, Jeff Fay <>
+Copyright: <bartavelle at bandecon.com>
+TODO: no licensing statement, no author email, no author name
+
+Files: src/md5_eq.c (from debian/patches/11-add_lotus5.patch)
+Copyright: © 2001, Solar Designer <solar at openwall.com>
+Copyright: ©, David Luyer <david at luyer.net>
+Copyright: ©, Balázs Bucsay <earthquake at rycon.hu>
+License: PD
+TODO: check copyright years
+
+Files: src/md5_go.{c,h} (from debian/patches/11-add_lotus5.patch)
+Copyright: © 2001, Solar Designer <solar at openwall.com>
+Copyright: ©, David Luyer <david at luyer.net>
+License: PD
+TODO: check copyright years
+
+Files: src/rawSHA1_fmt.c (from debian/patches/12-add_raw-md5.patch)
+Copyright: © 2004, bartavelle <bartavelle at bandecon.com>
+Copyright: © Balázs Bucsay <earthquake at rycon.hu>
+Copyright: © David Luyer <david at luyer.net>
+TODO: no licensing statement, check for real name?, check copyright years
+
+Files: src/rawSHA1_fmt.c (from debian/patches/13-add_raw-sha1.patch)
+Copyright: © 2004, bartavelle <bartavelle at bandecon.com>
+TODO: no licensing statement, check for real name?
+
+Files: src/sha.h (from debian/patches/13-add_raw-sha1.patch)
+TODO: no copyright statement *at* *all*!
+
+Files: src/IPB2_fmt.c (from debian/patches/14-add_IPB2.patch)
+Copyright: © 2006, <regenrecht at o2.pl>
+TODO: no licensing statement, check for real name?
+
+Files: src/md5.h (from debian/patches/14-add_IPB2.patch)
+Copyright: © 2001, Solar Designer <solar at openwall.com>
+License: PD
+
+Files: src/MD5_apache_fmt.c (from debian/patches/15-add_MD5_apache.patch)
+Copyright: © 1996-2001, Solar Designer <solar at openwall.com>
+Copyright: © 2001, Kostas Evangelinos <kos at bastard.net>
+Copyright: © 2004, Sun-Zero <sun-zero at freemail.hu>
+TODO: no licensing statement
+
+Files: src/NSLDAP_fmt.c (from debian/patches/16-add_NSLDAP.patch)
+ src/OPENLDAPS_fmt.c (from debian/patches/17-add_OPENLDAPS.patch)
+Copyright: © 1996-98, Solar Designer <solar at openwall.com>
+Copyright: © 2004, Sun-Zero <sun-zero at freemail.hu>
+Copyright: © <bartavelle at bandecon.com>
+TODO: no licensing statement, check for real names?, check copyright years
+
+Files: src/base64.{c,h} (from debian/patches/16-add_NSLDAP.patch)
+TODO: no copyright statement *at* *all*!
+
+Files: src/HDAA_fmt.c (from debian/patches/18-add_HDAA.patch)
+ doc/HDAA_README (from debian/patches/18-add_HDAA.patch)
+Copyright: © Romain Raboin <romain.raboin at gmail.com>
+TODO: no licensing statement, check copyright years
+
Files: src/crc32.{c,h}
Copyright: © 1998-2005, Solar Designer <solar at openwall.com>
License: PD
Modified: trunk/debian/docs
===================================================================
--- trunk/debian/docs 2008-11-26 15:30:16 UTC (rev 183)
+++ trunk/debian/docs 2008-12-09 23:10:58 UTC (rev 184)
@@ -7,5 +7,6 @@
doc/MODES
doc/OPTIONS
doc/RULES
+doc/HDAA_README
debian/README.wordlists
debian/extra/CONFIG.mailer
Modified: trunk/debian/patches/01-add_NTLM-MD4.patch
===================================================================
--- trunk/debian/patches/01-add_NTLM-MD4.patch 2008-11-26 15:30:16 UTC (rev 183)
+++ trunk/debian/patches/01-add_NTLM-MD4.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -1,5 +1,5 @@
---- john-1.7.2.orig/src/Makefile
-+++ john-1.7.2/src/Makefile
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
@@ -28,6 +28,7 @@
BF_fmt.o BF_std.o \
AFS_fmt.o \
@@ -9,7 +9,7 @@
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-1.7.2/src/NT_fmt.c
++++ john-1.7.3.1/src/NT_fmt.c
@@ -0,0 +1,613 @@
+/* NTLM patch for john (performance improvement)
+ *
@@ -624,8 +624,8 @@
+ cmp_exact
+ }
+};
---- john-1.7.2.orig/src/john.c
-+++ john-1.7.2/src/john.c
+--- john-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
@@ -38,6 +38,7 @@
extern struct fmt_main fmt_DES, fmt_BSDI, fmt_MD5, fmt_BF;
@@ -643,8 +643,8 @@
if (!fmt_list) {
fprintf(stderr, "Unknown ciphertext format name requested\n");
---- john-1.7.2.orig/src/loader.c
-+++ john-1.7.2/src/loader.c
+--- john-1.7.3.1.orig/src/loader.c
++++ john-1.7.3.1/src/loader.c
@@ -18,6 +18,7 @@
#include "signals.h"
#include "formats.h"
@@ -713,8 +713,8 @@
if (*format) return (*format)->methods.valid(*ciphertext);
---- john-1.7.2.orig/src/options.c
-+++ john-1.7.2/src/options.c
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
@@ -60,7 +60,7 @@
{"salts", FLG_SALTS, FLG_SALTS, FLG_PASSWD, OPT_REQ_PARAM,
"%d", &options.loader.min_pps},
@@ -727,14 +727,14 @@
@@ -101,7 +101,7 @@
"--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
"only\n" \
- "--format=NAME force ciphertext format NAME: " \
+ "--format=NAME force hash type 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-1.7.2.orig/src/x86-64.S
-+++ john-1.7.2/src/x86-64.S
+--- john-1.7.3.1.orig/src/x86-64.S
++++ john-1.7.3.1/src/x86-64.S
@@ -13,6 +13,9 @@
#define DES_bs_crypt _DES_bs_crypt
#define DES_bs_crypt_25 _DES_bs_crypt_25
@@ -745,7 +745,7 @@
#endif
#ifdef ALIGN_LOG
-@@ -1040,3 +1043,236 @@
+@@ -1052,3 +1055,236 @@
subl $1,rounds
jnz DES_bs_crypt_LM_loop
ret
@@ -982,17 +982,17 @@
+ NT_CRYPT_BODY(3)
+
+ ret
---- john-1.7.2.orig/src/x86-64.h
-+++ john-1.7.2/src/x86-64.h
-@@ -45,4 +45,6 @@
- #define BF_ASM 0
+--- john-1.7.3.1.orig/src/x86-64.h
++++ john-1.7.3.1/src/x86-64.h
+@@ -46,4 +46,6 @@
#define BF_SCALE 1
+ #define BF_X2 1
+#define NT_X86_64
+
#endif
---- john-1.7.2.orig/src/x86-sse.S
-+++ john-1.7.2/src/x86-sse.S
+--- john-1.7.3.1.orig/src/x86-sse.S
++++ john-1.7.3.1/src/x86-sse.S
@@ -15,6 +15,11 @@
#define DES_bs_crypt _DES_bs_crypt
#define DES_bs_crypt_25 _DES_bs_crypt_25
@@ -1005,7 +1005,7 @@
#endif
/*
-@@ -1289,3 +1294,238 @@
+@@ -1301,3 +1306,238 @@
jnz DES_bs_crypt_LM_loop
popl %esi
ret
@@ -1244,11 +1244,11 @@
+ popa
+
+ ret
---- john-1.7.2.orig/src/x86-sse.h
-+++ john-1.7.2/src/x86-sse.h
-@@ -58,4 +58,6 @@
- #define BF_ASM 1
+--- john-1.7.3.1.orig/src/x86-sse.h
++++ john-1.7.3.1/src/x86-sse.h
+@@ -59,4 +59,6 @@
#define BF_SCALE 1
+ #define BF_X2 0
+#define NT_SSE2
+
Modified: trunk/debian/patches/02-add_MS-Credential-Cache.patch
===================================================================
--- trunk/debian/patches/02-add_MS-Credential-Cache.patch 2008-11-26 15:30:16 UTC (rev 183)
+++ trunk/debian/patches/02-add_MS-Credential-Cache.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -1,5 +1,5 @@
---- john-1.7.2.orig/src/Makefile
-+++ john-1.7.2/src/Makefile
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
@@ -29,6 +29,7 @@
AFS_fmt.o \
LM_fmt.o \
@@ -8,8 +8,8 @@
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-1.7.2.orig/src/loader.c
-+++ john-1.7.2/src/loader.c
+--- john-1.7.3.1.orig/src/loader.c
++++ john-1.7.3.1/src/loader.c
@@ -308,6 +308,7 @@
struct db_password *current_pw, *last_pw;
struct list_main *words;
@@ -54,7 +54,7 @@
split = fmt_default_split;
count = 1;
--- /dev/null
-+++ john-1.7.2/src/mscash_fmt.c
++++ john-1.7.3.1/src/mscash_fmt.c
@@ -0,0 +1,544 @@
+/* MSCASH patch for john (performance improvement)
+ *
@@ -600,19 +600,19 @@
+ cmp_exact
+ }
+};
---- john-1.7.2.orig/src/options.c
-+++ john-1.7.2/src/options.c
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/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: " \
+ "--format=NAME force hash type 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-1.7.2.orig/src/john.c
-+++ john-1.7.2/src/john.c
+--- john-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/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;
Modified: trunk/debian/patches/03-add_NetLM-NetNTLM.patch
===================================================================
--- trunk/debian/patches/03-add_NetLM-NetNTLM.patch 2008-11-26 15:30:16 UTC (rev 183)
+++ trunk/debian/patches/03-add_NetLM-NetNTLM.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -1,5 +1,5 @@
---- john-1.7.2.orig/src/Makefile
-+++ john-1.7.2/src/Makefile
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
@@ -18,6 +18,7 @@
CFLAGS = -c -Wall -O2 -fomit-frame-pointer
ASFLAGS = -c
@@ -18,17 +18,17 @@
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 \
-@@ -659,7 +663,7 @@
- $(LD) $(LDFLAGS) $(BENCH_OBJS) -o bench
+@@ -786,7 +790,7 @@
+ $(LD) $(BENCH_OBJS) $(LDFLAGS) -o bench
../run/john: $(JOHN_OBJS)
-- $(LD) $(LDFLAGS) $(JOHN_OBJS) -o ../run/john
-+ $(LD) $(LDFLAGS) $(JOHN_OBJS) -o ../run/john $(LIBS)
+- $(LD) $(JOHN_OBJS) $(LDFLAGS) -o ../run/john
++ $(LD) $(JOHN_OBJS) $(LDFLAGS) -o ../run/john $(LIBS)
../run/unshadow: ../run/john
$(RM) ../run/unshadow
--- /dev/null
-+++ john-1.7.2/src/NETLM_fmt.c
++++ john-1.7.3.1/src/NETLM_fmt.c
@@ -0,0 +1,249 @@
+/*
+ * NETLM_fmt.c -- LM Challenge/Response
@@ -280,7 +280,7 @@
+ }
+};
--- /dev/null
-+++ john-1.7.2/src/NETNTLM_fmt.c
++++ john-1.7.3.1/src/NETNTLM_fmt.c
@@ -0,0 +1,223 @@
+/*
+ * NETNTLM_fmt.c -- NTLM Challenge/Response
@@ -506,7 +506,7 @@
+ }
+};
--- /dev/null
-+++ john-1.7.2/src/byteorder.h
++++ john-1.7.3.1/src/byteorder.h
@@ -0,0 +1,274 @@
+/*
+ Unix SMB/Netbios implementation.
@@ -782,8 +782,8 @@
+#define ALIGN2(p,base) ((p) + ((2 - (PTR_DIFF((p), (base)) & 1)) & 1))
+
+#endif /* _BYTEORDER_H */
---- john-1.7.2.orig/src/inc.c
-+++ john-1.7.2/src/inc.c
+--- john-1.7.3.1.orig/src/inc.c
++++ john-1.7.3.1/src/inc.c
@@ -23,6 +23,7 @@
#include "cracker.h"
@@ -801,8 +801,8 @@
else
mode = "All";
}
---- john-1.7.2.orig/src/john.c
-+++ john-1.7.2/src/john.c
+--- john-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
@@ -40,6 +40,8 @@
extern struct fmt_main fmt_AFS, fmt_LM;
extern struct fmt_main fmt_NT;
@@ -822,8 +822,8 @@
if (!fmt_list) {
fprintf(stderr, "Unknown ciphertext format name requested\n");
---- john-1.7.2.orig/src/loader.c
-+++ john-1.7.2/src/loader.c
+--- john-1.7.3.1.orig/src/loader.c
++++ john-1.7.3.1/src/loader.c
@@ -230,6 +230,25 @@
if (source) sprintf(source, "%s:%s", uid, line);
@@ -851,7 +851,7 @@
if (db_options->flags & DB_WORDS || db_options->shells->head) {
gid = ldr_get_field(&line);
--- /dev/null
-+++ john-1.7.2/src/md4.c
++++ john-1.7.3.1/src/md4.c
@@ -0,0 +1,254 @@
+/*
+ * This is an OpenSSL-compatible implementation of the RSA Data Security,
@@ -1108,7 +1108,7 @@
+
+#endif
--- /dev/null
-+++ john-1.7.2/src/md4.h
++++ john-1.7.3.1/src/md4.h
@@ -0,0 +1,30 @@
+/*
+ * This is an OpenSSL-compatible implementation of the RSA Data Security,
@@ -1140,19 +1140,19 @@
+extern void MD4_Final(unsigned char *result, MD4_CTX *ctx);
+
+#endif
---- john-1.7.2.orig/src/options.c
-+++ john-1.7.2/src/options.c
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/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: " \
+ "--format=NAME force hash type 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-1.7.2/src/smbencrypt.c
++++ john-1.7.3.1/src/smbencrypt.c
@@ -0,0 +1,108 @@
+/*
+ Unix SMB/Netbios implementation.
Modified: trunk/debian/patches/05-mipsel.patch
===================================================================
--- trunk/debian/patches/05-mipsel.patch 2008-11-26 15:30:16 UTC (rev 183)
+++ trunk/debian/patches/05-mipsel.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -1,15 +1,15 @@
---- john-1.7.2.orig/src/Makefile
-+++ john-1.7.2/src/Makefile
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
@@ -94,6 +94,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"
-@@ -251,6 +253,16 @@
+ @echo "linux-ia64 Linux, IA-64"
+ @echo "freebsd-x86-64 FreeBSD, x86-64 with SSE2 (best)"
+ @echo "freebsd-x86-sse2 FreeBSD, x86 with SSE2 (best if 32-bit)"
+@@ -270,6 +272,16 @@
JOHN_OBJS="$(JOHN_OBJS) x86.o" \
ASFLAGS="$(ASFLAGS) -DBSD"
@@ -27,7 +27,7 @@
$(LN) x86-any.h arch.h
$(MAKE) $(PROJ) \
--- /dev/null
-+++ john-1.7.2/src/mipsel.h
++++ john-1.7.3.1/src/mipsel.h
@@ -0,0 +1,43 @@
+/*
+ * This file is part of John the Ripper password cracker,
@@ -73,7 +73,7 @@
+
+#endif
--- /dev/null
-+++ john-1.7.2/src/mips.h
++++ john-1.7.3.1/src/mips.h
@@ -0,0 +1,43 @@
+/*
+ * This file is part of John the Ripper password cracker,
Modified: trunk/debian/patches/07-update_FAQ.patch
===================================================================
--- trunk/debian/patches/07-update_FAQ.patch 2008-11-26 15:30:16 UTC (rev 183)
+++ trunk/debian/patches/07-update_FAQ.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -1,6 +1,6 @@
---- john-1.7.2.orig/doc/FAQ
-+++ john-1.7.2/doc/FAQ
-@@ -70,6 +70,8 @@
+--- john-1.7.3.1.orig/doc/FAQ
++++ john-1.7.3.1/doc/FAQ
+@@ -69,6 +69,8 @@
Q: Where do I get wordlists for use with John?
A: http://www.openwall.com/wordlists/
Added: trunk/debian/patches/08-add_BFEgg.patch
===================================================================
--- trunk/debian/patches/08-add_BFEgg.patch (rev 0)
+++ trunk/debian/patches/08-add_BFEgg.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,692 @@
+--- /dev/null
++++ john-1.7.3.1/src/BFEgg_fmt.c
+@@ -0,0 +1,124 @@
++/*
++ * This file is part of Eggdrop blowfish patch for John The Ripper.
++ * Copyright (c) 2002 by Sun-Zero <sun-zero at freemail.hu>
++ * This is a free software distributable under terms of the GNU GPL.
++ */
++
++#include <string.h>
++
++#include "misc.h"
++#include "formats.h"
++#include "common.h"
++#include "blowfish.c"
++
++#define FORMAT_LABEL "bfegg"
++#define FORMAT_NAME "Eggdrop"
++#define ALG_NAME "blowfish"
++
++#define BENCHMARK_COMMENT ""
++#define BENCHMARK_LENGTH -1
++
++#define PLAINTEXT_LENGTH 31
++#define CIPHERTEXT_LENGTH 33
++
++#define BINARY_SIZE 13
++#define SALT_SIZE 0
++
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 1
++
++static struct fmt_tests tests[] = {
++ {"+9F93o1OxwgK1", "123456"},
++ {"+C/.8o.Wuph9.", "qwerty"},
++ {"+EEHgy/MBLDd0", "walkman"},
++ {"+vPBrs07OTXE/", "tesztuser"},
++ {"+zIvO/1nDsd9.", "654321"},
++ {NULL}
++};
++
++int zerolengthkey = 0;
++
++static char crypt_key[BINARY_SIZE + 1];
++static char saved_key[PLAINTEXT_LENGTH + 1];
++
++static int valid(char *ciphertext) {
++ if (strncmp(ciphertext, "+", 1) != 0) return 0;
++ if (strlen(ciphertext) != 13) return 0;
++
++ return 1;
++}
++
++void init() {
++ blowfish_first_init();
++}
++
++
++static void set_key(char *key, int index) {
++ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1);
++}
++
++static char *get_key(int index) {
++ return saved_key;
++}
++
++static int cmp_all(void *binary, int index) {
++ if (zerolengthkey) return 0;
++ return !memcmp(binary, crypt_key, BINARY_SIZE);
++}
++
++static int cmp_exact(char *source, int index) {
++ return 1;
++}
++
++static void set_salt(void *salt) { }
++
++static void crypt_all(int count) {
++ if (saved_key[0] == '\0') {
++ zerolengthkey = 1;
++ } else {
++ zerolengthkey = 0;
++ blowfish_encrypt_pass(saved_key, crypt_key);
++ }
++}
++
++struct fmt_main fmt_BFEgg = {
++ {
++ FORMAT_LABEL,
++ FORMAT_NAME,
++ ALG_NAME,
++ BENCHMARK_COMMENT,
++ BENCHMARK_LENGTH,
++ PLAINTEXT_LENGTH,
++ BINARY_SIZE,
++ SALT_SIZE,
++ MIN_KEYS_PER_CRYPT,
++ MAX_KEYS_PER_CRYPT,
++ FMT_CASE | FMT_8_BIT,
++ tests
++ }, {
++ init,
++ valid,
++ fmt_default_split,
++ fmt_default_binary,
++ fmt_default_salt,
++ {
++ fmt_default_binary_hash,
++ fmt_default_binary_hash,
++ fmt_default_binary_hash,
++ },
++ fmt_default_salt_hash,
++ set_salt,
++ set_key,
++ get_key,
++ fmt_default_clear_keys,
++ crypt_all,
++ {
++ fmt_default_get_hash,
++ fmt_default_get_hash,
++ fmt_default_get_hash,
++ },
++ cmp_all,
++ cmp_all,
++ cmp_exact
++ }
++};
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -26,6 +26,7 @@
+ DES_fmt.o DES_std.o DES_bs.o \
+ BSDI_fmt.o \
+ MD5_fmt.o MD5_std.o \
++ BFEgg_fmt.o \
+ BF_fmt.o BF_std.o \
+ AFS_fmt.o \
+ LM_fmt.o \
+--- john-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/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_BFEgg;
+ extern struct fmt_main fmt_NT;
+ extern struct fmt_main fmt_mscash;
+ extern struct fmt_main fmt_NETLM;
+@@ -69,6 +70,7 @@
+ john_register_one(&fmt_AFS);
+ john_register_one(&fmt_LM);
+ john_register_one(&fmt_NT);
++ john_register_one(&fmt_BFEgg);
+ john_register_one(&fmt_mscash);
+ john_register_one(&fmt_NETLM);
+ john_register_one(&fmt_NETNTLM);
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
+--- /dev/null
++++ john-1.7.3.1/src/bf_tab.h
+@@ -0,0 +1,277 @@
++/* bf_tab.h: Blowfish P-box and S-box tables */
++#ifndef _H_TAB_BF
++#define _H_TAB_BF
++
++static UWORD_32bits initbf_P[bf_N + 2] =
++{
++ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
++ 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
++ 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
++ 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
++ 0x9216d5d9, 0x8979fb1b,
++};
++static UWORD_32bits initbf_S[4][256] =
++{
++ {
++ 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
++ 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
++ 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
++ 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
++ 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
++ 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
++ 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
++ 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
++ 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
++ 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
++ 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
++ 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
++ 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
++ 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
++ 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
++ 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
++ 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
++ 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
++ 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
++ 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
++ 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
++ 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
++ 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
++ 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
++ 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
++ 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
++ 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
++ 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,
++ 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
++ 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
++ 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
++ 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
++ 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
++ 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
++ 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
++ 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
++ 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
++ 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
++ 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
++ 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
++ 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
++ 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
++ 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
++ 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
++ 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
++ 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
++ 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
++ 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
++ 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
++ 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
++ 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
++ 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
++ 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
++ 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
++ 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
++ 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
++ 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
++ 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
++ 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
++ 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
++ 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
++ 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
++ 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
++ 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a},
++ {
++ 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
++ 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
++ 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
++ 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
++ 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
++ 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
++ 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
++ 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
++ 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
++ 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
++ 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
++ 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
++ 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
++ 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
++ 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
++ 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
++ 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
++ 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
++ 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
++ 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
++ 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
++ 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
++ 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
++ 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
++ 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
++ 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
++ 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
++ 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
++ 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
++ 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
++ 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
++ 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
++ 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
++ 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
++ 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
++ 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
++ 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
++ 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
++ 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
++ 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,
++ 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
++ 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
++ 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
++ 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
++ 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
++ 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
++ 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
++ 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
++ 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
++ 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
++ 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
++ 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
++ 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
++ 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
++ 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
++ 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
++ 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
++ 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
++ 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
++ 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
++ 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
++ 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
++ 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
++ 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7},
++ {
++ 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
++ 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
++ 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
++ 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
++ 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
++ 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
++ 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
++ 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
++ 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
++ 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
++ 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
++ 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
++ 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,
++ 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,
++ 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
++ 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
++ 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
++ 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
++ 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
++ 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
++ 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
++ 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
++ 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
++ 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
++ 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
++ 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
++ 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
++ 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
++ 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
++ 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
++ 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
++ 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
++ 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
++ 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
++ 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
++ 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
++ 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
++ 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
++ 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
++ 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
++ 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
++ 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
++ 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
++ 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
++ 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
++ 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
++ 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
++ 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
++ 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
++ 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
++ 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
++ 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
++ 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
++ 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
++ 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
++ 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
++ 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
++ 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
++ 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
++ 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
++ 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
++ 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
++ 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
++ 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0},
++ {
++ 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
++ 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
++ 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
++ 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
++ 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
++ 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
++ 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
++ 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
++ 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
++ 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
++ 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
++ 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
++ 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
++ 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
++ 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
++ 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
++ 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
++ 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
++ 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
++ 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
++ 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
++ 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
++ 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
++ 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
++ 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
++ 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
++ 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
++ 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
++ 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
++ 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
++ 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
++ 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
++ 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
++ 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
++ 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
++ 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
++ 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
++ 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
++ 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
++ 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
++ 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
++ 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
++ 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
++ 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
++ 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
++ 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
++ 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
++ 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
++ 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
++ 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
++ 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
++ 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
++ 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
++ 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
++ 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
++ 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
++ 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
++ 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
++ 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
++ 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
++ 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
++ 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
++ 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
++ 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}
++};
++
++#endif
+--- /dev/null
++++ john-1.7.3.1/src/blowfish.c
+@@ -0,0 +1,185 @@
++/*
++ * blowfish.c - part of blowfish.mod
++ * handles: encryption and decryption of passwords
++ */
++/*
++ * The first half of this is very lightly edited from public domain
++ * sourcecode. For simplicity, this entire module will remain public
++ * domain.
++ */
++/*
++ * This is ripped from eggdrop 1.3.28's source files (blowfish.mod)
++ * Modified by Sun-Zero <sun-zero at freemail.hu>
++ * 2002-04-16
++*/
++
++#include <stdlib.h>
++
++#include "blowfish.h"
++#include "bf_tab.h" /* P-box P-array, S-box */
++
++/* #define S(x,i) (bf_S[i][x.w.byte##i]) */
++#define S0(x) (bf_S[0][x.w.byte0])
++#define S1(x) (bf_S[1][x.w.byte1])
++#define S2(x) (bf_S[2][x.w.byte2])
++#define S3(x) (bf_S[3][x.w.byte3])
++#define bf_F(x) (((S0(x) + S1(x)) ^ S2(x)) + S3(x))
++#define ROUND(a,b,n) (a.word ^= bf_F(b) ^ bf_P[n])
++
++#include <time.h>
++
++/* keep a set of rotating P & S boxes */
++static struct box_t {
++ UWORD_32bits *P;
++ UWORD_32bits **S;
++ char key[81];
++ char keybytes;
++} box;
++
++//static UWORD_32bits bf_P[bf_N+2];
++//static UWORD_32bits bf_S[4][256];
++static UWORD_32bits *bf_P;
++static UWORD_32bits **bf_S;
++
++
++void blowfish_first_init(void) {
++ box.P = NULL;
++ box.S = NULL;
++ box.key[0] = 0;
++}
++
++static void blowfish_encipher(UWORD_32bits * xl, UWORD_32bits * xr)
++{
++ union aword Xl;
++ union aword Xr;
++
++ Xl.word = *xl;
++ Xr.word = *xr;
++
++ Xl.word ^= bf_P[0];
++ ROUND(Xr, Xl, 1);
++ ROUND(Xl, Xr, 2);
++ ROUND(Xr, Xl, 3);
++ ROUND(Xl, Xr, 4);
++ ROUND(Xr, Xl, 5);
++ ROUND(Xl, Xr, 6);
++ ROUND(Xr, Xl, 7);
++ ROUND(Xl, Xr, 8);
++ ROUND(Xr, Xl, 9);
++ ROUND(Xl, Xr, 10);
++ ROUND(Xr, Xl, 11);
++ ROUND(Xl, Xr, 12);
++ ROUND(Xr, Xl, 13);
++ ROUND(Xl, Xr, 14);
++ ROUND(Xr, Xl, 15);
++ ROUND(Xl, Xr, 16);
++ Xr.word ^= bf_P[17];
++
++ *xr = Xl.word;
++ *xl = Xr.word;
++}
++
++static void blowfish_init(UBYTE_08bits * key, short keybytes)
++{
++ int i, j;
++ UWORD_32bits data;
++ UWORD_32bits datal;
++ UWORD_32bits datar;
++ union aword temp;
++
++ /* is buffer already allocated for this? */
++ if (box.P != NULL) {
++ if ((box.keybytes == keybytes) &&
++ (!strncmp((char *) (box.key), (char *) key, keybytes))) {
++ /* match! */
++ bf_P = box.P;
++ bf_S = box.S;
++ return;
++ }
++ free(box.P);
++ for (i = 0; i < 4; i++)
++ free(box.S[i]);
++ free(box.S);
++ }
++ /* initialize new buffer */
++ /* uh... this is over 4k */
++ box.P = (UWORD_32bits *) malloc((bf_N + 2) * sizeof(UWORD_32bits));
++ box.S = (UWORD_32bits **) malloc(4 * sizeof(UWORD_32bits *));
++ for (i = 0; i < 4; i++)
++ box.S[i] = (UWORD_32bits *) malloc(256 * sizeof(UWORD_32bits));
++ bf_P = box.P;
++ bf_S = box.S;
++ box.keybytes = keybytes;
++ strncpy(box.key, (char *) key, keybytes);
++ /* robey: reset blowfish boxes to initial state */
++ /* (i guess normally it just keeps scrambling them, but here it's
++ * important to get the same encrypted result each time) */
++ for (i = 0; i < bf_N + 2; i++)
++ bf_P[i] = initbf_P[i];
++ for (i = 0; i < 4; i++)
++ for (j = 0; j < 256; j++)
++ bf_S[i][j] = initbf_S[i][j];
++
++ j = 0;
++ for (i = 0; i < bf_N + 2; ++i) {
++ temp.word = 0;
++ temp.w.byte0 = key[j];
++ temp.w.byte1 = key[(j + 1) % keybytes];
++ temp.w.byte2 = key[(j + 2) % keybytes];
++ temp.w.byte3 = key[(j + 3) % keybytes];
++ data = temp.word;
++ bf_P[i] = bf_P[i] ^ data;
++ j = (j + 4) % keybytes;
++ }
++ datal = 0x00000000;
++ datar = 0x00000000;
++ for (i = 0; i < bf_N + 2; i += 2) {
++ blowfish_encipher(&datal, &datar);
++ bf_P[i] = datal;
++ bf_P[i + 1] = datar;
++ }
++ for (i = 0; i < 4; ++i) {
++ for (j = 0; j < 256; j += 2) {
++ blowfish_encipher(&datal, &datar);
++ bf_S[i][j] = datal;
++ bf_S[i][j + 1] = datar;
++ }
++ }
++}
++
++/* stuff below this line was written by robey for eggdrop use */
++
++/* of course, if you change either of these, then your userfile will
++ * no longer be able to be shared. :) */
++#define SALT1 0xdeadd061
++#define SALT2 0x23f6b095
++
++/* convert 64-bit encrypted password to text for userfile */
++static char *base64 = "./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
++
++static void blowfish_encrypt_pass(char *text, char *new)
++{
++ UWORD_32bits left, right;
++ int n;
++ char *p;
++
++ blowfish_init((UBYTE_08bits *) text, strlen(text));
++ left = SALT1;
++ right = SALT2;
++ blowfish_encipher(&left, &right);
++ p = new;
++ *p++ = '+'; /* + means encrypted pass */
++ n = 32;
++ while (n > 0) {
++ *p++ = base64[right & 0x3f];
++ right = (right >> 6);
++ n -= 6;
++ }
++ n = 32;
++ while (n > 0) {
++ *p++ = base64[left & 0x3f];
++ left = (left >> 6);
++ n -= 6;
++ }
++ *p = 0;
++}
+--- /dev/null
++++ john-1.7.3.1/src/blowfish.h
+@@ -0,0 +1,55 @@
++/* modified 19jul1996 by robey -- uses autoconf values now */
++#ifndef _H_BLOWFISH
++#define _H_BLOWFISH
++
++#include "arch.h"
++
++#define bf_N 16
++#define noErr 0
++#define DATAERROR -1
++
++#define UBYTE_08bits unsigned char
++#define UWORD_16bits unsigned short
++
++#define SIZEOF_INT 4
++
++#if SIZEOF_INT==4
++#define UWORD_32bits unsigned int
++#else
++#if SIZEOF_LONG==4
++#define UWORD_32bits unsigned long
++#endif
++#endif
++
++/* choose a byte order for your hardware */
++
++#if !ARCH_LITTLE_ENDIAN
++/* ABCD - big endian - motorola */
++union aword {
++ UWORD_32bits word;
++ UBYTE_08bits byte[4];
++ struct {
++ unsigned int byte0:8;
++ unsigned int byte1:8;
++ unsigned int byte2:8;
++ unsigned int byte3:8;
++ } w;
++};
++#endif /* !ARCH_LITTLE_ENDIAN */
++
++#if ARCH_LITTLE_ENDIAN
++/* DCBA - little endian - intel */
++union aword {
++ UWORD_32bits word;
++ UBYTE_08bits byte[4];
++ struct {
++ unsigned int byte3:8;
++ unsigned int byte2:8;
++ unsigned int byte1:8;
++ unsigned int byte0:8;
++ } w;
++};
++
++#endif /* ARCH_LITTLE_ENDIAN */
++
++#endif
Added: trunk/debian/patches/09-add_KRB5.patch
===================================================================
--- trunk/debian/patches/09-add_KRB5.patch (rev 0)
+++ trunk/debian/patches/09-add_KRB5.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,734 @@
+--- /dev/null
++++ john-1.7.3.1/src/KRB5_fmt.c
+@@ -0,0 +1,349 @@
++/*
++ * KRB5_fmt.c
++ *
++ * Kerberos 5 module for John the Ripper by Solar Designer, based on the
++ * KRB4 module by Dug Song.
++ *
++ * Author: Nasko Oskov <nasko at netsekure.org>
++ *
++ * Licensing:
++ *
++ * The module contains code derived or copied from the Heimdal project.
++ *
++ * Copyright (c) 1997-2000 Kungliga Tekniska Högskolan
++ * (Royal Institute of Technology, Stockholm, Sweden).
++ * All rights reserved.
++ *
++ * Which is distribution of Kerberos based on M.I.T. implementation.
++ *
++ * Copyright (C) 1990 by the Massachusetts Institute of Technology
++ *
++ */
++
++#include <stdlib.h>
++
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
++#include <errno.h>
++
++#include <string.h>
++#include <openssl/des.h>
++
++#include <ctype.h>
++
++#include "arch.h"
++#include "misc.h"
++#include "formats.h" // needed for format structs
++#include "KRB5_std.h"
++
++
++// defines // {{{
++#define MAGIC_PREFIX "$krb5$"
++#define MAX_REALM_LEN 64
++#define TGT_SIZE 228
++#define MAX_USER_LEN 64
++#define MAX_PASS_LEN 64
++
++#define FORMAT_LABEL "krb5"
++#define FORMAT_NAME "Kerberos v5 TGT"
++#define ALGORITHM_NAME "krb5 3DES (des3-cbc-sha1)"
++#define BENCHMARK_COMMENT ""
++#define BENCHMARK_LENGTH -1
++#define PLAINTEXT_LENGTH 32
++#define BINARY_SIZE 0
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 1
++
++/* This string is a bit too short - might give false positives */
++#define KRBTGT "krbtgt"
++// }}}
++
++
++/**
++ * structure to hold the self tests // {{{
++ */
++static struct fmt_tests KRB5_fmt_tests[] = {
++ {"$krb5$oskov$ACM.UIUC.EDU$4730d7249765615d6f3652321c4fb76d09fb9cd06faeb0c31b8737f9fdfcde4bd4259c31cb1dff25df39173b09abdff08373302d99ac09802a290915243d9f0ea0313fdedc7f8d1fae0d9df8f0ee6233818d317f03a72c2e77b480b2bc50d1ca14fba85133ea00e472c50dbc825291e2853bd60a969ddb69dae35b604b34ea2c2265a4ffc72e9fb811da17c7f2887ccb17e2f87cd1f6c28a9afc0c083a9356a9ee2a28d2e4a01fc7ea90cc8836b8e25650c3a1409b811d0bad42a59aa418143291d42d7b1e6cb5b1876a4cc758d721323a762e943f774630385c9faa68df6f3a94422f97", "p4ssW0rd"},
++ {"$krb5$oskov$ACM.UIUC.EDU$6cba0316d38e31ba028f87394792baade516afdfd8c5a964b6a7677adbad7815d778b297beb238394aa97a4d495adb7c9b7298ba7c2a2062fb6c9a4297f12f83755060f4f58a1ea4c7026df585cdfa02372ad619ab1a4ec617ad23e76d6e37e36268d9aa0abcf83f11fa8092b4328c5e6c577f7ec6f1c1684d9c99a309eee1f5bd764c4158a2cf311cded8794b2de83131c3dc51303d5300e563a2b7a230eac67e85b4593e561bf6b88c77b82c729e7ba7f3d2f99b8dc85b07873e40335aff4647833a87681ee557fbd1ffa1a458a5673d1bd3c1587eceeabaebf4e44c24d9a8ac8c1d89", "Nask0Oskov"},
++ {NULL}
++};
++// }}}
++
++/**
++ * struct to save the salt into
++ */
++struct salt { // {{{
++ char realm[MAX_REALM_LEN];
++ char user[MAX_USER_LEN];
++ char tgt_ebin[TGT_SIZE];
++ char passwd[MAX_PASS_LEN];
++};
++#define SALT_SIZE sizeof(struct salt)
++// }}}
++
++struct key { // {{{
++ char passwd[MAX_PASS_LEN];
++ char key[MAX_PASS_LEN];
++ DES_key_schedule sched[3];
++};
++// }}}
++
++static struct salt *psalt = NULL;
++static struct key skey;
++
++static char username[MAX_USER_LEN];
++static char realm[MAX_REALM_LEN];
++static char password[MAX_PASS_LEN];
++
++// initialization vector for des
++static DES_cblock ivec;
++
++krb5_key _krb5key;
++krb5_key *krb5key = &_krb5key;
++
++/**
++ * hex2bin // {{{
++ */
++static void hex2bin(char *src, u_char *dst, int outsize) {
++ char *p, *pe;
++ u_char *q, *qe, ch, cl;
++
++ pe = src + strlen(src);
++ qe = dst + outsize;
++
++ for (p = src, q = dst; p < pe && q < qe && isxdigit((int)(unsigned char)*p); p += 2) {
++ ch = tolower((int)(unsigned char)p[0]);
++ cl = tolower((int)(unsigned char)p[1]);
++
++ if ((ch >= '0') && (ch <= '9')) ch -= '0';
++ else if ((ch >= 'a') && (ch <= 'f')) ch -= 'a' - 10;
++ else return;
++
++ if ((cl >= '0') && (cl <= '9')) cl -= '0';
++ else if ((cl >= 'a') && (cl <= 'f')) cl -= 'a' - 10;
++ else return;
++
++ *q++ = (ch << 4) | cl;
++ }
++}
++// }}}
++
++/**
++ * krb5_decrypt_compare // {{{
++ *
++ */
++int krb5_decrypt_compare() {
++/* TGT_SIZE is not a multiple of DES block size; add space for one extra
++ * DES block to make sure the OpenSSL routines will not overwrite stack
++ * space beyond the end of plain[] when they operate on whole DES blocks. */
++ char plain[TGT_SIZE + 8];
++ int i;
++
++ memset(krb5key->key, 0x00, DES3_KEY_SIZE);
++ memset(krb5key->schedule, 0x00, DES3_KEY_SCHED_SIZE);
++
++/* NUL padding is intentional */
++ strncpy(username, psalt->user, MAX_USER_LEN);
++ strncpy(realm, psalt->realm, MAX_REALM_LEN);
++ strncpy(password, skey.passwd, MAX_PASS_LEN);
++
++ // do str2key
++ str2key(username, realm, password, krb5key);
++
++/* Possible optimization: we might not have to decrypt the entire thing */
++ des3_decrypt(krb5key, psalt->tgt_ebin, plain, TGT_SIZE);
++
++ for(i=0;i<TGT_SIZE;++i)
++ if (plain[i] == 'k')
++ if (strncmp(plain + i, KRBTGT, strlen(KRBTGT)) == 0) {
++/* NUL padding is intentional */
++ strncpy(psalt->passwd, skey.passwd, MAX_PASS_LEN);
++ return 1;
++ }
++ return 0;
++}
++// }}}
++
++/**
++ * int krb5_valid // {{{
++ *
++ */
++static int krb5_valid(char *ciphertext) {
++
++ if (strncmp(ciphertext, MAGIC_PREFIX, strlen(MAGIC_PREFIX)) != 0)
++ return 0;
++
++ return 1;
++}
++// }}}
++
++/**
++ * void * krb5_salt // {{{
++ *
++ */
++static void * krb5_salt(char *ciphertext) {
++
++ struct salt *salt = NULL;
++ char *data = ciphertext, *p;
++
++ // check the presence of $krb5$
++ if (strncmp(data, MAGIC_PREFIX, strlen(MAGIC_PREFIX)) == 0) {
++ // advance past the $krb5$ string
++ data += strlen(MAGIC_PREFIX);
++
++ // allocate memory for the struct
++ salt = malloc(sizeof(struct salt));
++ if (salt == NULL)
++ return NULL;
++
++ // find and copy the user field
++ p = strchr(data, '$');
++ strnzcpy(salt->user, data, (p - data) + 1);
++ data = p + 1;
++
++ // find and copy the realm field
++ p = strchr(data, '$');
++ strnzcpy(salt->realm, data, (p - data) + 1);
++ data = p + 1;
++
++ // copy over the TGT in a binary form to the salt struct
++ hex2bin(data, (u_char *) salt->tgt_ebin, TGT_SIZE);
++ }
++ return salt;
++}
++// }}}
++
++/**
++ * void krb5_set_salt // {{{
++ *
++ */
++static void krb5_set_salt(void *salt) {
++ psalt = (struct salt *) salt;
++}
++// }}}
++
++/**
++ * void krb5_set_key // {{{
++ *
++ */
++static void krb5_set_key(char *key, int index) {
++
++ // copy the string key to the saved key
++ memset(skey.passwd, 0x00, MAX_PASS_LEN);
++ strnzcpy(skey.passwd, key, sizeof(skey.passwd));
++
++}
++// }}}
++
++/**
++ * char * krb5_get_key // {{{
++ *
++ */
++static char * krb5_get_key(int index) {
++ return skey.passwd;
++}
++// }}}
++
++/**
++ * void krb5_crypt_all // {{{
++ *
++ */
++static void krb5_crypt_all(int count) {
++ // do nothing
++}
++// }}}
++
++/**
++ * int krb5_cmp_all // {{{
++ *
++ */
++static int krb5_cmp_all(void *binary, int count) {
++ return krb5_decrypt_compare();
++}
++// }}}
++
++/**
++ * int krb5_cmp_one // {{{
++ *
++ */
++static int krb5_cmp_one(void *binary, int count) {
++
++ return krb5_decrypt_compare();
++
++}
++// }}}
++
++/**
++ * int krb5_cmp_exact // {{{
++ *
++ */
++static int krb5_cmp_exact(char *source, int index) {
++ return 1;
++}
++// }}}
++
++/**
++ * void krb5_init // {{{
++ *
++ */
++static void krb5_init() {
++
++ memset(&ivec, 0x00, sizeof(ivec));
++ memset(&skey, 0x00, sizeof(skey));
++ memset(krb5key, 0x00, sizeof(krb5_key));
++
++ krb5key->key = (char *) malloc(DES3_KEY_SIZE);
++ krb5key->schedule = (char *) malloc(DES3_KEY_SCHED_SIZE);
++ memset(krb5key->key, 0x00, DES3_KEY_SIZE);
++ memset(krb5key->schedule, 0x00, DES3_KEY_SCHED_SIZE);
++
++}
++// }}}
++
++/**
++ * fmt_main struct with KRB5 values // {{{
++ */
++struct fmt_main fmt_KRB5 = {
++ {
++ 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,
++ KRB5_fmt_tests
++ }, {
++ krb5_init,
++ krb5_valid,
++ fmt_default_split,
++ fmt_default_binary,
++ krb5_salt,
++ {
++ fmt_default_binary_hash,
++ fmt_default_binary_hash,
++ fmt_default_binary_hash
++ },
++ fmt_default_salt_hash,
++ krb5_set_salt,
++ krb5_set_key,
++ krb5_get_key,
++ fmt_default_clear_keys,
++ krb5_crypt_all,
++ {
++ fmt_default_get_hash,
++ fmt_default_get_hash,
++ fmt_default_get_hash
++ },
++ krb5_cmp_all,
++ krb5_cmp_one,
++ krb5_cmp_exact
++ }
++};
++// }}}
++
+--- /dev/null
++++ john-1.7.3.1/src/KRB5_std.c
+@@ -0,0 +1,281 @@
++/*
++ * KRB5_std.c
++ *
++ * Kerberos 5 module for John the Ripper by Solar Designer, based on the
++ * KRB4 module by Dug Song.
++ *
++ * Author: Nasko Oskov <nasko at netsekure.org>
++ *
++ * Licensing:
++ *
++ * The module contains code derived or copied from the Heimdal project.
++ *
++ * Copyright (c) 1997-2000 Kungliga Tekniska Högskolan
++ * (Royal Institute of Technology, Stockholm, Sweden).
++ * All rights reserved.
++ *
++ * Which is distribution of Kerberos based on M.I.T. implementation.
++ *
++ * Copyright (C) 1990 by the Massachusetts Institute of Technology
++ *
++ */
++
++
++#include <stdlib.h>
++#include <string.h>
++#include <stdio.h>
++
++#include "KRB5_std.h"
++
++static DES_cblock ivec;
++static const char derive_const[5] = "\x00\x00\x00\x03\xaa";
++
++/**
++ * Heimdal rr13 function // {{{
++ */
++static inline void rr13(unsigned char *buf, int len) {
++
++ unsigned char *tmp;
++ int bytes = (len + 7) / 8;
++ int i;
++
++ int bb;
++ int b1, s1, b2, s2;
++
++ const int bits = 13 % len;
++ const int lbit = len % 8;
++
++ if(len == 0)
++ return;
++
++ tmp = (unsigned char *) malloc(bytes);
++ memcpy(tmp, buf, bytes);
++ if(lbit) {
++ // pad final byte with inital bits
++ tmp[bytes - 1] &= 0xff << (8 - lbit);
++ for(i = lbit; i < 8; i += len)
++ tmp[bytes - 1] |= buf[0] >> i;
++ }
++ for(i = 0; i < bytes; i++) {
++ // calculate first bit position of this byte
++ bb = 8 * i - bits;
++ while(bb < 0)
++ bb += len;
++ // byte offset and shift count
++ b1 = bb / 8;
++ s1 = bb % 8;
++
++ if(bb + 8 > bytes * 8)
++ // watch for wraparound
++ s2 = (len + 8 - s1) % 8;
++ else
++ s2 = 8 - s1;
++ b2 = (b1 + 1) % bytes;
++ buf[i] = (tmp[b1] << s1) | (tmp[b2] >> s2);
++ }
++ free(tmp);
++}
++// }}}
++
++/**
++ * Heimdal add1 function // {{{
++ */
++static inline void add1(unsigned char *a, unsigned char *b, size_t len) {
++ int i, x;
++ int carry = 0;
++ for(i = len - 1; i >= 0; i--){
++ x = a[i] + b[i] + carry;
++ carry = x > 0xff;
++ a[i] = x & 0xff;
++ }
++ for(i = len - 1; carry && i >= 0; i--){
++ x = a[i] + carry;
++ carry = x > 0xff;
++ a[i] = x & 0xff;
++ }
++}
++// }}}
++
++/**
++ * Heimdal _krb5_n_fold function // {{{
++ */
++static inline void _krb5_n_fold(const void *str, int len, void *key, int size) {
++
++ int maxlen = 2 * max(size, len), l = 0;
++ unsigned char *tmp = (unsigned char *) malloc(maxlen);
++ unsigned char *buf = (unsigned char *) malloc(len);
++
++ memcpy(buf, str, len);
++ memset(key, 0, size);
++ do {
++ memcpy(tmp + l, buf, len);
++ l += len;
++ rr13(buf, len * 8);
++ while(l >= size) {
++ add1(key, tmp, size);
++ l -= size;
++ if(l == 0)
++ break;
++ memmove(tmp, tmp + size, l);
++ }
++ } while(l != 0);
++ sfree(buf, len);
++ sfree(tmp, maxlen);
++}
++// }}}
++
++/**
++ * Heimdal DES3_postproc function // {{{
++ */
++static inline void DES3_postproc(unsigned char *k, int len, krb5_key *krb5key) {
++ unsigned char x[24];
++ int i, j;
++ unsigned char foo;
++ unsigned char b;
++
++ memset(x, 0, sizeof(x));
++ for (i = 0; i < 3; ++i) {
++ for (j = 0; j < 7; ++j) {
++ b = k[7 * i + j];
++ x[8 * i + j] = b;
++ }
++ foo = 0;
++ for (j = 6; j >= 0; --j) {
++ foo |= k[7 * i + j] & 1;
++ foo <<= 1;
++ }
++ x[8 * i + 7] = foo;
++ }
++ k = (unsigned char *) krb5key->key;
++ memcpy(k, x, 24);
++ DES_set_odd_parity((DES_cblock*)k);
++ DES_set_odd_parity((DES_cblock*)(k + 8));
++ DES_set_odd_parity((DES_cblock*)(k + 16));
++
++#if 0
++ memset(x, 0, sizeof(x));
++#endif
++}
++// }}}
++
++/**
++ * Heimdal based derive_key function // {{{
++ */
++static inline void derive_key(const void *constant, int len, krb5_key *krb5key) {
++
++ unsigned char *k;
++ unsigned int nblocks = 0, i;
++ DES_cblock *bk;
++ DES_key_schedule *s;
++
++ // set the des schedule
++ bk = (DES_cblock*) krb5key->key;
++ s = (DES_key_schedule *) krb5key->schedule;
++ DES_set_key(&bk[0], &s[0]);
++ DES_set_key(&bk[1], &s[1]);
++ DES_set_key(&bk[2], &s[2]);
++
++ if(DES3_BLOCK_SIZE * 8 < DES3_KEY_BITS || len != DES3_BLOCK_SIZE) {
++ nblocks = (DES3_KEY_BITS + DES3_BLOCK_SIZE * 8 - 1) / (DES3_BLOCK_SIZE * 8);
++ k = (unsigned char *) malloc(nblocks * DES3_BLOCK_SIZE);
++ if(k == NULL) {
++ printf("malloc: out of memory\n");
++ exit(1);
++ }
++ _krb5_n_fold(constant, len, k, DES3_BLOCK_SIZE);
++ for(i = 0; i < nblocks; i++) {
++ if(i > 0)
++ memcpy(k + i * DES3_BLOCK_SIZE, k + (i - 1) * DES3_BLOCK_SIZE, DES3_BLOCK_SIZE);
++
++ memset(ivec, 0x00, sizeof(ivec));
++ DES_ede3_cbc_encrypt((void *) k + i * DES3_BLOCK_SIZE, (void *) k + i * DES3_BLOCK_SIZE,
++ DES3_BLOCK_SIZE, &s[0], &s[1], &s[2], (DES_cblock *) ivec, 1);
++ }
++ } else {
++ printf("Error, should never get here\n");
++ exit(1);
++ }
++
++ // keytype dependent post-processing
++ DES3_postproc(k, nblocks * DES3_BLOCK_SIZE, krb5key);
++
++ sfree(k, nblocks * DES3_BLOCK_SIZE);
++}
++// }}}
++
++/**
++ * Heimdal based string_to_key_derived function // {{{
++ */
++static inline void string_to_key_derived(const void *passwd, int len, krb5_key *krb5key) {
++
++ unsigned char *tmp;
++
++ tmp = (unsigned char *) malloc(DES3_KEY_BITS_BYTES);
++ if(tmp == NULL) {
++ printf("malloc: out of memory\n");
++ // FIXME make it real return value if sometime this is needed
++ exit(1);
++ }
++ _krb5_n_fold(passwd, len, tmp, DES3_KEY_BITS_BYTES);
++
++ DES3_postproc(tmp, DES3_KEY_BITS_BYTES, krb5key);
++ derive_key("kerberos", strlen("kerberos"), krb5key);
++
++ sfree(tmp, DES3_KEY_BITS_BYTES);
++}
++// }}}
++
++/**
++ * des3_decrypt // {{{
++ */
++void des3_decrypt(krb5_key *key, char *cipher, char *plain, int len) {
++
++ DES_cblock *k;
++ DES_key_schedule *s;
++
++ memset(&ivec, 0x00, sizeof(ivec));
++
++ k = (DES_cblock *) key->key;
++ s = (DES_key_schedule *) key->schedule;
++
++ DES_set_key(&k[0], &s[0]);
++ DES_set_key(&k[1], &s[1]);
++ DES_set_key(&k[2], &s[2]);
++
++ DES_ede3_cbc_encrypt((const unsigned char*) cipher, (unsigned char*) plain, len, &s[0], &s[1], &s[2], &ivec, 0);
++
++}
++// }}}
++
++/**
++ * str2key // {{{
++ */
++void str2key(char *user, char *realm, char *passwd, krb5_key *krb5key) {
++ int offset = 0;
++ char *text;
++
++ text = (char*) malloc(strlen(user) + strlen(realm) + strlen(passwd));
++ if (text == NULL) {
++ return;
++ }
++
++ memset(krb5key->key, 0x00, DES3_KEY_SIZE);
++ memset(krb5key->schedule, 0x00, DES3_KEY_SCHED_SIZE);
++
++ // make the string from the passwd, realm, username
++ offset = 0;
++ memcpy(text + offset, passwd, strlen(passwd));
++ offset += strlen(passwd);
++ memcpy(text + offset, realm, strlen(realm));
++ offset += strlen(realm);
++ memcpy(text + offset, user, strlen(user));
++ offset += strlen(user);
++
++ string_to_key_derived(text, offset, krb5key);
++
++ // derive key from key
++ derive_key(derive_const, sizeof(derive_const), krb5key);
++
++}
++// }}}
++
+--- /dev/null
++++ john-1.7.3.1/src/KRB5_std.h
+@@ -0,0 +1,56 @@
++/*
++ * KRB5_std.h
++ *
++ * Kerberos 5 module for John the Ripper by Solar Designer, based on the
++ * KRB4 module by Dug Song.
++ *
++ * Author: Nasko Oskov <nasko at netsekure.org>
++ *
++ * Licensing:
++ *
++ * The module contains code derived or copied from the Heimdal project.
++ *
++ * Copyright (c) 1997-2000 Kungliga Tekniska Högskolan
++ * (Royal Institute of Technology, Stockholm, Sweden).
++ * All rights reserved.
++ *
++ * Which is distribution of Kerberos based on M.I.T. implementation.
++ *
++ * Copyright (C) 1990 by the Massachusetts Institute of Technology
++ *
++ */
++
++#ifndef _KRB5_STD_H_
++#define _KRB5_STD_H_
++
++#include <openssl/des.h>
++
++#define DES3_BLOCK_SIZE 8
++#define DES3_KEY_SIZE 24
++#define DES3_KEY_BITS 168
++#define DES3_KEY_BITS_BYTES DES3_KEY_BITS/8
++#define DES3_KEY_SCHED_SIZE (sizeof(DES_key_schedule) * 3)
++
++#ifndef sfree
++#define sfree(x, len) if (x) { /* memset(x, 0x00, len); */ free(x); }
++#endif
++
++#ifndef min
++#define min(A, B) ((A) < (B) ? (A): (B))
++#endif
++
++#ifndef max
++#define max(A, B) ((A) > (B) ? (A): (B))
++#endif
++
++typedef struct _krb5_key {
++ char *key;
++ char *schedule;
++} krb5_key;
++
++void des3_decrypt(krb5_key *key, char *cipher, char *plain, int len);
++
++void str2key(char *user, char *realm, char *passwd, krb5_key *krb5key);
++
++#endif // _KRB5_STD_H_
++
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -35,6 +35,7 @@
+ NETLM_fmt.o \
+ NETNTLM_fmt.o \
+ md4.o smbencrypt.o \
++ KRB5_fmt.o KRB5_std.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-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -43,6 +43,7 @@
+ extern struct fmt_main fmt_mscash;
+ extern struct fmt_main fmt_NETLM;
+ extern struct fmt_main fmt_NETNTLM;
++extern struct fmt_main fmt_KRB5;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -74,6 +75,7 @@
+ john_register_one(&fmt_mscash);
+ john_register_one(&fmt_NETLM);
+ john_register_one(&fmt_NETNTLM);
++ john_register_one(&fmt_KRB5);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
Added: trunk/debian/patches/10-add_DOMINOSEC.patch
===================================================================
--- trunk/debian/patches/10-add_DOMINOSEC.patch (rev 0)
+++ trunk/debian/patches/10-add_DOMINOSEC.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,498 @@
+--- /dev/null
++++ john-1.7.3.1/src/DOMINOSEC_fmt.c
+@@ -0,0 +1,456 @@
++/*
++ * DOMINOSEC_fmt.c (version 3)
++ *
++ * Notes/Domino More Secure Internet Password module for Solar Designer's JtR
++ * by regenrecht at o2.pl, Dec 2005.
++ * Algorithm discovery by regenrecht at o2.pl, bartavelle at bandecon.com.
++ *
++ * Short description.
++ * 1. Make 128bit digest of key. (128/8=16 bytes)
++ * 2. Do bin2hex() of key digest and put braces around it. (16*2+2=34 bytes)
++ * 3. Concat output of previous step to 5 bytes of salt. (5+34=39 bytes)
++ * 4. Make 128bit digest of first 34 bytes (out of 39 bytes). (128/8=16 bytes)
++ * 5. Compare first 10 bytes (out of 16) to check if the key was correct.
++ *
++ * Password file should have form of:
++ * TomaszJegerman:(GKjXibCW2Ml6juyQHUoP)
++ * RubasznyJan:(GrixoFHOckC/2CnHrHtM)
++ */
++
++#include <ctype.h>
++#include <string.h>
++
++#include "misc.h"
++#include "formats.h"
++#include "common.h"
++
++#define FORMAT_LABEL "dominosec"
++#define FORMAT_NAME "More Secure Internet Password"
++#define ALGORITHM_NAME "RSA MD defined by BSAFE 1.x - Lotus v6"
++
++#define BENCHMARK_COMMENT ""
++#define BENCHMARK_LENGTH 0
++
++#define PLAINTEXT_LENGTH 64
++#define CIPHERTEXT_LENGTH 22
++#define BINARY_SIZE 9 /* oh, well :P */
++#define SALT_SIZE 5
++
++#define DIGEST_SIZE 16
++#define BINARY_BUFFER_SIZE (DIGEST_SIZE-SALT_SIZE)
++#define ASCII_DIGEST_LENGTH (DIGEST_SIZE*2)
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 1
++
++static unsigned char key_digest[DIGEST_SIZE];
++static char saved_key[PLAINTEXT_LENGTH+1];
++static unsigned char crypted_key[DIGEST_SIZE];
++static unsigned char salt_and_digest[SALT_SIZE+1+ASCII_DIGEST_LENGTH+1+1] =
++ "saalt(................................)";
++static unsigned int saved_key_len;
++
++static const char *hex_table[] = {
++ "00", "01", "02", "03", "04", "05", "06", "07",
++ "08", "09", "0A", "0B", "0C", "0D", "0E", "0F",
++ "10", "11", "12", "13", "14", "15", "16", "17",
++ "18", "19", "1A", "1B", "1C", "1D", "1E", "1F",
++ "20", "21", "22", "23", "24", "25", "26", "27",
++ "28", "29", "2A", "2B", "2C", "2D", "2E", "2F",
++ "30", "31", "32", "33", "34", "35", "36", "37",
++ "38", "39", "3A", "3B", "3C", "3D", "3E", "3F",
++ "40", "41", "42", "43", "44", "45", "46", "47",
++ "48", "49", "4A", "4B", "4C", "4D", "4E", "4F",
++ "50", "51", "52", "53", "54", "55", "56", "57",
++ "58", "59", "5A", "5B", "5C", "5D", "5E", "5F",
++ "60", "61", "62", "63", "64", "65", "66", "67",
++ "68", "69", "6A", "6B", "6C", "6D", "6E", "6F",
++ "70", "71", "72", "73", "74", "75", "76", "77",
++ "78", "79", "7A", "7B", "7C", "7D", "7E", "7F",
++ "80", "81", "82", "83", "84", "85", "86", "87",
++ "88", "89", "8A", "8B", "8C", "8D", "8E", "8F",
++ "90", "91", "92", "93", "94", "95", "96", "97",
++ "98", "99", "9A", "9B", "9C", "9D", "9E", "9F",
++ "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
++ "A8", "A9", "AA", "AB", "AC", "AD", "AE", "AF",
++ "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7",
++ "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF",
++ "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7",
++ "C8", "C9", "CA", "CB", "CC", "CD", "CE", "CF",
++ "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
++ "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF",
++ "E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7",
++ "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF",
++ "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7",
++ "F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF"
++};
++
++static const char lotus_magic_table[] = {
++ 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a,
++ 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0,
++ 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b,
++ 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a,
++ 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda,
++ 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36,
++ 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8,
++ 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c,
++ 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17,
++ 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60,
++ 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72,
++ 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa,
++ 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd,
++ 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e,
++ 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b,
++ 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf,
++ 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77,
++ 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6,
++ 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3,
++ 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3,
++ 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e,
++ 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c,
++ 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d,
++ 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2,
++ 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46,
++ 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5,
++ 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97,
++ 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5,
++ 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef,
++ 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f,
++ 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf,
++ 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab,
++ /* double power! */
++ 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a,
++ 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0,
++ 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b,
++ 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a,
++ 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda,
++ 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36,
++ 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8,
++ 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c,
++ 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17,
++ 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60,
++ 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72,
++ 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa,
++ 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd,
++ 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e,
++ 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b,
++ 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf,
++ 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77,
++ 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6,
++ 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3,
++ 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3,
++ 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e,
++ 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c,
++ 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d,
++ 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2,
++ 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46,
++ 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5,
++ 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97,
++ 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5,
++ 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef,
++ 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f,
++ 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf,
++ 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab,
++};
++
++static struct fmt_tests dominosec_tests[] = {
++ {"(GVMroLzc50YK/Yd+L8KH)", ""},
++ {"(GqnUDNNGNUz5HRoelmLU)", "x"},
++ {"(GNBpcGJRYpBe9orUOpmZ)", "dupaaa123"},
++ {"(G0xjUQzdKxvHpUYqo5hU)", "koziolekmatolek"},
++ {"(G+dfECo845XxUw+nFVYD)", "szesnascieznakow"},
++ {"(GowT5I2hVHZpRWpvGmux)", "terazjakiesdwadziesciacos"},
++ {"(Gq2bAtpguiTSSycy6dhu)", "trzydziescidwamozesieudaojnieuda"},
++ {"(G82TtgNcqcHGkpEo7wQp)", "looongrandominputdataforfunbutnotonlyoi!"},
++ {NULL}
++};
++
++struct cipher_binary_struct {
++ unsigned char salt[SALT_SIZE];
++ unsigned char hash[BINARY_BUFFER_SIZE];
++} cipher_binary;
++
++static void mdtransform(unsigned char state[16], unsigned char checksum[16], unsigned char block[16])
++{
++ unsigned char x[48];
++ unsigned int t = 0;
++ unsigned int i,j;
++ unsigned char * pt;
++ unsigned char c;
++
++ memcpy(x, state, 16);
++ memcpy(x+16, block, 16);
++
++ for(i=0;i<16;i++)
++ x[i+32] = state[i] ^ block[i];
++
++ for (i = 0; i < 18; ++i)
++ {
++ pt = (unsigned char*)&x;
++ for (j = 48; j > 0; j--)
++ {
++ *pt ^= lotus_magic_table[j+t];
++ t = *pt;
++ pt++;
++ }
++ }
++
++ memcpy(state, x, 16);
++
++ t = checksum[15];
++ for (i = 0; i < 16; i++)
++ {
++ c = lotus_magic_table[block[i]^t];
++ checksum[i] ^= c;
++ t = checksum[i];
++ }
++}
++
++static void mdtransform_norecalc(unsigned char state[16], unsigned char block[16])
++{
++ unsigned char x[48], *pt;
++ unsigned int t = 0;
++ unsigned int i,j;
++
++ memcpy(x, state, 16);
++ memcpy(x+16, block, 16);
++
++ for(i=0;i<16;i++)
++ x[i+32] = state[i] ^ block[i];
++
++ for(i = 0; i < 18; ++i)
++ {
++ pt = (unsigned char*)&x;
++ for (j = 48; j > 0; j--)
++ {
++ *pt ^= lotus_magic_table[j+t];
++ t = *pt;
++ pt++;
++ }
++ }
++
++ memcpy(state, x, 16);
++}
++
++static void domino_big_md(unsigned char * saved_key, int size, unsigned char * crypt_key)
++{
++ unsigned char state[16] = {0};
++ unsigned char checksum[16] = {0};
++ unsigned char block[16];
++ unsigned int x;
++ unsigned int curpos = 0;
++
++ while(curpos + 15 < size)
++ {
++ memcpy(block, saved_key + curpos, 16);
++ mdtransform(state, checksum, block);
++ curpos += 16;
++ }
++
++ if(curpos != size)
++ {
++ x = size - curpos;
++ memcpy(block, saved_key + curpos, x);
++ memset(block + x, 16 - x, 16 - x);
++ mdtransform(state, checksum, block);
++ }
++ else
++ {
++ memset(block, 16, 16);
++ mdtransform(state, checksum, block);
++ }
++
++ mdtransform_norecalc(state, checksum);
++
++ memcpy(crypt_key, state, 16);
++}
++
++static int dominosec_valid(char *ciphertext)
++{
++ unsigned int i;
++ unsigned char ch;
++
++ if (strlen(ciphertext) != CIPHERTEXT_LENGTH)
++ return 0;
++
++ if (ciphertext[0] != '(' ||
++ ciphertext[1] != 'G' ||
++ ciphertext[CIPHERTEXT_LENGTH-1] != ')')
++ return 0;
++
++ for (i = 1; i < CIPHERTEXT_LENGTH-1; ++i) {
++ ch = ciphertext[i];
++ if (!isalnum(ch) && ch != '+' && ch != '/')
++ return 0;
++ }
++
++ return 1;
++}
++
++/*
++static unsigned int dominosec_proper_mul(int delta_apsik)
++{
++ __asm__("movl $0xAAAAAAAB, %eax \n"
++ "movl 0x8(%ebp), %edx \n"
++ "mul %edx \n"
++ "shr $0x2,%edx \n"
++ "movl %edx, %eax \n");
++}
++*/
++
++static void dominosec_decode(unsigned char *ascii_cipher, unsigned char *binary)
++{
++ unsigned int out = 0, apsik = 0, loop;
++ unsigned int i;
++ unsigned char ch;
++
++ ascii_cipher += 2;
++ i = 0;
++ do {
++ if (apsik < 8) {
++ /* should be using proper_mul, but what the heck...
++ it's nearly the same :] */
++ loop = 2; /* ~ loop = proper_mul(13 - apsik); */
++ apsik += loop*6;
++
++ do {
++ out <<= 6;
++ ch = *ascii_cipher;
++
++ if (ch < '0' || ch > '9')
++ if (ch < 'A' || ch > 'Z')
++ if (ch < 'a' || ch > 'z')
++ if (ch != '+')
++ if (ch == '/')
++ out += '?';
++ else
++ ; /* shit happens */
++ else
++ out += '>';
++ else
++ out += ch-'=';
++ else
++ out += ch-'7';
++ else
++ out += ch-'0';
++ ++ascii_cipher;
++ } while (--loop);
++ }
++
++ loop = apsik-8;
++ ch = out >> loop;
++ *(binary+i) = ch;
++ ch <<= loop;
++ apsik = loop;
++ out -= ch;
++ } while (++i < 15);
++
++ binary[3] += -4;
++}
++
++static void *dominosec_binary(char *ciphertext)
++{
++ dominosec_decode((unsigned char*)ciphertext, (unsigned char*)&cipher_binary);
++ return (void*)cipher_binary.hash;
++}
++
++static void *dominosec_salt(char *ciphertext)
++{
++ return cipher_binary.salt;
++}
++
++static void dominosec_set_salt(void *salt)
++{
++ memcpy(salt_and_digest, salt, SALT_SIZE);
++}
++
++static void dominosec_set_key(char *key, int index)
++{
++ unsigned char *offset = salt_and_digest+6;
++ unsigned int i;
++
++ saved_key_len = strlen(key);
++ strnzcpy(saved_key, key, PLAINTEXT_LENGTH);
++
++ domino_big_md((unsigned char*)key, saved_key_len, key_digest);
++
++ i = 0;
++ do {
++ memcpy(offset, *(hex_table+*(key_digest+i)), 2);
++ offset += 2;
++ } while (++i < 14);
++
++ /*
++ * Not (++i < 16) !
++ * Domino will do hash of first 34 bytes ignoring The Fact that now
++ * there is a salt at a beginning of buffer. This means that last 5
++ * bytes "EEFF)" of password digest are meaningless.
++ */
++}
++
++static char *dominosec_get_key(int index)
++{
++ return saved_key;
++}
++
++static void dominosec_crypt_all(int count)
++{
++ domino_big_md(salt_and_digest, 34, crypted_key);
++}
++
++static int dominosec_cmp_all(void *binary, int count)
++{
++ /*
++ * Only 10 bytes of digest are to be checked.
++ * 48 bits are left alone.
++ * Funny that.
++ */
++ return !memcmp(crypted_key, binary, BINARY_SIZE);
++}
++
++static int dominosec_cmp_exact(char *source, int index)
++{
++ return 1;
++}
++
++struct fmt_main fmt_DOMINOSEC = {
++ {
++ 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,
++ dominosec_tests
++ },
++ {
++ fmt_default_init,
++ dominosec_valid,
++ fmt_default_split,
++ dominosec_binary,
++ dominosec_salt,
++ {
++ fmt_default_binary_hash,
++ fmt_default_binary_hash,
++ fmt_default_binary_hash
++ },
++ fmt_default_salt_hash,
++ dominosec_set_salt,
++ dominosec_set_key,
++ dominosec_get_key,
++ fmt_default_clear_keys,
++ dominosec_crypt_all,
++ {
++ fmt_default_get_hash,
++ fmt_default_get_hash,
++ fmt_default_get_hash
++ },
++ dominosec_cmp_all,
++ dominosec_cmp_all,
++ dominosec_cmp_exact
++ }
++};
+--- john-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -44,6 +44,7 @@
+ extern struct fmt_main fmt_NETLM;
+ extern struct fmt_main fmt_NETNTLM;
+ extern struct fmt_main fmt_KRB5;
++extern struct fmt_main fmt_DOMINOSEC;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -76,6 +77,7 @@
+ john_register_one(&fmt_NETLM);
+ john_register_one(&fmt_NETNTLM);
+ john_register_one(&fmt_KRB5);
++ john_register_one(&fmt_DOMINOSEC);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -36,6 +36,7 @@
+ NETNTLM_fmt.o \
+ md4.o smbencrypt.o \
+ KRB5_fmt.o KRB5_std.o \
++ DOMINOSEC_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 \
Added: trunk/debian/patches/11-add_lotus5.patch
===================================================================
--- trunk/debian/patches/11-add_lotus5.patch (rev 0)
+++ trunk/debian/patches/11-add_lotus5.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,289 @@
+--- /dev/null
++++ john-1.7.3.1/src/lotus5_fmt.c
+@@ -0,0 +1,247 @@
++//original work by Jeff Fay
++//some optimisations by bartavelle at bandecon.com
++
++#include <stdio.h>
++#include <string.h>
++#include "misc.h"
++#include "formats.h"
++#include "common.h"
++
++/*preprocessor constants that John The Ripper likes*/
++#define FORMAT_LABEL "lotus5"
++#define FORMAT_NAME "Lotus5"
++#define ALGORITHM_NAME "Lotus v5 Proprietary"
++#define BENCHMARK_COMMENT ""
++#define BENCHMARK_LENGTH -1
++#define PLAINTEXT_LENGTH 16
++#define CIPHERTEXT_LENGTH 32
++#define BINARY_SIZE 16
++#define SALT_SIZE 0
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 1
++
++/*A struct used for JTR's benchmarks*/
++static struct fmt_tests tests[] = {
++ {"06E0A50B579AD2CD5FFDC48564627EE7", "secret"},
++ {"355E98E7C7B59BD810ED845AD0FD2FC4", "password"},
++ {"CD2D90E8E00D8A2A63A81F531EA8A9A3", "lotus"},
++ {"69D90B46B1AC0912E5CCF858094BBBFC", "dirtydog"},
++ {NULL}
++};
++
++static const char lotus_magic_table[256] = {
++ 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a,
++ 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0,
++ 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b,
++ 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a,
++ 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda,
++ 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36,
++ 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8,
++ 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c,
++ 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17,
++ 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60,
++ 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72,
++ 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa,
++ 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd,
++ 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e,
++ 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b,
++ 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf,
++ 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77,
++ 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6,
++ 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3,
++ 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3,
++ 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e,
++ 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c,
++ 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d,
++ 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2,
++ 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46,
++ 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5,
++ 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97,
++ 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5,
++ 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef,
++ 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f,
++ 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf,
++ 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab,
++};
++
++/*Some more JTR variables*/
++static char crypt_key[BINARY_SIZE+1];
++static char saved_key[PLAINTEXT_LENGTH + 1];
++
++/*Utility function to convert hex to bin */
++static void * binary (char *ciphertext)
++{
++ static char realcipher[BINARY_SIZE];
++ int i;
++ for (i = 0; i < BINARY_SIZE; i++)
++ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
++ return ((void *) realcipher);
++}
++
++/*Another function required by JTR: decides whether we have a valid
++ * ciphertext */
++static int
++valid (char *ciphertext)
++{
++ int i;
++
++ for (i = 0; i < CIPHERTEXT_LENGTH; i++)
++ if (!(((ciphertext[i] >= '0') && (ciphertext[i] <= '9'))
++ || ((ciphertext[i] >= 'a') && (ciphertext[i] <= 'f'))
++ || ((ciphertext[i] >= 'A') && (ciphertext[i] <= 'F'))))
++ {
++ return 0;
++ }
++ return 1;
++}
++
++/*sets the value of saved_key so we can play with it*/
++static void set_key (char *key, int index)
++{
++ strnzcpy (saved_key, key, PLAINTEXT_LENGTH + 1);
++}
++
++/*retrieves the saved key; used by JTR*/
++static char * get_key (int index)
++{
++ return saved_key;
++}
++static int
++cmp_all (void *binary, int index)
++{
++ int i = 0;
++ while(i<BINARY_SIZE)
++ {
++ if(((char *)binary)[i]!=((char *)crypt_key)[i])
++ return 0;
++ i++;
++ }
++ return 1;
++}
++static int cmp_exact (char *source, int index)
++{
++ return 1;
++}
++
++static void set_salt (void *salt) { }
++
++
++/*Beginning of private functions*/
++/* Takes the plaintext password and generates the second row of our
++ * working matrix for the final call to the mixing function*/
++void
++lotus_transform_password (unsigned char *inpass, unsigned char *outh)
++{
++ unsigned char prevbyte;
++ int i;
++
++ prevbyte = 0x00;
++ for (i = 0; i < 16; i++)
++ {
++ *outh = lotus_magic_table[ARCH_INDEX((*inpass) ^ prevbyte)];
++ prevbyte = *outh;
++ ++outh;
++ ++inpass;
++ }
++}
++
++/* The mixing function: perturbs the first three rows of the matrix*/
++void lotus_mix (unsigned char *lotus_matrix)
++{
++ int i, j;
++ unsigned char prevbyte;
++ unsigned char *temp;
++
++ prevbyte = 0x00;
++
++ for (i = 18; i > 0; i--)
++ {
++ temp = lotus_matrix;
++ for (j = 48; j > 0; j--)
++ {
++ *temp = *temp ^ lotus_magic_table[ARCH_INDEX((j + prevbyte) & 0xff)];
++ prevbyte = *temp;
++ temp++;
++ }
++ }
++}
++
++
++/*the last public function; generates ciphertext*/
++static void crypt_all (int count)
++{
++ unsigned char password[PLAINTEXT_LENGTH];
++ unsigned char lotus_matrix[64], *lotus_matrix1, *lotus_matrix2, *lotus_matrix3, *lotus_matrix4;
++ int i;
++ int password_length;
++
++ password_length = strlen (saved_key);
++ memset (password, (PLAINTEXT_LENGTH - password_length), PLAINTEXT_LENGTH);
++ lotus_matrix1 = lotus_matrix;
++ lotus_matrix2 = lotus_matrix1 + 16;
++ lotus_matrix3 = lotus_matrix2 + 16;
++ lotus_matrix4 = lotus_matrix3 + 16;
++ memcpy (password, saved_key, password_length);
++
++ memset (lotus_matrix1, 0, 16);
++ memcpy (lotus_matrix2, password, 16);
++ memcpy (lotus_matrix3, password, 16);
++ lotus_transform_password (lotus_matrix2, lotus_matrix4);
++ lotus_mix (lotus_matrix);
++ memcpy (lotus_matrix2, lotus_matrix4, 16);
++ for (i = 0; i < 16; i++)
++ {
++ lotus_matrix3[i] = lotus_matrix1[i] ^ lotus_matrix2[i];
++ }
++ lotus_mix (lotus_matrix);
++ memcpy (crypt_key, lotus_matrix1, BINARY_SIZE);
++}
++
++static int get_hash1(int index) { return (((unsigned int *)crypt_key)[0] & 0xf); }
++static int get_hash2(int index) { return (((unsigned int *)crypt_key)[0] & 0xff); }
++static int get_hash3(int index) { return (((unsigned int *)crypt_key)[0] & 0xfff); }
++static int binary_hash1(void * binary) { return (((unsigned int *)binary)[0] & 0xf); }
++static int binary_hash2(void * binary) { return (((unsigned int *)binary)[0] & 0xff); }
++static int binary_hash3(void * binary) { return (((unsigned int *)binary)[0] & 0xfff); }
++
++/* C's version of a class specifier */
++struct fmt_main fmt_lotus5 = {
++ {
++ FORMAT_LABEL,
++ FORMAT_NAME,
++ ALGORITHM_NAME,
++ BENCHMARK_COMMENT,
++ BENCHMARK_LENGTH,
++ PLAINTEXT_LENGTH,
++ BINARY_SIZE,
++ SALT_SIZE,
++ MIN_KEYS_PER_CRYPT,
++ MAX_KEYS_PER_CRYPT,
++ FMT_CASE | FMT_8_BIT,
++ tests
++ }, {
++ fmt_default_init,
++ valid,
++ fmt_default_split,
++ binary,
++ fmt_default_salt,
++ {
++ binary_hash1,
++ binary_hash2,
++ binary_hash3
++ },
++ fmt_default_salt_hash,
++ set_salt,
++ set_key,
++ get_key,
++ fmt_default_clear_keys,
++ crypt_all,
++ {
++ get_hash1,
++ get_hash2,
++ get_hash3
++ },
++ cmp_all,
++ cmp_all,
++ cmp_exact}
++};
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -37,6 +37,7 @@
+ md4.o smbencrypt.o \
+ KRB5_fmt.o KRB5_std.o \
+ DOMINOSEC_fmt.o \
++ lotus5_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-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -45,6 +45,7 @@
+ extern struct fmt_main fmt_NETNTLM;
+ extern struct fmt_main fmt_KRB5;
+ extern struct fmt_main fmt_DOMINOSEC;
++extern struct fmt_main fmt_lotus5;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -78,6 +79,7 @@
+ john_register_one(&fmt_NETNTLM);
+ john_register_one(&fmt_KRB5);
+ john_register_one(&fmt_DOMINOSEC);
++ john_register_one(&fmt_lotus5);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
Added: trunk/debian/patches/12-add_raw-md5.patch
===================================================================
--- trunk/debian/patches/12-add_raw-md5.patch (rev 0)
+++ trunk/debian/patches/12-add_raw-md5.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,831 @@
+--- /dev/null
++++ john-1.7.3.1/src/rawMD5go_fmt.c
+@@ -0,0 +1,208 @@
++/*
++ * Copyright (c) 2004 bartavelle
++ * bartavelle at bandecon.com
++ *
++ * Simple MD5 hashes cracker
++ * It uses the Solar Designer's md5 implementation
++ *
++ * Minor changes by David Luyer <david at luyer.net> to
++ * use a modified (faster) version of Solar Designer's
++ * md5 implementation.
++ *
++ * More improvement by
++ * Balázs Bucsay - earthquake at rycon.hu - http://www.rycon.hu/
++ * (2times faster, but it's only works up to 54characters)
++ *
++ */
++
++#include <string.h>
++
++#include "arch.h"
++#include "misc.h"
++#include "common.h"
++#include "formats.h"
++
++#if ARCH_LITTLE_ENDIAN
++#define MD5_out MD5_out_eq
++#else
++#define MD5_out MD5_bitswapped_out_eq
++#endif
++
++
++#define FORMAT_LABEL "raw-md5"
++#define FORMAT_NAME "Raw MD5"
++#define ALGORITHM_NAME "raw-md5"
++
++#define BENCHMARK_COMMENT ""
++#define BENCHMARK_LENGTH -1
++
++#define PLAINTEXT_LENGTH 32
++#define CIPHERTEXT_LENGTH 32
++
++#define BINARY_SIZE 16
++#define SALT_SIZE 0
++
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 64
++
++extern ARCH_WORD_32 MD5_out[MAX_KEYS_PER_CRYPT];
++extern char MD5_tmp[MAX_KEYS_PER_CRYPT][CIPHERTEXT_LENGTH + 1];
++
++typedef unsigned int MD5_u32plus;
++extern void MD5_Go_eq(unsigned char *data, unsigned int len, int index);
++extern void MD5_Go2_eq(unsigned char *data, unsigned int len, int index);
++
++static struct fmt_tests rawmd5_tests[] = {
++ {"5a105e8b9d40e1329780d62ea2265d8a", "test1"},
++ {"ad0234829205b9033196ba818f7a872b", "test2"},
++ {"8ad8757baa8564dc136c1e07507f4a98", "test3"},
++ {"86985e105f79b95d6bc918fb45ec7727", "test4"},
++ {"378e2c4a07968da2eca692320136433d", "thatsworking"},
++ {NULL}
++};
++
++static char saved_key[MAX_KEYS_PER_CRYPT][PLAINTEXT_LENGTH + 1 + 128 /* MD5 scratch space */];
++int saved_key_len[MAX_KEYS_PER_CRYPT];
++
++static int valid(char *ciphertext)
++{
++ int i;
++
++ if (strlen(ciphertext) != CIPHERTEXT_LENGTH) return 0;
++ for (i = 0; i < CIPHERTEXT_LENGTH; i++){
++ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) ||
++ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f')) ))
++ return 0;
++ }
++ return 1;
++}
++
++static void rawmd5_set_salt(void *salt) { }
++
++static void rawmd5_set_key(char *key, int index) {
++ strnzcpy(saved_key[index], key, PLAINTEXT_LENGTH+1);
++ saved_key_len[index] = strlen(saved_key[index]);
++}
++
++static char *rawmd5_get_key(int index) {
++ saved_key[index][saved_key_len[index]] = '\0';
++ return saved_key[index];
++}
++
++static int rawmd5_cmp_one(void *binary, int index)
++{
++ return (!(*((unsigned int*)binary) - (unsigned int)MD5_out[index]));
++}
++
++static int rawmd5_cmp_all(void *binary, int count)
++{
++ unsigned int i;
++
++ for (i = 0; i < count; i++)
++ {
++ if (!(*((unsigned int*)binary) - *((unsigned int*)&MD5_out[i]))) return 1;
++ }
++
++ return 0;
++}
++
++static int rawmd5_cmp_exact(char *source, int index)
++{
++ MD5_Go2_eq((unsigned char *)saved_key[index], saved_key_len[index], index);
++ return !memcmp(source, MD5_tmp[index], CIPHERTEXT_LENGTH);
++}
++
++static void rawmd5_crypt_all(int count)
++{
++ unsigned int i;
++
++ for (i = 0; i < count; i++)
++ {
++ MD5_Go_eq((unsigned char *)saved_key[i], saved_key_len[i], i);
++ }
++}
++
++int rawmd5_binary_hash_0(void *binary)
++{
++ return *(ARCH_WORD_32 *)binary & 0xF;
++}
++
++int rawmd5_binary_hash_1(void *binary)
++{
++ return *(ARCH_WORD_32 *)binary & 0xFF;
++}
++
++int rawmd5_binary_hash_2(void *binary)
++{
++ return *(ARCH_WORD_32 *)binary & 0xFFF;
++}
++
++int rawmd5_get_hash_0(int index)
++{
++ return MD5_out[index] & 0xF;
++}
++
++int rawmd5_get_hash_1(int index)
++{
++ return MD5_out[index] & 0xFF;
++}
++
++int rawmd5_get_hash_2(int index)
++{
++ return MD5_out[index] & 0xFFF;
++}
++
++static void *rawmd5_binary(char *ciphertext)
++{
++ static char realcipher[BINARY_SIZE];
++ int i;
++
++ for(i=0;i<BINARY_SIZE;i++)
++ {
++ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
++ }
++ return (void *)realcipher;
++}
++
++struct fmt_main fmt_rawMD5go =
++{
++ {
++ FORMAT_LABEL,
++ FORMAT_NAME,
++ ALGORITHM_NAME,
++ BENCHMARK_COMMENT,
++ BENCHMARK_LENGTH,
++ PLAINTEXT_LENGTH,
++ BINARY_SIZE,
++ SALT_SIZE,
++ MIN_KEYS_PER_CRYPT,
++ MAX_KEYS_PER_CRYPT,
++ FMT_CASE | FMT_8_BIT,
++ rawmd5_tests
++ }, {
++ fmt_default_init,
++ valid,
++ fmt_default_split,
++ rawmd5_binary,
++ fmt_default_salt,
++ {
++ rawmd5_binary_hash_0,
++ rawmd5_binary_hash_1,
++ rawmd5_binary_hash_2
++ },
++ fmt_default_salt_hash,
++ rawmd5_set_salt,
++ rawmd5_set_key,
++ rawmd5_get_key,
++ fmt_default_clear_keys,
++ rawmd5_crypt_all,
++ {
++ rawmd5_get_hash_0,
++ rawmd5_get_hash_1,
++ rawmd5_get_hash_2
++ },
++ rawmd5_cmp_all,
++ rawmd5_cmp_one,
++ rawmd5_cmp_exact
++ }
++};
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -38,6 +38,7 @@
+ KRB5_fmt.o KRB5_std.o \
+ DOMINOSEC_fmt.o \
+ lotus5_fmt.o \
++ rawMD5go_fmt.o md5_eq.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-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -46,6 +46,7 @@
+ extern struct fmt_main fmt_KRB5;
+ extern struct fmt_main fmt_DOMINOSEC;
+ extern struct fmt_main fmt_lotus5;
++extern struct fmt_main fmt_rawMD5go;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -80,6 +81,7 @@
+ john_register_one(&fmt_KRB5);
+ john_register_one(&fmt_DOMINOSEC);
+ john_register_one(&fmt_lotus5);
++ john_register_one(&fmt_rawMD5go);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
+--- /dev/null
++++ john-1.7.3.1/src/md5_eq.c
+@@ -0,0 +1,326 @@
++/*
++ * This is an OpenSSL-compatible implementation of the RSA Data Security,
++ * Inc. MD5 Message-Digest Algorithm.
++ *
++ * 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.
++ *
++ * This file has been modified by David Luyer <david at luyer.net> to introduce
++ * some performance improvements, at the cost of its general-purpose use.
++ * See the caveats documented above the MD5_Go() routine.
++ *
++ * New performance improvements by Balázs Bucsay. It's only works up to 54
++ * characters, but it is just enough.
++ * http://www.rycon.hu/ - earthquake at rycon.hu
++ *
++ */
++
++#include <string.h>
++
++#include "arch.h"
++#include "misc.h"
++#include "common.h"
++
++#define CIPHERTEXT_LENGTH 32
++#define MAX_KEYS_PER_CRYPT 64
++
++/* Output words */
++
++#define MD5_out MD5_out_eq
++#define MD5_bitswapped_out MD5_bitswapped_out_eq
++
++ARCH_WORD_32 MD5_out[MAX_KEYS_PER_CRYPT];
++char MD5_tmp[MAX_KEYS_PER_CRYPT][CIPHERTEXT_LENGTH + 1];
++ARCH_WORD_32 MD5_bitswapped_out2[4];
++#if !ARCH_LITTLE_ENDIAN
++ ARCH_WORD_32 MD5_bitswapped_out[MAX_KEYS_PER_CRYPT];
++#endif
++
++/* Bit-swapped output words */
++
++#if !defined(_MD5_GO_H)
++#define _MD5_GO_H
++
++/* Any 32-bit or wider unsigned integer data type will do */
++typedef unsigned int MD5_u32plus;
++
++#endif
++
++
++/*
++ * The basic MD5 functions.
++ *
++ * F and G are optimized compared to their RFC 1321 definitions for
++ * architectures that lack an AND-NOT instruction, just like in Colin Plumb's
++ * implementation.
++ */
++#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
++#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y))))
++#define H(x, y, z) ((x) ^ (y) ^ (z))
++#define I(x, y, z) ((y) ^ ((x) | ~(z)))
++
++/*
++ * The MD5 transformation for all four rounds.
++ */
++#define STEP(f, a, b, c, d, x, t, s) \
++ (a) += f((b), (c), (d)) + (x) + (t); \
++ (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
++ (a) += (b);
++
++/*
++ * SET reads 4 input bytes in little-endian byte order and stores them
++ * in a properly aligned word in host byte order.
++ *
++ * The check for little-endian architectures 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) \
++ (*(MD5_u32plus *)&ptr[(n) * 4])
++#define GET(n) \
++ SET(n)
++#else
++static MD5_u32plus work[16];
++#define SET(n) \
++ (work[(n)] = \
++ (MD5_u32plus)ptr[(n) * 4] | \
++ ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \
++ ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \
++ ((MD5_u32plus)ptr[(n) * 4 + 3] << 24))
++#define GET(n) \
++ (work[(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 body2_eq(void *data, int index)
++{
++ unsigned char *ptr;
++ MD5_u32plus a, b, c, d;
++
++ ptr = data;
++
++ a = 0x67452301;
++ b = 0xefcdab89;
++ c = 0x98badcfe;
++ d = 0x10325476;
++
++/* Round 1 */
++ STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
++ STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
++ STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
++ STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
++ STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
++ STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
++ STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
++ STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
++ STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
++ STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
++ STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
++ STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
++ STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
++ STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
++ STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
++ STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
++
++/* Round 2 */
++ STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
++ STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
++ STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
++ STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
++ STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
++ STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
++ STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
++ STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
++ STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
++ STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
++ STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
++ STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
++ STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
++ STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
++ STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
++ STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
++
++/* Round 3 */
++ STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
++ STEP(H, d, a, b, c, GET(8), 0x8771f681, 11)
++ STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
++ STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23)
++ STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
++ STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11)
++ STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
++ STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23)
++ STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
++ STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11)
++ STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
++ STEP(H, b, c, d, a, GET(6), 0x04881d05, 23)
++ STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
++ STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11)
++ STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
++ STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23)
++
++/* Round 4 */
++ STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
++ STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
++ STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
++ STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
++ STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
++ STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
++ STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
++ STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
++ STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
++ STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
++ STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
++ STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
++ STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
++ STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
++ STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
++ STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
++
++ a += 0x67452301;
++ b += 0xefcdab89;
++ c += 0x98badcfe;
++ d += 0x10325476;
++
++ MD5_bitswapped_out2[0] = (a << 24) |
++ (a >> 24) |
++ ((a << 8) & 0x00ff0000) |
++ ((a >> 8) & 0x0000ff00);
++ MD5_bitswapped_out2[1] = (b << 24) |
++ (b >> 24) |
++ ((b << 8) & 0x00ff0000) |
++ ((b >> 8) & 0x0000ff00);
++ MD5_bitswapped_out2[2] = (c << 24) |
++ (c >> 24) |
++ ((c << 8) & 0x00ff0000) |
++ ((c >> 8) & 0x0000ff00);
++ MD5_bitswapped_out2[3] = (d << 24) |
++ (d >> 24) |
++ ((d << 8) & 0x00ff0000) |
++ ((d >> 8) & 0x0000ff00);
++
++ sprintf(MD5_tmp[index], "%08x%08x%08x%08x", (unsigned int)MD5_bitswapped_out2[0], (unsigned int)MD5_bitswapped_out2[1], (unsigned int)MD5_bitswapped_out2[2], (unsigned int)MD5_bitswapped_out2[3]);
++}
++
++static void body_eq(void *data, int index)
++{
++ unsigned char *ptr;
++ MD5_u32plus a, b, c, d;
++
++ ptr = data;
++
++ a = 0x67452301;
++ b = 0xefcdab89;
++ c = 0x98badcfe;
++ d = 0x10325476;
++
++/* Round 1 */
++ STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
++ STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
++ STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
++ STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
++ STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
++ STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
++ STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
++ STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
++ STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
++ STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
++ STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
++ STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
++ STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
++ STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
++ STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
++ STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
++
++/* Round 2 */
++ STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
++ STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
++ STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
++ STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
++ STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
++ STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
++ STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
++ STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
++ STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
++ STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
++ STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
++ STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
++ STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
++ STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
++ STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
++ STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
++
++/* Round 3 */
++ STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
++ STEP(H, d, a, b, c, GET(8), 0x8771f681, 11)
++ STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
++ STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23)
++ STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
++ STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11)
++ STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
++ STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23)
++ STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
++ STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11)
++ STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
++ STEP(H, b, c, d, a, GET(6), 0x04881d05, 23)
++ STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
++ STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11)
++ STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
++ STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23)
++
++/* Round 4 */
++ STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
++ STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
++ STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
++ STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
++ STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
++ STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
++ STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
++ STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
++ STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
++ STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
++ STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
++ STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
++ STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
++
++ MD5_out[index] = a + 0x67452301;
++
++}
++
++
++void MD5_Go_eq(unsigned char *data, unsigned int len, int index)
++{
++ data[len] = 0x80;
++ memset(&data[len+1], 0, 63 - len);
++ data[56] = len << 3;
++ data[57] = len >> 5;
++ body_eq(data, index);
++
++#if !ARCH_LITTLE_ENDIAN
++ MD5_bitswapped_out[index] = (MD5_out[index] << 24) |
++ (MD5_out[index] >> 24) |
++ ((MD5_out[index] << 8) & 0x00ff0000) |
++ ((MD5_out[index] >> 8) & 0x0000ff00);
++#endif
++}
++
++void MD5_Go2_eq(unsigned char *data, unsigned int len, int index)
++{
++ data[len] = 0x80;
++ memset(&data[len+1], 0, 63 - len);
++ data[56] = len << 3;
++ data[57] = len >> 5;
++ body2_eq(data, index);
++}
+--- /dev/null
++++ john-1.7.3.1/src/md5_go.c
+@@ -0,0 +1,230 @@
++/*
++ * This is an OpenSSL-compatible implementation of the RSA Data Security,
++ * Inc. MD5 Message-Digest Algorithm (RFC 1321).
++ *
++ * 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.
++ *
++ * This file has been modified by David Luyer <david at luyer.net> to
++ * introduce some performance improvements, at the cost of its
++ * general-purpose use.
++ * See the caveats documented above the MD5_Go() routine.
++ */
++
++#include <string.h>
++
++#include "arch.h"
++#include "common.h"
++#include "md5_go.h"
++
++#define MD5_out MD5_out_go
++#define MD5_bitswapped_out MD5_bitswapped_out_go
++
++/* Output words */
++ARCH_WORD_32 MD5_out[4];
++
++#if !ARCH_LITTLE_ENDIAN
++/* Bit-swapped output words */
++ARCH_WORD_32 MD5_bitswapped_out[4];
++#endif
++
++/*
++ * The basic MD5 functions.
++ *
++ * F and G are optimized compared to their RFC 1321 definitions for
++ * architectures that lack an AND-NOT instruction, just like in Colin Plumb's
++ * implementation.
++ */
++#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
++#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y))))
++#define H(x, y, z) ((x) ^ (y) ^ (z))
++#define I(x, y, z) ((y) ^ ((x) | ~(z)))
++
++/*
++ * The MD5 transformation for all four rounds.
++ */
++#define STEP(f, a, b, c, d, x, t, s) \
++ (a) += f((b), (c), (d)) + (x) + (t); \
++ (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
++ (a) += (b);
++
++/*
++ * SET reads 4 input bytes in little-endian byte order and stores them
++ * in a properly aligned word in host byte order.
++ *
++ * The check for little-endian architectures 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) \
++ (*(MD5_u32plus *)&ptr[(n) * 4])
++#define GET(n) \
++ SET(n)
++#else
++static MD5_u32plus work[16];
++#define SET(n) \
++ (work[(n)] = \
++ (MD5_u32plus)ptr[(n) * 4] | \
++ ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \
++ ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \
++ ((MD5_u32plus)ptr[(n) * 4 + 3] << 24))
++#define GET(n) \
++ (work[(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(void *data, unsigned int size)
++{
++ unsigned char *ptr;
++ MD5_u32plus a, b, c, d;
++ MD5_u32plus saved_a, saved_b, saved_c, saved_d;
++
++ ptr = data;
++
++ a = 0x67452301;
++ b = 0xefcdab89;
++ c = 0x98badcfe;
++ d = 0x10325476;
++
++ do {
++ saved_a = a;
++ saved_b = b;
++ saved_c = c;
++ saved_d = d;
++
++/* Round 1 */
++ STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
++ STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
++ STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
++ STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
++ STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
++ STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
++ STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
++ STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
++ STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
++ STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
++ STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
++ STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
++ STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
++ STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
++ STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
++ STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
++
++/* Round 2 */
++ STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
++ STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
++ STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
++ STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
++ STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
++ STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
++ STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
++ STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
++ STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
++ STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
++ STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
++ STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
++ STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
++ STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
++ STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
++ STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
++
++/* Round 3 */
++ STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
++ STEP(H, d, a, b, c, GET(8), 0x8771f681, 11)
++ STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
++ STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23)
++ STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
++ STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11)
++ STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
++ STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23)
++ STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
++ STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11)
++ STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
++ STEP(H, b, c, d, a, GET(6), 0x04881d05, 23)
++ STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
++ STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11)
++ STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
++ STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23)
++
++/* Round 4 */
++ STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
++ STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
++ STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
++ STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
++ STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
++ STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
++ STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
++ STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
++ STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
++ STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
++ STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
++ STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
++ STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
++ STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
++ STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
++ STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
++
++ a += saved_a;
++ b += saved_b;
++ c += saved_c;
++ d += saved_d;
++
++ ptr += 64;
++ } while (size -= 64);
++
++ MD5_out[0] = a;
++ MD5_out[1] = b;
++ MD5_out[2] = c;
++ MD5_out[3] = d;
++}
++
++/* Single-pass MD5 of a string of up to 2^11 bytes
++ *
++ * Caveats:
++ * - String length limited to 2^11 bytes (can be easily increased
++ * by adding data[process-6] = len >> 13 etc).
++ * - Requires scratch space at the end of the string (up to 73 bytes).
++ * - String will need re-terminating after calling this rountine.
++ */
++void MD5_Go(unsigned char *data, unsigned int len)
++{
++ unsigned int process = (len + 73) & ~0x3f;
++
++ data[len] = 0x80;
++ memset(&data[len+1], 0, process - len - 1);
++ data[process-8] = len << 3;
++ data[process-7] = len >> 5;
++ body(data, process);
++
++#if !ARCH_LITTLE_ENDIAN
++ MD5_bitswapped_out[0] = (MD5_out[0] << 24) |
++ (MD5_out[0] >> 24) |
++ ((MD5_out[0] << 8) & 0x00ff0000) |
++ ((MD5_out[0] >> 8) & 0x0000ff00);
++ MD5_bitswapped_out[1] = (MD5_out[1] << 24) |
++ (MD5_out[1] >> 24) |
++ ((MD5_out[1] << 8) & 0x00ff0000) |
++ ((MD5_out[1] >> 8) & 0x0000ff00);
++ MD5_bitswapped_out[2] = (MD5_out[2] << 24) |
++ (MD5_out[2] >> 24) |
++ ((MD5_out[2] << 8) & 0x00ff0000) |
++ ((MD5_out[2] >> 8) & 0x0000ff00);
++ MD5_bitswapped_out[3] = (MD5_out[3] << 24) |
++ (MD5_out[3] >> 24) |
++ ((MD5_out[3] << 8) & 0x00ff0000) |
++ ((MD5_out[3] >> 8) & 0x0000ff00);
++#endif
++}
+--- /dev/null
++++ john-1.7.3.1/src/md5_go.h
+@@ -0,0 +1,16 @@
++/*
++ * This is an OpenSSL-compatible implementation of the RSA Data Security,
++ * Inc. MD5 Message-Digest Algorithm.
++ *
++ * Written by Solar Designer <solar at openwall.com> in 2001, placed in
++ * the public domain, and hacked by others.
++ */
++
++#if !defined(_MD5_GO_H)
++#define _MD5_GO_H
++
++/* Any 32-bit or wider unsigned integer data type will do */
++typedef unsigned int MD5_u32plus;
++extern void MD5_Go(unsigned char *data, unsigned int len/*, unsigned char *result*/);
++
++#endif
Added: trunk/debian/patches/13-add_raw-sha1.patch
===================================================================
--- trunk/debian/patches/13-add_raw-sha1.patch (rev 0)
+++ trunk/debian/patches/13-add_raw-sha1.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,326 @@
+--- /dev/null
++++ john-1.7.3.1/src/rawSHA1_fmt.c
+@@ -0,0 +1,269 @@
++/*
++ * Copyright (c) 2004 bartavelle
++ * bartavelle at bandecon.com
++ *
++ * Simple MD5 hashes cracker
++ * It uses the Solar Designer's md5 implementation
++ *
++ */
++
++#include <string.h>
++
++#include "arch.h"
++#include "misc.h"
++#include "common.h"
++#include "formats.h"
++#include "sha.h"
++
++#define FORMAT_LABEL "raw-sha1"
++#define FORMAT_NAME "Raw SHA-1"
++#ifdef MMX_COEF
++#if (MMX_COEF == 2)
++#define ALGORITHM_NAME "raw-sha1 MMX"
++#else
++#define ALGORITHM_NAME "raw-sha1 SSE2"
++#endif
++#else
++#define ALGORITHM_NAME "raw-sha1"
++#endif
++
++#ifdef MMX_TYPE
++#define BENCHMARK_COMMENT MMX_TYPE
++#else
++#define BENCHMARK_COMMENT ""
++#endif
++#define BENCHMARK_LENGTH -1
++
++#define PLAINTEXT_LENGTH 32
++#define CIPHERTEXT_LENGTH 40
++
++#define BINARY_SIZE 20
++#define SALT_SIZE 0
++
++#ifdef MMX_COEF
++#define MIN_KEYS_PER_CRYPT MMX_COEF
++#define MAX_KEYS_PER_CRYPT MMX_COEF
++//#define GETPOS(i, index) ( (index)*4 + ((i)& (0xffffffff-3) )*MMX_COEF + ((i)&3) ) //std getpos
++#define GETPOS(i, index) ( (index)*4 + ((i)& (0xffffffff-3) )*MMX_COEF + (3-((i)&3)) ) //for endianity conversion
++#else
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 1
++#endif
++
++static struct fmt_tests rawsha1_tests[] = {
++ {"A9993E364706816ABA3E25717850C26C9CD0D89D", "abc"},
++ {"2fbf0eba37de1d1d633bc1ed943b907f9b360d4c", "azertyuiop1"},
++ {"f879f8090e92232ed07092ebed6dc6170457a21d", "azertyuiop2"},
++ {"1813c12f25e64931f3833b26e999e26e81f9ad24", "azertyuiop3"},
++ {NULL}
++};
++
++#ifdef MMX_COEF
++/* Cygwin would not guarantee the alignment if these were declared static */
++#define rawSHA1_saved_key saved_key
++#define rawSHA1_crypt_key crypt_key
++char saved_key[80*4*MMX_COEF] __attribute__ ((aligned(16)));
++char crypt_key[BINARY_SIZE*MMX_COEF] __attribute__ ((aligned(16)));
++static unsigned long total_len;
++static unsigned char out[PLAINTEXT_LENGTH + 1];
++#else
++static char saved_key[PLAINTEXT_LENGTH + 1];
++static ARCH_WORD_32 crypt_key[BINARY_SIZE / 4];
++static SHA_CTX ctx;
++#endif
++
++static int valid(char *ciphertext)
++{
++ int i;
++
++ if (strlen(ciphertext) != CIPHERTEXT_LENGTH) return 0;
++ for (i = 0; i < CIPHERTEXT_LENGTH; i++){
++ if (!( (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) ||
++ (('a' <= ciphertext[i])&&(ciphertext[i] <= 'f'))
++ || (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F'))))
++ return 0;
++ }
++ return 1;
++}
++
++static void rawsha1_set_salt(void *salt) { }
++
++static void rawsha1_init(void)
++{
++#ifdef MMX_COEF
++ memset(saved_key, 0, sizeof(saved_key));
++#endif
++}
++
++static void rawsha1_set_key(char *key, int index) {
++#ifdef MMX_COEF
++ int len;
++ int i;
++
++ if(index==0)
++ {
++ total_len = 0;
++ memset(saved_key, 0, sizeof(saved_key));
++ }
++ len = strlen(key);
++ if(len>PLAINTEXT_LENGTH)
++ len = PLAINTEXT_LENGTH;
++
++ total_len += len << ( ( (32/MMX_COEF) * index ) );
++ for(i=0;i<len;i++)
++ saved_key[GETPOS(i, index)] = key[i];
++
++ saved_key[GETPOS(i, index)] = 0x80;
++#else
++ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1);
++#endif
++}
++
++static char *rawsha1_get_key(int index) {
++#ifdef MMX_COEF
++ unsigned int i,s;
++
++ s = (total_len >> (((32/MMX_COEF)*(index)))) & 0xff;
++ for(i=0;i<s;i++)
++ out[i] = saved_key[ GETPOS(i, index) ];
++ out[i] = 0;
++ return (char *) out;
++#else
++ return saved_key;
++#endif
++}
++
++static int rawsha1_cmp_all(void *binary, int count) {
++#ifdef MMX_COEF
++ int i=0;
++ while(i< (BINARY_SIZE/4) )
++ {
++ if (
++ ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF])
++ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+1])
++#if (MMX_COEF > 3)
++ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+2])
++ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+3])
++#endif
++ )
++ return 0;
++ i++;
++ }
++ return 1;
++#else
++ return !memcmp(binary, crypt_key, BINARY_SIZE);
++#endif
++}
++
++static int rawsha1_cmp_exact(char *source, int count){
++ return (1);
++}
++
++static int rawsha1_cmp_one(void * binary, int index)
++{
++#ifdef MMX_COEF
++ int i = 0;
++ for(i=0;i<(BINARY_SIZE/4);i++)
++ if ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+index] )
++ return 0;
++ return 1;
++#else
++ return rawsha1_cmp_all(binary, index);
++#endif
++}
++
++static void rawsha1_crypt_all(int count) {
++ // get plaintext input in saved_key put it into ciphertext crypt_key
++#ifdef MMX_COEF
++ shammx((unsigned char *) crypt_key, (unsigned char *) saved_key, total_len);
++#else
++ SHA1_Init( &ctx );
++ SHA1_Update( &ctx, (unsigned char *) saved_key, strlen( saved_key ) );
++ SHA1_Final( (unsigned char *) crypt_key, &ctx);
++#endif
++
++}
++
++static void * rawsha1_binary(char *ciphertext)
++{
++ static char realcipher[BINARY_SIZE];
++ int i;
++
++ for(i=0;i<BINARY_SIZE;i++)
++ {
++ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
++ }
++ return (void *)realcipher;
++}
++
++static int binary_hash_0(void *binary)
++{
++ return ((ARCH_WORD_32 *)binary)[0] & 0xF;
++}
++
++static int binary_hash_1(void *binary)
++{
++ return ((ARCH_WORD_32 *)binary)[0] & 0xFF;
++}
++
++static int binary_hash_2(void *binary)
++{
++ return ((ARCH_WORD_32 *)binary)[0] & 0xFFF;
++}
++
++static int get_hash_0(int index)
++{
++ return ((ARCH_WORD_32 *)crypt_key)[index] & 0xF;
++}
++
++static int get_hash_1(int index)
++{
++ return ((ARCH_WORD_32 *)crypt_key)[index] & 0xFF;
++}
++
++static int get_hash_2(int index)
++{
++ return ((ARCH_WORD_32 *)crypt_key)[index] & 0xFFF;
++}
++
++struct fmt_main fmt_rawSHA1 = {
++ {
++ FORMAT_LABEL,
++ FORMAT_NAME,
++ ALGORITHM_NAME,
++ BENCHMARK_COMMENT,
++ BENCHMARK_LENGTH,
++ PLAINTEXT_LENGTH,
++ BINARY_SIZE,
++ SALT_SIZE,
++ MIN_KEYS_PER_CRYPT,
++ MAX_KEYS_PER_CRYPT,
++ FMT_CASE | FMT_8_BIT,
++ rawsha1_tests
++ }, {
++ rawsha1_init,
++ valid,
++ fmt_default_split,
++ rawsha1_binary,
++ fmt_default_salt,
++ {
++ binary_hash_0,
++ binary_hash_1,
++ binary_hash_2
++ },
++ fmt_default_salt_hash,
++ rawsha1_set_salt,
++ rawsha1_set_key,
++ rawsha1_get_key,
++ fmt_default_clear_keys,
++ rawsha1_crypt_all,
++ {
++ get_hash_0,
++ get_hash_1,
++ get_hash_2
++ },
++ rawsha1_cmp_all,
++ rawsha1_cmp_one,
++ rawsha1_cmp_exact
++ }
++};
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -39,6 +39,7 @@
+ DOMINOSEC_fmt.o \
+ lotus5_fmt.o \
+ rawMD5go_fmt.o md5_eq.o \
++ rawSHA1_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-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -47,6 +47,7 @@
+ extern struct fmt_main fmt_DOMINOSEC;
+ extern struct fmt_main fmt_lotus5;
+ extern struct fmt_main fmt_rawMD5go;
++extern struct fmt_main fmt_rawSHA1;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -82,6 +83,7 @@
+ john_register_one(&fmt_DOMINOSEC);
+ john_register_one(&fmt_lotus5);
+ john_register_one(&fmt_rawMD5go);
++ john_register_one(&fmt_rawSHA1);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
+--- /dev/null
++++ john-1.7.3.1/src/sha.h
+@@ -0,0 +1,12 @@
++#ifndef JOHN_SHA_H
++#define JOHN_SHA_H
++
++#include <openssl/sha.h>
++
++#ifdef MMX_COEF
++extern int shammx(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3)));
++extern int shammx_nosizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3)));
++extern int shammx_noinit_uniformsizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3)));
++#endif
++
++#endif
Added: trunk/debian/patches/14-add_IPB2.patch
===================================================================
--- trunk/debian/patches/14-add_IPB2.patch (rev 0)
+++ trunk/debian/patches/14-add_IPB2.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,335 @@
+--- /dev/null
++++ john-1.7.3.1/src/IPB2_fmt.c
+@@ -0,0 +1,252 @@
++/*
++ * IPB2_fmt.c (version 4)
++ *
++ * Invision Power Board 2.x salted MD5 module for Solar Designer's JtR
++ * Uses Solar Designer's MD5 implementation.
++ * regenrecht at o2.pl, Jan 2006
++ *
++ * Hashes list should have form of username:$IPB2$salt$hash
++ * Values to be taken from IPB database, where:
++ * salt = bin2hex(ibf_members_converge.converge_pass_salt)
++ * hash = ibf_members_converge.converge_pass_hash
++ */
++
++#include <string.h>
++
++#include "arch.h"
++#include "misc.h"
++#include "md5.h"
++#include "common.h"
++#include "formats.h"
++
++#define FORMAT_LABEL "ipb2"
++#define FORMAT_NAME "IPB2 MD5"
++#define ALGORITHM_NAME "Invision Power Board 2.x salted MD5"
++
++#define BENCHMARK_COMMENT ""
++#define BENCHMARK_LENGTH 0
++
++#define MD5_BINARY_SIZE 16
++#define MD5_HEX_SIZE (MD5_BINARY_SIZE * 2)
++
++#define BINARY_SIZE MD5_BINARY_SIZE
++
++#define SALT_SIZE 5
++#define PROCESSED_SALT_SIZE MD5_HEX_SIZE
++
++#define PLAINTEXT_LENGTH 32
++#define CIPHERTEXT_LENGTH (1 + 4 + 1 + SALT_SIZE * 2 + 1 + MD5_HEX_SIZE)
++
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 1
++
++static struct fmt_tests ipb2_tests[] = {
++ {"$IPB2$2e75504633$d891f03a7327639bc632d62a7f302604", "welcome"},
++ {"$IPB2$735a213a4e$4f23de7bb115139660db5e953153f28a", "enter"},
++ {"$IPB2$5d75343455$de98ba8ca7bb16f43af05e9e4fb8afee", "matrix"},
++ {"$IPB2$556c576c39$16d4f29c71b05bd75e61d0254800bfa3", "123456"},
++ {NULL}
++};
++
++static char itoa16_shr_04[] =
++ "0000000000000000"
++ "1111111111111111"
++ "2222222222222222"
++ "3333333333333333"
++ "4444444444444444"
++ "5555555555555555"
++ "6666666666666666"
++ "7777777777777777"
++ "8888888888888888"
++ "9999999999999999"
++ "aaaaaaaaaaaaaaaa"
++ "bbbbbbbbbbbbbbbb"
++ "cccccccccccccccc"
++ "dddddddddddddddd"
++ "eeeeeeeeeeeeeeee"
++ "ffffffffffffffff";
++
++static char itoa16_and_0f[] =
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef"
++ "0123456789abcdef";
++
++static MD5_CTX ctx;
++static char saved_key[PLAINTEXT_LENGTH + 1];
++static int saved_key_len;
++static char workspace[MD5_HEX_SIZE * 2];
++static char output[MD5_BINARY_SIZE];
++
++static int ipb2_valid(char *ciphertext)
++{
++ if (strlen(ciphertext) != CIPHERTEXT_LENGTH)
++ return 0;
++
++ if (strncmp(ciphertext, "$IPB2$", 6) != 0)
++ return 0;
++
++ if (ciphertext[16] != '$')
++ return 0;
++
++ if (strspn(ciphertext+6, itoa16) != SALT_SIZE*2)
++ return 0;
++
++ if (strspn(ciphertext+17, itoa16) != MD5_HEX_SIZE)
++ return 0;
++
++ return 1;
++}
++
++static void *ipb2_binary(char *ciphertext)
++{
++ static unsigned char binary_cipher[BINARY_SIZE];
++ int i;
++
++ ciphertext += 17;
++ for (i = 0; i < MD5_HEX_SIZE; ++i)
++ binary_cipher[i] =
++ (atoi16[ARCH_INDEX(ciphertext[i*2])] << 4)
++ + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
++
++ return (void *)binary_cipher;
++}
++
++static void *ipb2_salt(char *ciphertext)
++{
++ static unsigned char binary_salt[SALT_SIZE];
++ static unsigned char salt_hash[MD5_BINARY_SIZE];
++ static unsigned char hex_salt[MD5_HEX_SIZE];
++ int i;
++
++ ciphertext += 6;
++ for (i = 0; i < SALT_SIZE; ++i)
++ binary_salt[i] =
++ (atoi16[ARCH_INDEX(ciphertext[i*2])] << 4)
++ + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
++
++ MD5_Init(&ctx);
++ MD5_Update(&ctx, binary_salt, SALT_SIZE);
++ MD5_Final(salt_hash, &ctx);
++
++ for (i = 0; i < MD5_BINARY_SIZE; ++i) {
++ hex_salt[i*2] = itoa16[ARCH_INDEX(salt_hash[i] >> 4)];
++ hex_salt[i*2+1] = itoa16[ARCH_INDEX(salt_hash[i] & 0x0f)];
++ }
++
++ return (void*)hex_salt;
++}
++
++static void ipb2_set_salt(void *salt)
++{
++ memcpy((char*)workspace, (char*)salt, PROCESSED_SALT_SIZE);
++}
++
++static int strnfcpy_count(char *dst, char *src, int size)
++{
++ char *dptr = dst, *sptr = src;
++ int count = size;
++
++ while (count--)
++ if (!(*dptr++ = *sptr++)) break;
++
++ return size-count-1;
++}
++
++static void ipb2_set_key(char *key, int index)
++{
++ static unsigned char key_hash[MD5_BINARY_SIZE];
++ unsigned char *kh = key_hash;
++ unsigned char *workspace_ptr = (unsigned char *) (workspace + PROCESSED_SALT_SIZE);
++ unsigned char v;
++ int i;
++
++ saved_key_len = strnfcpy_count(saved_key, key, PLAINTEXT_LENGTH);
++
++ MD5_Init(&ctx);
++ MD5_Update(&ctx, saved_key, saved_key_len);
++ MD5_Final(key_hash, &ctx);
++
++ for (i = 0; i < MD5_BINARY_SIZE; ++i) {
++ v = *kh++;
++ *workspace_ptr++ = itoa16_shr_04[ARCH_INDEX(v)];
++ *workspace_ptr++ = itoa16_and_0f[ARCH_INDEX(v)];
++ }
++}
++
++static char *ipb2_get_key(int index)
++{
++ return saved_key;
++}
++
++static void ipb2_crypt_all(int count)
++{
++ MD5_Init(&ctx);
++ MD5_Update(&ctx, workspace, MD5_HEX_SIZE * 2);
++ MD5_Final((unsigned char *) output, &ctx);
++}
++
++static int ipb2_cmp_all(void *binary, int index)
++{
++ return !memcmp(binary, output, MD5_BINARY_SIZE);
++}
++
++static int ipb2_cmp_exact(char *source, int index)
++{
++ return 1;
++}
++
++struct fmt_main fmt_IPB2 = {
++ {
++ FORMAT_LABEL,
++ FORMAT_NAME,
++ ALGORITHM_NAME,
++ BENCHMARK_COMMENT,
++ BENCHMARK_LENGTH,
++ PLAINTEXT_LENGTH,
++ BINARY_SIZE,
++ PROCESSED_SALT_SIZE,
++ MIN_KEYS_PER_CRYPT,
++ MAX_KEYS_PER_CRYPT,
++ FMT_CASE | FMT_8_BIT,
++ ipb2_tests
++ },
++ {
++ fmt_default_init,
++ ipb2_valid,
++ fmt_default_split,
++ ipb2_binary,
++ ipb2_salt,
++ {
++ fmt_default_binary_hash,
++ fmt_default_binary_hash,
++ fmt_default_binary_hash
++ },
++ fmt_default_salt_hash,
++ ipb2_set_salt,
++ ipb2_set_key,
++ ipb2_get_key,
++ fmt_default_clear_keys,
++ ipb2_crypt_all,
++ {
++ fmt_default_get_hash,
++ fmt_default_get_hash,
++ fmt_default_get_hash
++ },
++ ipb2_cmp_all,
++ ipb2_cmp_all,
++ ipb2_cmp_exact
++ }
++};
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -40,6 +40,7 @@
+ lotus5_fmt.o \
+ rawMD5go_fmt.o md5_eq.o \
+ rawSHA1_fmt.o \
++ IPB2_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-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -48,6 +48,7 @@
+ extern struct fmt_main fmt_lotus5;
+ extern struct fmt_main fmt_rawMD5go;
+ extern struct fmt_main fmt_rawSHA1;
++extern struct fmt_main fmt_IPB2;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -84,6 +85,7 @@
+ john_register_one(&fmt_lotus5);
+ john_register_one(&fmt_rawMD5go);
+ john_register_one(&fmt_rawSHA1);
++ john_register_one(&fmt_IPB2);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1/IPB2\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
+--- /dev/null
++++ john-1.7.3.1/src/md5.h
+@@ -0,0 +1,38 @@
++/*
++ * This is an OpenSSL-compatible implementation of the RSA Data Security,
++ * Inc. MD5 Message-Digest Algorithm (RFC 1321).
++ *
++ * Written by Solar Designer <solar at openwall.com> in 2001, and placed
++ * in the public domain. There's absolutely no warranty.
++ *
++ * See md5.c for more information.
++ */
++
++#ifdef HAVE_OPENSSL
++#include <openssl/md5.h>
++#elif !defined(_MD5_H)
++#define _MD5_H
++
++/* Any 32-bit or wider unsigned integer data type will do */
++typedef unsigned int MD5_u32plus;
++
++typedef struct {
++ MD5_u32plus lo, hi;
++ MD5_u32plus a, b, c, d;
++ unsigned char buffer[64];
++ MD5_u32plus block[16];
++} MD5_CTX;
++
++extern void MD5_Init(MD5_CTX *ctx);
++extern void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size);
++extern void MD5_PreFinal(MD5_CTX *ctx);
++extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
++
++#ifdef MMX_COEF
++extern int mdfivemmx(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3)));
++extern int mdfivemmx_nosizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3)));
++extern int mdfivemmx_noinit_sizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3)));
++extern int mdfivemmx_noinit_uniformsizeupdate(unsigned char *out, unsigned char *in, int n) __attribute__((regparm(3)));
++#endif
++
++#endif
Added: trunk/debian/patches/15-add_MD5_apache.patch
===================================================================
--- trunk/debian/patches/15-add_MD5_apache.patch (rev 0)
+++ trunk/debian/patches/15-add_MD5_apache.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,443 @@
+--- /dev/null
++++ john-1.7.3.1/src/MD5_apache_fmt.c
+@@ -0,0 +1,198 @@
++/*
++ Modified by Sun-Zero <sun-zero at freemail.hu>
++ 2004. 07. 26.
++
++ Now, its work with md5 hash of apache.
++ The original john patch came from
++ http://lists.jammed.com/pen-test/2001/11/0134.html by
++ Kostas Evangelinos (kos at bastard.net)
++*/
++
++/*
++ * This file is part of John the Ripper password cracker,
++ * Copyright (c) 1996-2001 by Solar Designer
++ */
++
++#include <string.h>
++
++#include "arch.h"
++#include "misc.h"
++#include "MD5_std.h"
++#include "common.h"
++#include "formats.h"
++
++#define FORMAT_LABEL "md5a"
++#define FORMAT_NAME "Apache MD5"
++
++#define BENCHMARK_COMMENT ""
++#define BENCHMARK_LENGTH -1
++
++#define PLAINTEXT_LENGTH 15
++#define CIPHERTEXT_LENGTH 22
++
++#define BINARY_SIZE 4
++#define SALT_SIZE 8
++
++#define MIN_KEYS_PER_CRYPT MD5_N
++#define MAX_KEYS_PER_CRYPT MD5_N
++
++
++static struct fmt_tests tests[] = {
++ {"$apr1$Q6ZYh...$RV6ft2bZ8j.NGrxLYaJt9.", "test"},
++ {"$apr1$rBXqc...$NlXxN9myBOk95T0AyLAsJ0", "john"},
++ {"$apr1$Grpld/..$qp5GyjwM2dnA5Cdej9b411", "the"},
++ {"$apr1$GBx.D/..$yfVeeYFCIiEXInfRhBRpy/", "ripper"},
++ {NULL}
++};
++
++static char saved_key[MD5_N][PLAINTEXT_LENGTH + 1];
++
++static int valid(char *ciphertext)
++{
++ char *pos, *start;
++
++ if (strncmp(ciphertext, "$apr1$", 6)) return 0;
++
++ /* magic string */
++ start = &ciphertext[1];
++ for (pos = start; *pos && *pos != '$'; pos++);
++ if (!*pos || pos < start+1 || pos > start+MD5_MAGIC_LENGTH+1)
++ return 0;
++
++ /* salt */
++ start = ++pos;
++ for (pos = start; *pos && *pos != '$'; pos++);
++ if (!*pos || pos < start || pos > start+8)
++ return 0;
++
++
++ start = ++pos;
++ while (atoi64[ARCH_INDEX(*pos)] != 0x7F) pos++;
++ if (*pos || pos - start != CIPHERTEXT_LENGTH) return 0;
++
++ if (atoi64[ARCH_INDEX(*(pos - 1))] & 0x3C) return 0;
++
++ return 1;
++}
++
++static int binary_hash_0(void *binary)
++{
++ return *(MD5_word *)binary & 0xF;
++}
++
++static int binary_hash_1(void *binary)
++{
++ return *(MD5_word *)binary & 0xFF;
++}
++
++static int binary_hash_2(void *binary)
++{
++ return *(MD5_word *)binary & 0xFFF;
++}
++
++static int get_hash_0(int index)
++{
++ return MD5_out[index][0] & 0xF;
++}
++
++static int get_hash_1(int index)
++{
++ return MD5_out[index][0] & 0xFF;
++}
++
++static int get_hash_2(int index)
++{
++ return MD5_out[index][0] & 0xFFF;
++}
++
++static int salt_hash(void *salt)
++{
++ return
++ ((int)atoi64[ARCH_INDEX(((char *)salt)[0])] |
++ ((int)atoi64[ARCH_INDEX(((char *)salt)[1])] << 6)) & 0x3FF;
++}
++
++static void set_key(char *key, int index)
++{
++ MD5_std_set_key(key, index);
++
++ strnfcpy(saved_key[index], key, PLAINTEXT_LENGTH);
++}
++
++static char *get_key(int index)
++{
++ saved_key[index][PLAINTEXT_LENGTH] = 0;
++
++ return saved_key[index];
++}
++
++static int cmp_all(void *binary, int index)
++{
++#if MD5_X2
++ return *(MD5_word *)binary == MD5_out[0][0] ||
++ *(MD5_word *)binary == MD5_out[1][0];
++#else
++ return *(MD5_word *)binary == MD5_out[0][0];
++#endif
++}
++
++static int cmp_exact(char *source, int index)
++{
++ return !memcmp(MD5_std_get_binary(source, MD5_TYPE_APACHE), MD5_out[index],
++ sizeof(MD5_binary));
++}
++
++
++static void crypt_all(int count) {
++ MD5_std_crypt(MD5_TYPE_APACHE);
++}
++
++static void *get_salt(char *ciphertext) {
++ return MD5_std_get_salt(ciphertext, MD5_TYPE_APACHE);
++}
++
++static void *get_binary(char *ciphertext) {
++ return MD5_std_get_binary(ciphertext, MD5_TYPE_APACHE);
++}
++
++struct fmt_main fmt_MD5_apache = {
++ {
++ FORMAT_LABEL,
++ FORMAT_NAME,
++ MD5_ALGORITHM_NAME,
++ BENCHMARK_COMMENT,
++ BENCHMARK_LENGTH,
++ PLAINTEXT_LENGTH,
++ BINARY_SIZE,
++ SALT_SIZE,
++ MIN_KEYS_PER_CRYPT,
++ MAX_KEYS_PER_CRYPT,
++ FMT_CASE | FMT_8_BIT,
++ tests
++ }, {
++ MD5_std_init,
++ valid,
++ fmt_default_split,
++ get_binary, //(void *(*)(char *))MD5_std_get_binary,
++ get_salt, //(void *(*)(char *))MD5_std_get_salt,
++ {
++ binary_hash_0,
++ binary_hash_1,
++ binary_hash_2
++ },
++ salt_hash,
++ (void (*)(void *))MD5_std_set_salt,
++ set_key,
++ get_key,
++ fmt_default_clear_keys,
++ crypt_all, //(void (*)(int))MD5_std_crypt,
++ {
++ get_hash_0,
++ get_hash_1,
++ get_hash_2
++ },
++ cmp_all,
++ cmp_all,
++ cmp_exact
++ }
++};
+--- john-1.7.3.1.orig/src/MD5_fmt.c
++++ john-1.7.3.1/src/MD5_fmt.c
+@@ -1,4 +1,11 @@
+ /*
++ Modified by Sun-Zero <sun-zero at freemail.hu>
++ 2004. 07. 26.
++
++ Now, its work with md5 hash of apache.
++*/
++
++/*
+ * This file is part of John the Ripper password cracker,
+ * Copyright (c) 1996-2001,2008 by Solar Designer
+ */
+@@ -122,10 +129,22 @@
+
+ static int cmp_exact(char *source, int index)
+ {
+- return !memcmp(MD5_std_get_binary(source), MD5_out[index],
++ return !memcmp(MD5_std_get_binary(source, MD5_TYPE_STD), MD5_out[index],
+ sizeof(MD5_binary));
+ }
+
++static void crypt_all(int count) {
++ MD5_std_crypt(MD5_TYPE_STD);
++}
++
++static void *get_salt(char *ciphertext) {
++ return MD5_std_get_salt(ciphertext, MD5_TYPE_STD);
++}
++
++static void *get_binary(char *ciphertext) {
++ return MD5_std_get_binary(ciphertext, MD5_TYPE_STD);
++}
++
+ struct fmt_main fmt_MD5 = {
+ {
+ FORMAT_LABEL,
+@@ -144,8 +163,8 @@
+ MD5_std_init,
+ valid,
+ fmt_default_split,
+- (void *(*)(char *))MD5_std_get_binary,
+- (void *(*)(char *))MD5_std_get_salt,
++ get_binary, //(void *(*)(char *))MD5_std_get_binary,
++ get_salt, //(void *(*)(char *))MD5_std_get_salt,
+ {
+ binary_hash_0,
+ binary_hash_1,
+@@ -156,7 +175,7 @@
+ set_key,
+ get_key,
+ fmt_default_clear_keys,
+- (void (*)(int))MD5_std_crypt,
++ crypt_all, // (void (*)(int))MD5_std_crypt,
+ {
+ get_hash_0,
+ get_hash_1,
+--- john-1.7.3.1.orig/src/MD5_std.c
++++ john-1.7.3.1/src/MD5_std.c
+@@ -1,4 +1,14 @@
+ /*
++ Modified by Sun-Zero <sun-zero at freemail.hu>
++ 2004. 07. 26.
++
++ Now, its work with md5 hash of apache.
++ The original john patch came from
++ http://lists.jammed.com/pen-test/2001/11/0134.html by
++ Kostas Evangelinos (kos at bastard.net)
++*/
++
++/*
+ * This file is part of John the Ripper password cracker,
+ * Copyright (c) 1996-2001,2003,2006 by Solar Designer
+ *
+@@ -400,7 +410,7 @@
+ order[19][index].length = current->l.pp;
+ }
+
+-void MD5_std_crypt(void)
++void MD5_std_crypt(int md5_type)
+ {
+ int length, index, mask;
+ MD5_pattern *line;
+@@ -482,12 +492,21 @@
+ #if MD5_X2
+ for (index = 0, key = pool; index < MD5_N; index++, key++) {
+ #endif
++
+ memcpy(&block[index], key->o.p.b, key->l.p);
++ if (md5_type == MD5_TYPE_APACHE) {
++ memcpy(&block[index].b[key->l.p], "$apr1$", 6);
++ memcpy(&block[index].b[key->l.p + 6], key->s, key->l.s);
++ memcpy(&block[index].b[key->l.ps + 6],
++ MD5_out[index], key->l.p);
++ length = key->l.psp + 6;
++ } else {
+ memcpy(&block[index].b[key->l.p], "$1$", 3);
+ memcpy(&block[index].b[key->l.p + 3], key->s, key->l.s);
+ memcpy(&block[index].b[key->l.ps + 3],
+ MD5_out[index], key->l.p);
+ length = key->l.psp + 3;
++ }
+ if ((mask = key->l.p))
+ do {
+ block[index].b[length++] =
+@@ -853,13 +872,26 @@
+
+ #endif
+
+-char *MD5_std_get_salt(char *ciphertext)
++char *MD5_std_get_salt(char *ciphertext, int md5_type)
+ {
+ static char out[9];
+ int length;
++ char *pos;
++ char *start;
+
+- for (length = 0; length < 8; length++)
+- if ((out[length] = ciphertext[3 + length]) == '$') break;
++ start = &ciphertext[1];
++ if (md5_type == MD5_TYPE_APACHE) {
++ for (pos = start; *pos && *pos != '$'; pos++);
++ start = ++pos;
++ }
++
++ for (length = 0; length < 8; length++) {
++ if (md5_type == MD5_TYPE_APACHE) {
++ if ((out[length] = start[length]) == '$') break;
++ } else {
++ if ((out[length] = ciphertext[3 + length]) == '$') break;
++ }
++ }
+ out[length] = 0;
+
+ return out;
+@@ -876,7 +908,7 @@
+ out.b[b2] = value >> 8; \
+ out.b[b3] = value;
+
+-MD5_word *MD5_std_get_binary(char *ciphertext)
++MD5_word *MD5_std_get_binary(char *ciphertext, int md5_type)
+ {
+ static union {
+ MD5_binary w;
+@@ -885,7 +917,16 @@
+ char *pos;
+ MD5_word value;
+
++ char *start;
++ if (md5_type == MD5_TYPE_APACHE) {
++ start = &ciphertext[1];
++ for (pos = start; *pos && *pos != '$'; pos++);
++ if (!*pos || pos < start+1 || pos > start+MD5_MAGIC_LENGTH+1) return 0;
++ pos++;
++ while (*pos++ != '$');
++ } else {
+ pos = ciphertext + 3; while (*pos++ != '$');
++ }
+
+ TO_BINARY(0, 6, 12);
+ TO_BINARY(1, 7, 13);
+--- john-1.7.3.1.orig/src/MD5_std.h
++++ john-1.7.3.1/src/MD5_std.h
+@@ -13,6 +13,9 @@
+ #include "arch.h"
+ #include "common.h"
+
++#define MD5_TYPE_STD 0
++#define MD5_TYPE_APACHE 1
++
+ typedef ARCH_WORD_32 MD5_word;
+
+ /*
+@@ -88,6 +91,8 @@
+ #define MD5_ALGORITHM_NAME "32/" ARCH_BITS_STR
+ #endif
+
++#define MD5_MAGIC_LENGTH 10
++
+ /*
+ * Initializes the internal structures.
+ */
+@@ -107,16 +112,16 @@
+ /*
+ * Main encryption routine, sets MD5_out.
+ */
+-extern void MD5_std_crypt(void);
++extern void MD5_std_crypt(int md5_type);
+
+ /*
+ * Returns the salt for MD5_std_set_salt().
+ */
+-extern char *MD5_std_get_salt(char *ciphertext);
++extern char *MD5_std_get_salt(char *ciphertext, int md5_type);
+
+ /*
+ * Converts an ASCII ciphertext to binary.
+ */
+-extern MD5_word *MD5_std_get_binary(char *ciphertext);
++extern MD5_word *MD5_std_get_binary(char *ciphertext, int md5_type);
+
+ #endif
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -41,6 +41,7 @@
+ rawMD5go_fmt.o md5_eq.o \
+ rawSHA1_fmt.o \
+ IPB2_fmt.o \
++ MD5_apache_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-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -49,6 +49,7 @@
+ extern struct fmt_main fmt_rawMD5go;
+ extern struct fmt_main fmt_rawSHA1;
+ extern struct fmt_main fmt_IPB2;
++extern struct fmt_main fmt_MD5_apache;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -86,6 +87,7 @@
+ john_register_one(&fmt_rawMD5go);
+ john_register_one(&fmt_rawSHA1);
+ john_register_one(&fmt_IPB2);
++ john_register_one(&fmt_MD5_apache);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1/IPB2\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1/IPB2/md5a\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
Added: trunk/debian/patches/16-add_NSLDAP.patch
===================================================================
--- trunk/debian/patches/16-add_NSLDAP.patch (rev 0)
+++ trunk/debian/patches/16-add_NSLDAP.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,384 @@
+--- /dev/null
++++ john-1.7.3.1/src/NSLDAP_fmt.c
+@@ -0,0 +1,256 @@
++// Fix for john the ripper 1.6.37 by Sun-Zero, 2004. 07. 26.
++/*
++ * This file is part of John the Ripper password cracker,
++ * Copyright (c) 1996-98 by Solar Designer
++ *
++ * Minor performance enhancement by bartavelle at bandecon.com
++ */
++
++#include <string.h>
++
++#include "misc.h"
++#include "formats.h"
++#include "common.h"
++
++#include "sha.h"
++#include "base64.h"
++
++#define FORMAT_LABEL "nsldap"
++#define FORMAT_NAME "Netscape LDAP SHA"
++#define SHA_TYPE "SHA-1"
++
++#ifdef MMX_TYPE
++#define BENCHMARK_COMMENT MMX_TYPE
++#else
++#define BENCHMARK_COMMENT ""
++#endif
++#define BENCHMARK_LENGTH -1
++
++#define PLAINTEXT_LENGTH 32
++#define CIPHERTEXT_LENGTH 33
++
++#define BINARY_SIZE 20
++#define SALT_SIZE 0
++
++#ifdef MMX_COEF
++#define MIN_KEYS_PER_CRYPT MMX_COEF
++#define MAX_KEYS_PER_CRYPT MMX_COEF
++#define GETPOS(i, index) ( (index)*4 + ((i)& (0xffffffff-3) )*MMX_COEF + (3-((i)&3)) )
++#else
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 1
++#endif
++
++#define NSLDAP_MAGIC "{sha}"
++#define NSLDAP_MAGIC_LENGTH 5
++
++static struct fmt_tests tests[] = {
++ {"{SHA}cMiB1KJphN3OeV9vcYF8nPRIDnk=", "aaaa"},
++ {"{SHA}iu0TIuVFC62weOH7YKgXod8loso=", "bbbb"},
++ {"{SHA}0ijZPTcJXMa+t2XnEbEwSOkvQu0=", "ccccccccc"},
++ {"{SHA}vNR9eUfJfcKmdkLDqNoKagho+qU=", "dddddddddd"},
++ {NULL}
++};
++
++#ifdef MMX_COEF
++/* Cygwin would not guarantee the alignment if these were declared static */
++#define NSLDAP_buffer buffer
++#define NSLDAP_crypt_key crypt_key
++unsigned char buffer[80*4*MMX_COEF] __attribute__ ((aligned(16)));
++char crypt_key[BINARY_SIZE*MMX_COEF] __attribute__ ((aligned(16)));
++static char saved_key[(PLAINTEXT_LENGTH+1)*MMX_COEF];
++static unsigned long total_len;
++static unsigned char out[PLAINTEXT_LENGTH + 1];
++#else
++static ARCH_WORD_32 crypt_key[BINARY_SIZE / 4];
++static char saved_key[PLAINTEXT_LENGTH + 1];
++#endif
++
++static void *
++binary(char *ciphertext) {
++ static char realcipher[BINARY_SIZE + 9];
++
++ /* stupid overflows */
++ memset(realcipher, 0, sizeof(realcipher));
++ base64_decode(NSLDAP_MAGIC_LENGTH+ciphertext, CIPHERTEXT_LENGTH, realcipher);
++ return (void *)realcipher;
++}
++
++static int
++valid(char *ciphertext)
++{
++ if(ciphertext && strlen(ciphertext) == CIPHERTEXT_LENGTH)
++ return !strncasecmp(ciphertext, NSLDAP_MAGIC, NSLDAP_MAGIC_LENGTH);
++ return 0;
++}
++
++static int binary_hash_0(void *binary)
++{
++ return ((ARCH_WORD_32 *)binary)[0] & 0xF;
++}
++
++static int binary_hash_1(void *binary)
++{
++ return ((ARCH_WORD_32 *)binary)[0] & 0xFF;
++}
++
++static int binary_hash_2(void *binary)
++{
++ return ((ARCH_WORD_32 *)binary)[0] & 0xFFF;
++}
++
++static int get_hash_0(int index)
++{
++ return ((ARCH_WORD_32 *)crypt_key)[index] & 0xF;
++}
++
++static int get_hash_1(int index)
++{
++ return ((ARCH_WORD_32 *)crypt_key)[index] & 0xFF;
++}
++
++static int get_hash_2(int index)
++{
++ return ((ARCH_WORD_32 *)crypt_key)[index] & 0xFFF;
++}
++
++static void set_key(char *key, int index)
++{
++#ifdef MMX_COEF
++ int len;
++ int i;
++
++ if(index==0)
++ {
++ total_len = 0;
++ memset(saved_key, 0, sizeof(saved_key));
++ }
++ len = strlen(key);
++ if(len>PLAINTEXT_LENGTH)
++ len = PLAINTEXT_LENGTH;
++
++ total_len += len << ( ( (32/MMX_COEF) * index ) );
++ for(i=0;i<len;i++)
++ saved_key[GETPOS(i, index)] = key[i];
++
++ saved_key[GETPOS(i, index)] = 0x80;
++#else
++ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1);
++#endif
++}
++
++static char *get_key(int index)
++{
++#ifdef MMX_COEF
++ unsigned int i,s;
++
++ s = (total_len >> (((32/MMX_COEF)*(index)))) & 0xff;
++ for(i=0;i<s;i++)
++ out[i] = saved_key[ GETPOS(i, index) ];
++ out[i] = 0;
++ return (char *) out;
++#else
++ return saved_key;
++#endif
++}
++
++static int
++cmp_all(void *binary, int count)
++{
++#ifdef MMX_COEF
++ int i = 0;
++ while(i< (BINARY_SIZE/4) )
++ {
++ if (
++ ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF])
++ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+1])
++#if (MMX_COEF > 3)
++ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+2])
++ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+3])
++#endif
++ )
++ return 0;
++ i++;
++ }
++ return 1;
++#else
++ return !memcmp(binary, crypt_key, BINARY_SIZE);
++#endif
++}
++
++static int
++cmp_exact(char *source, int index)
++{
++ return 1;
++}
++
++static int cmp_one(void * binary, int index)
++{
++#ifdef MMX_COEF
++ int i = 0;
++ for(i=0;i<(BINARY_SIZE/4);i++)
++ if ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+index] )
++ return 0;
++ return 1;
++#else
++ return cmp_all(binary, index);
++#endif
++}
++
++static void set_salt(void *salt) {
++}
++
++static void
++crypt_all(int count) {
++#ifdef MMX_COEF
++ memcpy(buffer, saved_key, 32*MMX_COEF);
++ shammx((unsigned char *) crypt_key, buffer, total_len);
++#else
++ static SHA_CTX ctx;
++ SHA1_Init(&ctx);
++ SHA1_Update(&ctx, (unsigned char *) saved_key, strlen(saved_key));
++ SHA1_Final((unsigned char *) crypt_key, &ctx);
++#endif
++}
++
++struct fmt_main fmt_NSLDAP = {
++ {
++ FORMAT_LABEL,
++ FORMAT_NAME,
++ SHA_TYPE,
++ BENCHMARK_COMMENT,
++ BENCHMARK_LENGTH,
++ PLAINTEXT_LENGTH,
++ BINARY_SIZE,
++ SALT_SIZE,
++ MIN_KEYS_PER_CRYPT,
++ MAX_KEYS_PER_CRYPT,
++ FMT_CASE | FMT_8_BIT,
++ tests
++ }, {
++ fmt_default_init,
++ valid,
++ fmt_default_split,
++ binary,
++ fmt_default_salt,
++ {
++ binary_hash_0,
++ binary_hash_1,
++ binary_hash_2
++ },
++ fmt_default_salt_hash,
++ set_salt,
++ set_key,
++ get_key,
++ fmt_default_clear_keys,
++ crypt_all,
++ {
++ get_hash_0,
++ get_hash_1,
++ get_hash_2
++ },
++ cmp_all,
++ cmp_one,
++ cmp_exact
++ }
++};
+--- /dev/null
++++ john-1.7.3.1/src/base64.c
+@@ -0,0 +1,74 @@
++
++#include <stdio.h>
++#include <string.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++
++void base64_unmap(char *in_block) {
++ int i;
++ char *c;
++
++ for(i=0; i<4; i++) {
++ c = in_block + i;
++
++ if(*c>='A' && *c<='Z') {
++ *c -= 'A';
++ continue;
++ }
++
++ if(*c>='a' && *c<='z') {
++ *c -= 'a';
++ *c += 26;
++ continue;
++ }
++
++ if(*c == '+') {
++ *c = 62;
++ continue;
++ }
++
++ if(*c == '/') {
++ *c = 63;
++ continue;
++ }
++
++ if(*c == '=') {
++ *c = 0;
++ }
++
++ *c -= '0';
++ *c += 52;
++ }
++}
++
++int base64_decode(char *in, int inlen, char *out) {
++ int i;
++ char *in_block;
++ char *out_block;
++ char temp[4];
++
++ out_block = out;
++ in_block = in;
++
++ for(i=0; i<inlen; i+=4) {
++
++ if(*in_block == '=')
++ return 0;
++
++ memcpy(temp, in_block, 4);
++ memset(out_block, 0, 3);
++ base64_unmap(temp);
++
++ out_block[0] =
++ ((temp[0]<<2) & 0xfc) | ((temp[1]>>4) & 3);
++ out_block[1] =
++ ((temp[1]<<4) & 0xf0) | ((temp[2]>>2) & 0xf);
++ out_block[2] =
++ ((temp[2]<<6) & 0xc0) | ((temp[3] ) & 0x3f);
++
++ out_block += 3;
++ in_block += 4;
++ }
++
++ return 0;
++}
+--- /dev/null
++++ john-1.7.3.1/src/base64.h
+@@ -0,0 +1,6 @@
++#ifndef _BASE64_H
++#define _BASE64_H
++
++int base64_decode(char *in, int inlen, char *out);
++
++#endif
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1/IPB2/md5a\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1/IPB2/md5a/nsldap\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -42,6 +42,7 @@
+ rawSHA1_fmt.o \
+ IPB2_fmt.o \
+ MD5_apache_fmt.o \
++ NSLDAP_fmt.o base64.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-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -50,6 +50,7 @@
+ extern struct fmt_main fmt_rawSHA1;
+ extern struct fmt_main fmt_IPB2;
+ extern struct fmt_main fmt_MD5_apache;
++extern struct fmt_main fmt_NSLDAP;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -88,6 +89,7 @@
+ john_register_one(&fmt_rawSHA1);
+ john_register_one(&fmt_IPB2);
+ john_register_one(&fmt_MD5_apache);
++ john_register_one(&fmt_NSLDAP);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
Added: trunk/debian/patches/17-add_OPENLDAPS.patch
===================================================================
--- trunk/debian/patches/17-add_OPENLDAPS.patch (rev 0)
+++ trunk/debian/patches/17-add_OPENLDAPS.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,338 @@
+--- /dev/null
++++ john-1.7.3.1/src/OPENLDAPS_fmt.c
+@@ -0,0 +1,296 @@
++// Fix for john the ripper 1.6.37 by Sun-Zero, 2004. 07. 26.
++/*
++ * This file is part of John the Ripper password cracker,
++ * Copyright (c) 1996-98 by Solar Designer
++ *
++ * Minor performance enhancement by bartavelle at bandecon.com
++ */
++
++#include <string.h>
++
++#include "arch.h"
++#include "misc.h"
++#include "params.h"
++#include "formats.h"
++#include "common.h"
++
++#include "sha.h"
++#include "base64.h"
++
++#undef MMX_COEF
++#undef MMX_TYPE
++
++#define FORMAT_LABEL "openssha"
++#define FORMAT_NAME "OpenLDAP SSHA"
++#define SHA_TYPE "salted SHA-1"
++
++#ifdef MMX_TYPE
++#define BENCHMARK_COMMENT MMX_TYPE
++#else
++#define BENCHMARK_COMMENT ""
++#endif
++#define BENCHMARK_LENGTH 0
++
++#define PLAINTEXT_LENGTH 32
++#define CIPHERTEXT_LENGTH 32
++
++#define BINARY_SIZE 20
++#define SALT_SIZE 4
++
++#ifdef MMX_COEF
++#define MIN_KEYS_PER_CRYPT MMX_COEF
++#define MAX_KEYS_PER_CRYPT MMX_COEF
++#define GETPOS(i, index) ( (index)*4 + ((i)& (0xffffffff-3) )*MMX_COEF + (3-((i)&3)) )
++#else
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 1
++#endif
++
++#define NSLDAP_MAGIC "{ssha}"
++#define NSLDAP_MAGIC_LENGTH 6
++
++static struct fmt_tests tests[] = {
++ {"{SSHA}bPXG4M1KkwZh2Hbgnuoszvpat0T/OS86", "thales"},
++ {"{SSHA}hHSEPW3qeiOo5Pl2MpHQCXh0vgfyVR/X", "test1"},
++ {"{SSHA}pXp4yIiRmppvKYn7cKCT+lngG4qELq4h", "test2"},
++ {"{SSHA}Bv8tu3wB8WTMJj3tcOsl1usm5HzGwEmv", "test3"},
++ {"{SSHA}kXyh8wLCKbN+QRbL2F2aUbkP62BJ/bRg", "lapin"},
++ {"{SSHA}rnMVxsf1YJPg0L5CBhbVLIsJF+o/vkoE", "canard"},
++ {"{SSHA}Uf2x9YxSWZZNAi2t1QXbG2PmT07AtURl", "chien"},
++ {"{SSHA}XXGLZ7iKpYSBpF6EwoeTl27U0L/kYYsY", "hibou"},
++ {"{SSHA}HYRPmcQIIzIIg/c1L8cZKlYdNpyeZeml", "genou"},
++ {"{SSHA}Zm/0Wll7rLNpBU4HFUKhbASpXr94eSTc", "caillou"},
++ {"{SSHA}Qc9OB+aEFA/mJ5MNy0AB4hRIkNiAbqDb", "doudou"},
++ {NULL}
++};
++
++#ifdef MMX_COEF
++static char crypt_key[BINARY_SIZE*MMX_COEF];
++/* Cygwin would not guarantee the alignment for this static declaration, but
++ * this source file is not MMX-ready anyway (MMX_COEF is #undef'ed above). */
++static char saved_key[80*MMX_COEF*4] __attribute__ ((aligned(8*MMX_COEF)));
++static unsigned char out[PLAINTEXT_LENGTH + 1];
++#else
++static ARCH_WORD_32 crypt_key[BINARY_SIZE / 4];
++static char saved_key[PLAINTEXT_LENGTH + 1];
++#endif
++
++#ifdef MMX_COEF
++static unsigned long length[MAX_KEYS_PER_CRYPT];
++#endif
++
++static char saved_salt[SALT_SIZE];
++
++static void * binary(char *ciphertext) {
++ static char realcipher[BINARY_SIZE + SALT_SIZE + 9];
++
++ /* stupid overflows */
++ memset(realcipher, 0, BINARY_SIZE + SALT_SIZE + 9);
++ base64_decode(NSLDAP_MAGIC_LENGTH+ciphertext, CIPHERTEXT_LENGTH, realcipher);
++#ifdef MMX_COEF
++ alter_endianity((unsigned char*)realcipher, BINARY_SIZE);
++#endif
++ return (void *)realcipher;
++}
++
++static void * get_salt(char * ciphertext)
++{
++ static char realcipher[BINARY_SIZE + SALT_SIZE + 9];
++ memset(realcipher, 0, BINARY_SIZE + SALT_SIZE + 9);
++ base64_decode(NSLDAP_MAGIC_LENGTH+ciphertext, CIPHERTEXT_LENGTH, realcipher);
++ return (void*)realcipher+BINARY_SIZE;
++}
++
++static int valid(char *ciphertext)
++{
++ if(ciphertext && strlen(ciphertext) == CIPHERTEXT_LENGTH + NSLDAP_MAGIC_LENGTH)
++ return !strncasecmp(ciphertext, NSLDAP_MAGIC, NSLDAP_MAGIC_LENGTH);
++ return 0;
++}
++
++static int binary_hash_0(void *binary)
++{
++ return ((ARCH_WORD_32 *)binary)[0] & 0xF;
++}
++
++static int binary_hash_1(void *binary)
++{
++ return ((ARCH_WORD_32 *)binary)[0] & 0xFF;
++}
++
++static int binary_hash_2(void *binary)
++{
++ return ((ARCH_WORD_32 *)binary)[0] & 0xFFF;
++}
++
++static int get_hash_0(int index)
++{
++ return ((ARCH_WORD_32 *)crypt_key)[index] & 0xF;
++}
++
++static int get_hash_1(int index)
++{
++ return ((ARCH_WORD_32 *)crypt_key)[index] & 0xFF;
++}
++
++static int get_hash_2(int index)
++{
++ return ((ARCH_WORD_32 *)crypt_key)[index] & 0xFFF;
++}
++
++static int salt_hash(void *salt)
++{
++ return *((ARCH_WORD_32 *)salt) & (SALT_HASH_SIZE - 1);
++}
++
++static void set_key(char *key, int index)
++{
++#ifdef MMX_COEF
++ int len;
++ int i;
++
++ if(index==0)
++ {
++ memset(saved_key, 0, sizeof(saved_key));
++ }
++ len = strlen(key);
++ if(len>PLAINTEXT_LENGTH)
++ len = PLAINTEXT_LENGTH;
++
++ length[index] = len;
++
++ for(i=0;i<len;i++)
++ saved_key[GETPOS(i, index)] = key[i];
++
++ saved_key[GETPOS( (i+SALT_SIZE) , index)] = 0x80;
++ ((unsigned int *)saved_key)[15*MMX_COEF+index] = (len+SALT_SIZE)<<3;
++#else
++ strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1);
++#endif
++}
++
++static void set_salt(void *salt)
++{
++ memcpy(saved_salt, salt, SALT_SIZE);
++}
++
++static char *get_key(int index)
++{
++#ifdef MMX_COEF
++ unsigned int i,s;
++
++ s = length[index];
++ for(i=0;i<s;i++)
++ out[i] = saved_key[ GETPOS(i, index) ];
++ out[i] = 0;
++ return (char*)out;
++#else
++ return saved_key;
++#endif
++}
++
++static int
++cmp_all(void *binary, int index)
++{
++#ifdef MMX_COEF
++ int i = 0;
++ while(i< (BINARY_SIZE/4) )
++ {
++ if (
++ ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF])
++ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+1])
++#if (MMX_COEF > 3)
++ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+2])
++ && ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+3])
++#endif
++ )
++ return 0;
++ i++;
++ }
++ return 1;
++#else
++ return !memcmp(binary, crypt_key, BINARY_SIZE);
++#endif
++}
++
++static int
++cmp_exact(char *source, int index)
++{
++ return 1;
++}
++
++static int cmp_one(void * binary, int index)
++{
++#ifdef MMX_COEF
++ int i = 0;
++ for(i=0;i<(BINARY_SIZE/4);i++)
++ if ( ((unsigned long *)binary)[i] != ((unsigned long *)crypt_key)[i*MMX_COEF+index] )
++ return 0;
++ return 1;
++#else
++ return cmp_all(binary, index);
++#endif
++}
++
++
++static void crypt_all(int count)
++{
++#ifdef MMX_COEF
++ int i,idx;
++
++ for(idx=0;idx<MAX_KEYS_PER_CRYPT;idx++)
++ {
++ for(i=0;i<SALT_SIZE;i++)
++ saved_key[GETPOS((i+length[idx]),idx)] = ((unsigned char *)saved_salt)[i];
++ }
++ shammx((unsigned char*)crypt_key, (unsigned char*)saved_key);
++#else
++ static SHA_CTX ctx;
++ SHA1_Init(&ctx);
++ SHA1_Update(&ctx, (unsigned char*)saved_key, strlen(saved_key));
++ SHA1_Update(&ctx, (unsigned char*)saved_salt, SALT_SIZE);
++ SHA1_Final((unsigned char*)crypt_key, &ctx);
++#endif
++}
++
++struct fmt_main fmt_OPENLDAPS = {
++ {
++ FORMAT_LABEL,
++ FORMAT_NAME,
++ SHA_TYPE,
++ BENCHMARK_COMMENT,
++ BENCHMARK_LENGTH,
++ PLAINTEXT_LENGTH,
++ BINARY_SIZE,
++ SALT_SIZE,
++ MIN_KEYS_PER_CRYPT,
++ MAX_KEYS_PER_CRYPT,
++ FMT_CASE | FMT_8_BIT,
++ tests
++ }, {
++ fmt_default_init,
++ valid,
++ fmt_default_split,
++ binary,
++ 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-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -43,6 +43,7 @@
+ IPB2_fmt.o \
+ MD5_apache_fmt.o \
+ NSLDAP_fmt.o base64.o \
++ OPENLDAPS_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-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -51,6 +51,7 @@
+ extern struct fmt_main fmt_IPB2;
+ extern struct fmt_main fmt_MD5_apache;
+ extern struct fmt_main fmt_NSLDAP;
++extern struct fmt_main fmt_OPENLDAPS;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -90,6 +91,7 @@
+ john_register_one(&fmt_IPB2);
+ john_register_one(&fmt_MD5_apache);
+ john_register_one(&fmt_NSLDAP);
++ john_register_one(&fmt_OPENLDAPS);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1/IPB2/md5a/nsldap\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1/IPB2/md5a/nsldap/openssha\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
Added: trunk/debian/patches/18-add_HDAA.patch
===================================================================
--- trunk/debian/patches/18-add_HDAA.patch (rev 0)
+++ trunk/debian/patches/18-add_HDAA.patch 2008-12-09 23:10:58 UTC (rev 184)
@@ -0,0 +1,468 @@
+--- /dev/null
++++ john-1.7.3.1/src/HDAA_fmt.c
+@@ -0,0 +1,385 @@
++/* HTTP Digest access authentication patch for john
++ *
++ * Written by Romain Raboin - romain.raboin at gmail.com
++ *
++ */
++
++#include <string.h>
++#include <stdint.h>
++
++#ifdef __MMX__
++#include <mmintrin.h>
++#endif
++
++#include "arch.h"
++#include "misc.h"
++#include "common.h"
++#include "formats.h"
++#include "md5.h"
++
++#define FORMAT_LABEL "hdaa"
++#define FORMAT_NAME "HTTP Digest access authentication"
++#define ALGORITHM_NAME "HDAA-MD5"
++
++#define BENCHMARK_COMMENT ""
++#define BENCHMARK_LENGTH 0
++
++#define PLAINTEXT_LENGTH 16
++#define CIPHERTEXT_LENGTH 32
++
++#define BINARY_SIZE 16
++
++#define MIN_KEYS_PER_CRYPT 1
++#define MAX_KEYS_PER_CRYPT 1
++
++#define SEPARATOR '$'
++
++#define MAGIC "$response$"
++#define SIZE_TAB 12
++
++#define HTMP 512
++
++typedef struct
++{
++ char **request;
++ char h3tmp[HTMP + 1];
++ char h1tmp[HTMP + 1];
++ size_t h3tmplen;
++ size_t h1tmplen;
++} reqinfo_t;
++
++#define SALT_SIZE sizeof(reqinfo_t)
++
++
++/*
++ digest authentication scheme :
++ h1 = md5(user:realm:password)
++ h2 = md5(method:digestURI)
++ response = h3 = md5(h1:nonce:nonceCount:ClientNonce:qop:h2)
++*/
++
++/* request information */
++enum e_req {
++ R_RESPONSE,
++ R_USER,
++ R_REALM,
++ R_METHOD,
++ R_URI,
++ R_NONCE,
++ R_NONCECOUNT,
++ R_CLIENTNONCE,
++ R_QOP
++};
++
++/* response:user:realm:method:uri:nonce:nonceCount:ClientNonce:qop */
++static struct fmt_tests hdaa_tests[] = {
++ {"$response$679066476e67b5c7c4e88f04be567f8b$user$myrealm$GET$/$8c12bd8f728afe56d45a0ce846b70e5a$00000001$4b61913cec32e2c9$auth", "nocode"},
++ {"$response$faa6cb7d676e5b7c17fcbf966436aa0c$moi$myrealm$GET$/$af32592775d27b1cd06356b3a0db9ddf$00000001$8e1d49754a25aea7$auth", "kikou"},
++ {NULL}
++};
++
++
++static MD5_CTX ctx;
++
++/* used by set_key */
++static char saved_key[PLAINTEXT_LENGTH + 1];
++
++/* store the ciphertext for value currently being tested */
++static unsigned char crypt_key[BINARY_SIZE + 1];
++
++/* Store information about the request ()*/
++static reqinfo_t *rinfo = NULL;
++
++/* Store the hash convertion (binary to ascii)*/
++#ifdef __MMX__
++static __m64 conv[4 + 1];
++#else
++static uint32_t conv[(CIPHERTEXT_LENGTH / 4) + 1];
++#endif
++
++static int hdaa_valid(char *ciphertext)
++{
++ int nb = 0;
++ int i;
++
++ if (strncmp(ciphertext, MAGIC, strlen(MAGIC)) != 0)
++ return 0;
++ for (i = 0; ciphertext[i] != 0; i++) {
++ if (ciphertext[i] == SEPARATOR) {
++ nb++;
++ }
++ }
++ if (nb == 10)
++ return 1;
++ return 0;
++}
++
++static void hdaa_set_salt(void *salt)
++{
++ rinfo = salt;
++}
++
++static void hdaa_set_key(char *key, int index)
++{
++ strnzcpy(saved_key, key, PLAINTEXT_LENGTH + 1);
++}
++
++static char *hdaa_get_key(int index)
++{
++ return saved_key;
++}
++
++static int hdaa_cmp_all(void *binary, int index)
++{
++ return !(memcmp((char *)binary, (char *)crypt_key, BINARY_SIZE));
++}
++
++static int hdaa_cmp_exact(char *source, int count)
++{
++ return 1;
++}
++
++
++/* convert hash from binary to ascii */
++
++#ifdef __MMX__
++
++static void bin2ascii(__m64 src[2])
++{
++ unsigned int i = 0;
++
++ while (i != 4) {
++ __m64 l;
++ __m64 r;
++ __m64 t;
++ __m64 u;
++ __m64 v;
++
++ /* 32 bits to 64 bits */
++ t = _mm_set1_pi32(0x0f0f0f0f);
++
++ /* Bit-wise AND the 64-bit values in M1 and M2. */
++ u = _mm_and_si64(_mm_srli_si64(src[(i / 2)], 4), t);
++ v = _mm_and_si64(src[(i / 2)], t);
++
++ /* interleaving */
++ l = _mm_unpacklo_pi8(u, v);
++ r = _mm_unpackhi_pi8(u, v);
++
++ t = _mm_set1_pi32(0x06060606);
++ l = _mm_add_pi32(l, t);
++ r = _mm_add_pi32(r, t);
++
++ t = _mm_set1_pi32(0x01010101);
++ /* u = (l << 4) & t */
++ u = _mm_and_si64(_mm_srli_si64(l, 4), t);
++ /* v = (r << 4) & t */
++ v = _mm_and_si64(_mm_srli_si64(r, 4), t);
++
++ t = _mm_set1_pi32(0x00270027);
++ /* Multiply four 16-bit values in M1 by four 16-bit values in M2 and produce
++ the low 16 bits of the results. */
++ u = _mm_mullo_pi16(u, t);
++ v = _mm_mullo_pi16(v, t);
++
++ t = _mm_set1_pi32(0x2a2a2a2a);
++ u = _mm_add_pi32(u, t);
++ v = _mm_add_pi32(v, t);
++
++ conv[(i++)] = _mm_add_pi32(l, u);
++ conv[(i++)] = _mm_add_pi32(r, v);
++ }
++}
++
++#else
++
++static void bin2ascii(unsigned char *src)
++{
++ unsigned int i;
++ unsigned int j = 0;
++ uint32_t t = 0;
++
++ for (i = 0; i < BINARY_SIZE; i += 2) {
++#if (ARCH_LITTLE_ENDIAN == 0)
++ t = (src[i] & 0xf0);
++ t *= 0x10;
++ t += (src[i] & 0x0f);
++ t *= 0x1000;
++ t += (src[(i + 1)] & 0xf0);
++ t *= 0x10;
++ t += (src[(i + 1)] & 0x0f);
++#else
++ t = (src[(i + 1)] & 0x0f);
++ t *= 0x1000;
++ t += (src[(i + 1)] & 0xf0);
++ t *= 0x10;
++ t += (src[i] & 0x0f);
++ t *= 0x100;
++ t += ((src[i] & 0xf0) >> 4);
++#endif
++ t += 0x06060606;
++ t += ((((t >> 4) & 0x01010101) * 0x27) + 0x2a2a2a2a);
++ conv[(j++)] = t;
++ }
++}
++
++#endif /* MMX */
++
++static void hdaa_crypt_all(int count)
++{
++ int len;
++#ifdef __MMX__
++ __m64 h1[2];
++#else
++ unsigned char h1[BINARY_SIZE];
++#endif
++ char *h1tmp, *h3tmp;
++ size_t tmp;
++
++ h3tmp = rinfo->h3tmp;
++ h1tmp = rinfo->h1tmp;
++ tmp = rinfo->h1tmplen;
++ len = strlen(saved_key);
++ memcpy(&h1tmp[tmp], saved_key, len + 1);
++
++ MD5_Init(&ctx);
++ MD5_Update(&ctx, h1tmp, len + tmp);
++ MD5_Final((unsigned char*)h1, &ctx);
++ bin2ascii(h1);
++
++ memcpy(h3tmp, conv, CIPHERTEXT_LENGTH);
++ MD5_Init(&ctx);
++ MD5_Update(&ctx, h3tmp, rinfo->h3tmplen);
++ MD5_Final(crypt_key, &ctx);
++}
++
++static char *mystrndup(const char *s, size_t n)
++{
++ size_t tmp;
++ size_t size;
++ char *ret;
++
++ for (tmp = 0; s[tmp] != 0 && tmp <= n; tmp++);
++ size = n;
++ if (tmp < size)
++ size = tmp;
++ if ((ret = malloc(sizeof(char) * size + 1)) == NULL)
++ return NULL;
++ memmove(ret, s, size);
++ ret[size] = 0;
++ return ret;
++}
++
++static size_t reqlen(char *str)
++{
++ size_t len;
++
++ for (len = 0; str[len] != 0 && str[len] != SEPARATOR; len++);
++ return len;
++}
++
++static void *hdaa_salt(char *ciphertext)
++{
++
++ int nb;
++ int i;
++ char **request;
++ char *str;
++ reqinfo_t *r;
++#ifdef __MMX__
++ __m64 h2[2];
++#else
++ unsigned char h2[BINARY_SIZE];
++#endif
++ /* parse the password string */
++ request = malloc(sizeof(char *) * SIZE_TAB);
++ r = malloc(sizeof(*r));
++ memset(r, 0, sizeof(*r));
++ for (nb = 0, i = 1; ciphertext[i] != 0; i++) {
++ if (ciphertext[i] == SEPARATOR) {
++ i++;
++ request[nb] = mystrndup(&ciphertext[i],
++ reqlen(&ciphertext[i]));
++ nb++;
++ }
++ }
++
++ /* calculate h2 (h2 = md5(method:digestURI))*/
++ str = malloc(strlen(request[R_METHOD]) + strlen(request[R_URI]) + 2);
++ sprintf(str, "%s:%s", request[R_METHOD], request[R_URI]);
++ MD5_Init(&ctx);
++ MD5_Update(&ctx, str, strlen(str));
++ MD5_Final((unsigned char *)h2, &ctx);
++
++ memset(conv, 0, sizeof(conv));
++ bin2ascii(h2);
++ free(str);
++
++ /* create a part of h1 (h1tmp = request:realm:)*/
++ snprintf(r->h1tmp, HTMP - PLAINTEXT_LENGTH, "%s:%s:", request[R_USER], request[R_REALM]);
++
++ /* create a part of h3 (h3tmp = nonce:noncecount:clientnonce:qop:h2)*/
++ snprintf(&r->h3tmp[CIPHERTEXT_LENGTH], HTMP - CIPHERTEXT_LENGTH, ":%s:%s:%s:%s:%s",
++ request[R_NONCE], request[R_NONCECOUNT], request[R_CLIENTNONCE],
++ request[R_QOP], (char*)conv);
++ r->request = request;
++ r->h1tmplen = strlen(r->h1tmp);
++ r->h3tmplen = strlen(&r->h3tmp[CIPHERTEXT_LENGTH]) + CIPHERTEXT_LENGTH;
++ return r;
++}
++
++/* convert response in binary form */
++static void *hdaa_binary(char *ciphertext)
++{
++ static char realcipher[BINARY_SIZE];
++ int i;
++
++ ciphertext += 10;
++ for (i = 0; i < BINARY_SIZE; i++) {
++ realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i * 2])] * 16 +
++ atoi16[ARCH_INDEX(ciphertext[i * 2 + 1])];
++ }
++ return (void *) realcipher;
++}
++
++struct fmt_main fmt_HDAA = {
++ {
++ 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,
++ hdaa_tests
++ }, {
++ fmt_default_init,
++ hdaa_valid,
++ fmt_default_split,
++ hdaa_binary,
++ hdaa_salt,
++ {
++ fmt_default_binary_hash,
++ fmt_default_binary_hash,
++ fmt_default_binary_hash
++ },
++ fmt_default_salt_hash,
++ hdaa_set_salt,
++ hdaa_set_key,
++ hdaa_get_key,
++ fmt_default_clear_keys,
++ hdaa_crypt_all,
++ {
++ fmt_default_get_hash,
++ fmt_default_get_hash,
++ fmt_default_get_hash
++ },
++ hdaa_cmp_all,
++ hdaa_cmp_all,
++ hdaa_cmp_exact
++ }
++};
+--- john-1.7.3.1.orig/src/Makefile
++++ john-1.7.3.1/src/Makefile
+@@ -44,6 +44,7 @@
+ MD5_apache_fmt.o \
+ NSLDAP_fmt.o base64.o \
+ OPENLDAPS_fmt.o \
++ HDAA_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-1.7.3.1.orig/src/john.c
++++ john-1.7.3.1/src/john.c
+@@ -52,6 +52,7 @@
+ extern struct fmt_main fmt_MD5_apache;
+ extern struct fmt_main fmt_NSLDAP;
+ extern struct fmt_main fmt_OPENLDAPS;
++extern struct fmt_main fmt_HDAA;
+
+ extern int unshadow(int argc, char **argv);
+ extern int unafs(int argc, char **argv);
+@@ -92,6 +93,7 @@
+ john_register_one(&fmt_MD5_apache);
+ john_register_one(&fmt_NSLDAP);
+ john_register_one(&fmt_OPENLDAPS);
++ john_register_one(&fmt_HDAA);
+
+ if (!fmt_list) {
+ fprintf(stderr, "Unknown ciphertext format name requested\n");
+--- john-1.7.3.1.orig/src/options.c
++++ john-1.7.3.1/src/options.c
+@@ -101,7 +101,7 @@
+ "--salts=[-]COUNT load salts with[out] at least COUNT passwords " \
+ "only\n" \
+ "--format=NAME force hash type NAME: " \
+- "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1/IPB2/md5a/nsldap/openssha\n" \
++ "DES/BSDI/MD5/BF/AFS/LM/NT/mscash/NETLM/NETNTLM/bfegg/KRB5/DOMINOSEC/lotus5/raw-MD5/raw-sha1/IPB2/md5a/nsldap/openssha/HDAA\n" \
+ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n"
+
+ void opt_init(char *name, int argc, char **argv)
+--- /dev/null
++++ john-1.7.3.1/doc/HDAA_README
+@@ -0,0 +1,38 @@
++ HTTP Digest access authentication
++ ---------------------------------
++
++
++
++- How to create the password string :
++-------------------------------------
++
++
++user:$MAGIC$response$user$realm$method$uri$nonce$nonceCount$ClientNonce$qop
++
++'$' is use as separator, you can change it in HDAA_fmt.c
++
++
++Example of password string :
++
++user:$response$679066476e67b5c7c4e88f04be567f8b$user$myrealm$GET$/$8c12bd8f728afe56d45a0ce846b70e5a$00000001$4b61913cec32e2c9$auth
++
++Here the magic is '$response$'
++
++
++
++
++
++- Demonstration :
++-----------------
++
++Tested on a : AMD Athlon(tm) 64 Processor 3000+
++
++$ cat ./htdigest
++moi:$response$faa6cb7d676e5b7c17fcbf966436aa0c$moi$myrealm$GET$/$af32592775d27b1cd06356b3a0db9ddf$00000001$8e1d49754a25aea7$auth
++user:$response$679066476e67b5c7c4e88f04be567f8b$user$myrealm$GET$/$8c12bd8f728afe56d45a0ce846b70e5a$00000001$4b61913cec32e2c9$auth
++
++$ ./john ./htdigest
++Loaded 2 password hashes with 2 different salts (HTTP Digest access authentication [HDAA-MD5])
++kikou (moi)
++nocode (user)
++guesses: 2 time: 0:00:01:27 (3) c/s: 670223 trying: nocode
Modified: trunk/debian/patches/series
===================================================================
--- trunk/debian/patches/series 2008-11-26 15:30:16 UTC (rev 183)
+++ trunk/debian/patches/series 2008-12-09 23:10:58 UTC (rev 184)
@@ -6,3 +6,14 @@
05-mipsel.patch
06-fix_paths.patch
07-update_FAQ.patch
+08-add_BFEgg.patch
+09-add_KRB5.patch
+10-add_DOMINOSEC.patch
+11-add_lotus5.patch
+12-add_raw-md5.patch
+13-add_raw-sha1.patch
+14-add_IPB2.patch
+15-add_MD5_apache.patch
+16-add_NSLDAP.patch
+17-add_OPENLDAPS.patch
+18-add_HDAA.patch
More information about the Pkg-john-commits
mailing list