Discussion:
SHA parallel computation
(too old to reply)
Tadas Vilkeliskis
2008-10-14 04:57:58 UTC
Permalink
Raw Message
Hi, guys!

I am trying to implement SHA-256 on GPU using CUDA. And I want each
thread to compute hash for one block or data chunk at a time and store
the hashes in scratch space. After all threads finished their work I
want to compute final hash from these partial hashes. Is it possible
to do this? I have heard something about sliding windows or direct
hashing, I am not sure, where such technique is used, however I can't
find any documentation. So, what I am trying to do now is this:

1) I have message
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" no quotes.
2) I pad the message and get two blocks:

First block:
61626364 62636465 63646566 64656667
65666768 66676869 6768696a 68696a6b
696a6b6c 6a6b6c6d 6b6c6d6e 6c6d6e6f
6d6e6f70 6e6f7071 80000000 00000000

Second block:
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 000001c0

3) One thread computes hash for the first block, and other one - for
the second one. I get these hashes:

For first block:
85e655d6 417a1795 3363376a 624cde5c 76e09589 cac5f811 cc4b32c1
f20e533a

For second block:
e6adb3eb 2ca8536c 0ac33f32 18c66976 541f8f09 8ade1563 4282fc17
4a3de2e6

So, is it possible to get final hash from these two hashes. Final hash
for the message above is

248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4
19db06c1

Maybe I am doing something wrong, maybe I should split the given
message into smaller ones or something similar, because I want to
process given message with multiple threads at a time. Thank you.

Tadas Vilkeliskis
Greg Rose
2008-10-15 10:38:15 UTC
Permalink
Raw Message
Post by Tadas Vilkeliskis
Hi, guys!
I am trying to implement SHA-256 on GPU using CUDA. And I want each
thread to compute hash for one block or data chunk at a time and store
the hashes in scratch space. After all threads finished their work I
want to compute final hash from these partial hashes. Is it possible
to do this? I have heard something about sliding windows or direct
hashing, I am not sure, where such technique is used, however I can't
1) I have message
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" no quotes.
61626364 62636465 63646566 64656667
65666768 66676869 6768696a 68696a6b
696a6b6c 6a6b6c6d 6b6c6d6e 6c6d6e6f
6d6e6f70 6e6f7071 80000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 000001c0
3) One thread computes hash for the first block, and other one - for
85e655d6 417a1795 3363376a 624cde5c 76e09589 cac5f811 cc4b32c1
f20e533a
e6adb3eb 2ca8536c 0ac33f32 18c66976 541f8f09 8ade1563 4282fc17
4a3de2e6
So, is it possible to get final hash from these two hashes. Final hash
for the message above is
248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4
19db06c1
Maybe I am doing something wrong, maybe I should split the given
message into smaller ones or something similar, because I want to
process given message with multiple threads at a time. Thank you.
As has already been said in sci.crypt, this can't
be done with the Davies-Meyer style of chained
hash functions, like SHA-256. There is no known
way to "correct" the second block to compensate
for the different input chaining variable.

Greg.
--
Greg Rose
232B EC8F 44C6 C853 D68F E107 E6BF CD2F 1081 A37C
Qualcomm Australia: http://www.qualcomm.com.au

Loading...