Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 08 Jun 2012 09:22:30 +0200
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: Re: rawSHA1_LI internals

On 06/08/2012 09:11 AM, magnum wrote:
> BTW Jim, I'm just now comparing rawSHA1_fmt_plug.c and
> rawSHA1_LinkedIn_fmt_plug.c using meld. I notice cmp_all() is unchanged.
> I must be missing something, how can this work? We should only look at
> binary[1] but as far as I can see this is not the case. I know the code
> works, but how!?
>
> Also, I really think half of the self-tests should have the zeroed bits.

Here is a patch that does what I mean. I just don't understand how it 
can possibly work without this patch. BTW the new self-tests fails 
unless this is done to cmp_all().

magnum

>From e24ba45b2c10b77e74100f6dd9d7acd93b61a2be Mon Sep 17 00:00:00 2001
From: magnum <john.magnum@...hmail.com>
Date: Fri, 8 Jun 2012 09:20:28 +0200
Subject: [PATCH] raw-sha1_li: self-tests and modified cmp_all()

---
 src/rawSHA1_LinkedIn_fmt_plug.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/rawSHA1_LinkedIn_fmt_plug.c b/src/rawSHA1_LinkedIn_fmt_plug.c
index 12a9f60..085fa0b 100644
--- a/src/rawSHA1_LinkedIn_fmt_plug.c
+++ b/src/rawSHA1_LinkedIn_fmt_plug.c
@@ -68,13 +68,14 @@
 #endif
 
 static struct fmt_tests rawsha1_tests[] = {
-	{"c3e337f070b64a50e9d31ac3f9eda35120e29d6c", "digipalmw221u"},
+	{"000007f070b64a50e9d31ac3f9eda35120e29d6c", "digipalmw221u"},
 	{"2fbf0eba37de1d1d633bc1ed943b907f9b360d4c", "azertyuiop1"},
-	{FORMAT_TAG "A9993E364706816ABA3E25717850C26C9CD0D89D", "abc"},
+	{FORMAT_TAG "00000E364706816ABA3E25717850C26C9CD0D89D", "abc"},
 	{"f879f8090e92232ed07092ebed6dc6170457a21d", "azertyuiop2"},
-	{"1813c12f25e64931f3833b26e999e26e81f9ad24", "azertyuiop3"},
+	{"0000012f25e64931f3833b26e999e26e81f9ad24", "azertyuiop3"},
 	{"095bec1163897ac86e393fa16d6ae2c2fce21602", "7850"},
-	{"dd3fbb0ba9e133c4fd84ed31ac2e5bc597d61774", "7858"},
+	{"00000c1163897ac86e393fa16d6ae2c2fce21602", "7850"},
+	{"00000b0ba9e133c4fd84ed31ac2e5bc597d61774", "7858"},
 	{NULL}
 };
 
@@ -201,12 +202,12 @@ static int rawsha1_cmp_all(void *binary, int count) {
 #endif
 	for(x=0;x<MMX_COEF;x++)
 	{
-		if( ((unsigned int *)binary)[0] == crypt_key[x+y*MMX_COEF*5] )
+		if( ((unsigned int *)binary)[1] == crypt_key[x+y*MMX_COEF*5+MMX_COEF] )
 			return 1;
 	}
 	return 0;
 #else
-	return !memcmp(binary, crypt_key, BINARY_SIZE);
+	return !memcmp(binary[1], crypt_key, BINARY_SIZE - 4);
 #endif
 }
 
-- 
1.7.9.5


Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ