Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 13 Nov 2007 00:07:27 +0300
From: Solar Designer <solar@...nwall.com>
To: john-users@...ts.openwall.com
Subject: Re: bitslice MD5

On Mon, Nov 12, 2007 at 07:00:21AM +0300, Solar Designer wrote:
> I've attached my proof-of-concept bitslice implementation of the MD5
> compression function.  Very recent versions of gcc are able to
> meaningfully compile this into SSE2 code (and likely AltiVec as well,
> but I have not tested that).  The performance is not impressive, but
> there's lots of room for improvement.

I've modified the code a bit to illustrate a possible area for further
improvement.  Specifically, I've combined add32() and rol32() into a new
function, add32r().  The new revision of md5slice.c is attached, as well
as a diff relative to the previous revision.

> On Athlon64 3200+ (2.0 GHz) running Linux/x86-64 (Owl-current), I get:
...
> amd!solar:~/md5slice$ PATH=~/gcc-4.1.0/bin:$PATH gcc md5slice.c -o md5slice -Wall -s -O3 -fomit-frame-pointer -funroll-loops -DVECTOR
> amd!solar:~/md5slice$ time ./md5slice
> vector size = 128 bits
> c09c4c1f 21876746 18aed2 70b452f0
> 
> real    0m0.388s
> user    0m0.390s
> sys     0m0.000s

The new revision is about 5% faster:

real    0m0.367s
user    0m0.360s

Combining all three add32*() functions into one (with more complicated
logic) might improve performance further, especially on CPUs with lots
of registers.

-- 
Alexander Peslyak <solar at openwall.com>
GPG key ID: 5B341F15  fp: B3FB 63F4 D7A3 BCCC 6F6E  FC55 A2FC 027C 5B34 1F15
http://www.openwall.com - bringing security into open computing environments

View attachment "md5slice.c" of type "text/plain" (7941 bytes)

View attachment "md5slice-add32r.diff" of type "text/plain" (1056 bytes)

-- 
To unsubscribe, e-mail john-users-unsubscribe@...ts.openwall.com and reply
to the automated confirmation request that will be sent to you.

Powered by blists - more mailing lists

Your e-mail address:

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