Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 22 Jun 2015 16:26:11 +0300
From: Aleksey Cherepanov <lyosha@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: bitslice SHA-256

Manually written bitslice is unbelievable!

I did not look into code precisely, so the following may be
implemented already. I propose a change:

On Fri, May 29, 2015 at 06:35:29AM +0300, Solar Designer wrote:
> "So we can expect that bitslice SHA256 will be (79-62)/62 = 27% slower
> than normal SHA256"

SHA-256 does on each step:
h = g
g = f
f = e
e = d + t1
d = c
c = b
b = a
a = t1 + t2

I think 6 assignment may be replaced by an array and shifting pointer.

Values in variables abcdefgh:
abcdefgh - at the beginning of the first round,
TabcDefg - at the beginning of the second round,
 where T = t1 + t2, D = d + t1

Let's shift it 1 char right:
 abcdefgh
TabcDefg

Now it looks like 6 variables were not moved. Let's introduce an array
A. Then in code, replace variable 'a' with A[0], ..., 'h' with A[-7].
In the end of round, just do --A; . It needs more space for
intermediate variables because array shifts one way, but I guess it is
not a problem. Positions of variables in memory can be reversed to be
hgfedcba to allow ++A; and positive indexes.

It should remove 6 of 8 writes but add dereference op for all these
variables. Is it worth? What do you think?

Thanks!

-- 
Regards,
Aleksey Cherepanov

Powered by blists - more mailing lists

Your e-mail address:

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