Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 23 Jul 2012 15:14:53 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: Re: Some more external mode definitions

>> Instead, they might consider reducing the hard coded max. length in
>> init(), should the format specific maximum length or the length
>> specified with --stdout=LENGTH be shorter than the hard coded maximum
>> length.
>> Otherwise, these external modes would effectively produce duplicate
>> password candidates.
> 
> For some modes, this is better for sure. Anyway, all external modes
> should make use of maxlen, in one way or the other. Could you produce a
> patch for that too? I'll take care of my Dumb16/32 modes and the
> contest-tree-only modes now.

I prepared a patch to rename maxlen to cipher_limit, because that is the
name that has a better chance to be accepted for core jumbo.

I've cloned your github repository, and will soon(ish) send a pull request.

Just to be sure I don't mess up:

Since the maxlen change was not in 1.7.9-jumbo-6-fixes, but in
magnum-jumbo and bleeding-jumbo, I'll make a change for magnum-jumbo,
and will push it into the magnum-jumbo branch of my forked github
repository.
Once that is done, I send a pull request, and you'll (hopefully) commit
the change to your repository, at least into magnum-jumbo and
bleeding-jumbo.

What is the correct way to integrate the changes from your repository
https://github.com/magnumripper/magnum-jumbo into my github repository?
Do I git pull (or fetch/merge) from upstream (your github repository) to
my local repository, and then push that into my github repository?
(At least that is what I think I have to do.)

Since I prefer not to push changes into your repository without a chance
for others to review them, I'll include the patch inlined at the end of
my mail.
Note that I didn't change the "From 1.7.9.5-jumbo-7 on" in doc/EXTERNAL.
If jumbo-7 is released without that change, I can fix doc/EXTERNAL
afterwards.
I prefer it this way, instead of a jumbo-7 with wrong information in
doc/EXTERNAL, should someone decide this can go into jumbo-7.


Frank

>From 49958ae46f32047bd1eaa4fe5944d233d3e62acf Mon Sep 17 00:00:00 2001
From: Frank Dittrich <frank_dittrich@...mail.com>
Date: Mon, 23 Jul 2012 14:27:39 +0200
Subject: [PATCH] Rename external mode variable maxlen to cipher_limit

This name has been picked in the discussion on john-dev,
since there might be future additions to expose other
format attributes.
---
 doc/EXTERNAL    |    4 ++--
 run/dumb16.conf |    4 ++--
 run/dumb32.conf |    4 ++--
 run/john.conf   |    8 ++++----
 src/external.c  |   14 +++++++-------
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/doc/EXTERNAL b/doc/EXTERNAL
index 2ce6c0e..136e513 100644
--- a/doc/EXTERNAL
+++ b/doc/EXTERNAL
@@ -53,12 +53,12 @@ displayed (just like on a keypress), respectively.
These actions are
 taken after having tested at least all of the candidate passwords that
 were in external mode's "word" so far.  In other words, the actions may
 be delayed in order to process any buffered candidate passwords.
-From 1.7.9.5-jumbo-7 on, a third variable is defined: "maxlen".
+From 1.7.9.5-jumbo-7 on, a third variable is defined: "cipher_limit".
 This variable is of type "int". It contains the maximum password length
 in bytes, either from the format definition or from --stdout[=LENGTH].
 This variable should not be changed by the external mode.
 Instead, it can be used to stop generating new candidates should the
-password length get larger than "maxlen".
+password length get larger than "cipher_limit".


 	The language.
diff --git a/run/dumb16.conf b/run/dumb16.conf
index 1d03ed4..2c413de 100644
--- a/run/dumb16.conf
+++ b/run/dumb16.conf
@@ -26,8 +26,8 @@ void init()
 	maxlength = 2;	// Must be at least same as minlength

 	# UTF-8 representation is up to 3x the character length
-	if (maxlength * 3 > maxlen)
-		maxlength = (maxlen + 2) / 3;
+	if (maxlength * 3 > cipher_limit)
+		maxlength = (cipher_limit + 2) / 3;
 /*
  * This defines the character set. This is auto-generated from
UnicodeData.txt
  * and we skip control characters.
diff --git a/run/dumb32.conf b/run/dumb32.conf
index 0720703..5ae94bc 100644
--- a/run/dumb32.conf
+++ b/run/dumb32.conf
@@ -26,8 +26,8 @@ void init()
 	maxlength = 2;	// Must be at least same as minlength

 	# UTF-8 representation is up to 3x the character length
-	if (maxlength * 3 > maxlen)
-		maxlength = (maxlen + 2) / 3;
+	if (maxlength * 3 > cipher_limit)
+		maxlength = (cipher_limit + 2) / 3;
 /*
  * This defines the character set. This is auto-generated from
UnicodeData.txt
  * and we skip control characters.
diff --git a/run/john.conf b/run/john.conf
index f7cb9fe..0253471 100644
--- a/run/john.conf
+++ b/run/john.conf
@@ -1225,13 +1225,13 @@ void generate()

 	c = minc;

-	// "maxlen" is a new predefined variable, see ../doc/EXTERNAL
+	// "cipher_limit" is a new predefined variable, see ../doc/EXTERNAL
 	// john sets this variable to the maximum plaintext length
 	// of the format or to the length from --stdout[=LENGTH]
-	// Password candidates longer than "maxlen" would be cut to
-	// length "maxlen" anyway, so the external mode would produce
+	// Password candidates longer than "cipher_limit" would be cut to
+	// length "cipher_limit" anyway, so the external mode would produce
 	// duplicate password candidates if we didn't stop here.
-	if (++length > maxlen)
+	if (++length > cipher_limit)
 		c = 0; // Will NUL out the next "word" and thus terminate
 }

diff --git a/src/external.c b/src/external.c
index e030d6e..e02ccfa 100644
--- a/src/external.c
+++ b/src/external.c
@@ -33,7 +33,7 @@ unsigned int ext_flags = 0;
 static char *ext_mode;

 static c_int ext_word[PLAINTEXT_BUFFER_SIZE];
-c_int ext_abort, ext_status, ext_maxlen;
+c_int ext_abort, ext_status, ext_cipher_limit;

 static struct c_ident ext_ident_status = {
 	NULL,
@@ -47,13 +47,13 @@ static struct c_ident ext_ident_abort = {
 	&ext_abort
 };

-static struct c_ident ext_ident_maxlen = {
+static struct c_ident ext_ident_cipher_limit = {
 	&ext_ident_abort,
-	"maxlen",
-	&ext_maxlen
+	"cipher_limit",
+	&ext_cipher_limit
 };
 static struct c_ident ext_globals = {
-	&ext_ident_maxlen,
+	&ext_ident_cipher_limit,
 	"word",
 	ext_word
 };
@@ -115,11 +115,11 @@ int ext_has_function(char *mode, char *function)
 void ext_init(char *mode, struct db_main *db)
 {
 	if (db!= NULL && db->format != NULL) {
-		ext_maxlen = maxlen = db->format->params.plaintext_length;
+		ext_cipher_limit = maxlen = db->format->params.plaintext_length;
 		return;
 	}
 	else {
-		ext_maxlen = options.length;
+		ext_cipher_limit = options.length;
 	}

 	if (!(ext_source = cfg_get_list(SECTION_EXT, mode))) {
-- 
1.7.7.6

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.