[GH-ISSUE #1712] keccak (sha3) do we have SIMD code? #1127

Closed
opened 2026-10-14 03:35:59 +07:00 by bsakaguchi · 11 comments
Owner

Originally created by @jfoug on GitHub (Aug 27, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1712

Originally assigned to: @kholia on GitHub.

If not, then why do all of those raw formats list SIMD for the algorithm ?

Originally created by @jfoug on GitHub (Aug 27, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1712 Originally assigned to: @kholia on GitHub. If not, then why do all of those raw formats list SIMD for the algorithm ?
bsakaguchi 2026-10-14 03:35:59 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@magnumripper commented on GitHub (Aug 27, 2015):

I thought they had their own SIMD (like Blake), supporting up to AVX (not AVX2), and not using our pseudo-intrinsics (so no Altivec/ARM NEON). But now that I look at Keccak files they seem to be totally lying about any and all SIMD support.

<!-- gh-comment-id:135474145 --> @magnumripper commented on GitHub (Aug 27, 2015): I thought they had their own SIMD (like Blake), supporting up to AVX (not AVX2), and not using our pseudo-intrinsics (so no Altivec/ARM NEON). But now that I look at Keccak files they seem to be totally lying about any and all SIMD support.
Author
Owner

@jfoug commented on GitHub (Aug 27, 2015):

That is why I asked the question. It appears that there are only AVX/XOP define looking to make the strings listing that these are supported, but I saw NOTHING in code about SIMD usage.

Yes, it is lying to us, lol

<!-- gh-comment-id:135475200 --> @jfoug commented on GitHub (Aug 27, 2015): That is why I asked the question. It appears that there are only AVX/XOP define looking to make the strings listing that these are supported, but I saw NOTHING in code about SIMD usage. Yes, it is lying to us, lol
Author
Owner

@jfoug commented on GitHub (Aug 27, 2015):

Btw, I found this since I am adding SHA3 into dynamic. Without having SIMD, the code generated and put into dynamic_big_crypt.c is simpler

<!-- gh-comment-id:135475838 --> @jfoug commented on GitHub (Aug 27, 2015): Btw, I found this since I am adding SHA3 into dynamic. Without having SIMD, the code generated and put into dynamic_big_crypt.c is simpler
Author
Owner

@magnumripper commented on GitHub (Aug 27, 2015):

See also #1216 (which was assuming there actually was some SIMD code in it)

<!-- gh-comment-id:135476433 --> @magnumripper commented on GitHub (Aug 27, 2015): See also #1216 (which was assuming there actually was some SIMD code in it)
Author
Owner

@magnumripper commented on GitHub (Aug 27, 2015):

Note though that wherever @kholia got the code, I'm pretty sure there are SIMD versions too. So maybe we should fix this prior to you including it in dynamic?

<!-- gh-comment-id:135476684 --> @magnumripper commented on GitHub (Aug 27, 2015): Note though that wherever @kholia got the code, I'm pretty sure there are SIMD versions too. So maybe we should fix this prior to you including it in dynamic?
Author
Owner

@jfoug commented on GitHub (Aug 27, 2015):

It is easy to re-gen later, with SIMD. Well, possibly not, if it is not using our SIMD 'interface'. If it is a total stand alone interface, then it may have to be done outside of generated code.

<!-- gh-comment-id:135477437 --> @jfoug commented on GitHub (Aug 27, 2015): It is easy to re-gen later, with SIMD. Well, possibly not, if it is not using our SIMD 'interface'. If it is a total stand alone interface, then it may have to be done outside of generated code.
Author
Owner

@jfoug commented on GitHub (Aug 27, 2015):

With the recent changes to dyna, it really is only a few hours work to get a new hash installed. I am doing these:

SHA3-224
SHA3-256
SHA3-384
SHA3-512
KECCAK-256 (not sure these 2)
KECCAK-512 (are really useful)

I might look at SHAKE128 and SHAKE256 if they are applicable.

So far, the total change is a few lines in dynamic_big_crypt.cin (include and some defines), and 6 lines added to dynamic_big_crypt_generator.sh

<!-- gh-comment-id:135478321 --> @jfoug commented on GitHub (Aug 27, 2015): With the recent changes to dyna, it really is only a few hours work to get a new hash installed. I am doing these: SHA3-224 SHA3-256 SHA3-384 SHA3-512 KECCAK-256 (not sure these 2) KECCAK-512 (are really useful) I might look at SHAKE128 and SHAKE256 if they are applicable. So far, the total change is a few lines in dynamic_big_crypt.cin (include and some defines), and 6 lines added to dynamic_big_crypt_generator.sh
Author
Owner

@magnumripper commented on GitHub (Aug 28, 2015):

Dang, now that I'm so used to the Merkel Damgard buffer, how can I learn Keccak? Note to self: http://keccak.noekeon.org is a good page.

I wonder how Keccak will fit a GPU?

<!-- gh-comment-id:135622043 --> @magnumripper commented on GitHub (Aug 28, 2015): Dang, now that I'm so used to the Merkel Damgard buffer, how can I learn Keccak? Note to self: http://keccak.noekeon.org is a good page. I wonder how Keccak will fit a GPU?
Author
Owner

@magnumripper commented on GitHub (Aug 28, 2015):

SHA-3 is an instance of Keccak, right? Like "Keccak-f[1600]" or something like that. Is that it, or is it more to SHA-3?

<!-- gh-comment-id:135622166 --> @magnumripper commented on GitHub (Aug 28, 2015): SHA-3 is an instance of Keccak, right? Like "Keccak-_f_[1600]" or something like that. Is that it, or is it more to SHA-3?
Author
Owner

@magnumripper commented on GitHub (Aug 28, 2015):

Apparently, PBKDF2-HMAC-SHA3 does not make sense. It will be just PBKDF2-SHA3.

<!-- gh-comment-id:135622304 --> @magnumripper commented on GitHub (Aug 28, 2015): Apparently, PBKDF2-HMAC-SHA3 does not make sense. It will be just PBKDF2-SHA3.
Author
Owner

@jfoug commented on GitHub (Aug 28, 2015):

Dang, now that I'm so used to the Merkel Damgard buffer, how can I learn Keccak? Note to self: http://keccak.noekeon.org is a good page.

This is the first non MD I have worked with either (other than encryption, des/aes, etc).

sha3 is simply keccak-512 but the block padding is a 6 vs a 1 (at least I think that is the only diff). I read up an hour or so on keccak last nite trying to figure shit out. I could not find ANY online calcs that would do SHA3 properly. They would always give me keccak-512 (or 256).

The only thing different about Keccak-512 and SHA3-512 is the call to keccak_init. One passes in a 1, one a 6.

Look at the top of dynamic_compiler. I have some macros. The init is quite a bit different than for a MD. For keccak, you pass in several other parameters that adjust the soak up and squeeze out rates (and sizes), and final bit sizes, etc. But things like the update are simply the same call for 'all' flavors.

Yes, I am not sure what we are doing on this one for SIMD. We may not be able to interleave the same way we do for MD's, I am not sure.

<!-- gh-comment-id:135623302 --> @jfoug commented on GitHub (Aug 28, 2015): > Dang, now that I'm so used to the Merkel Damgard buffer, how can I learn Keccak? Note to self: http://keccak.noekeon.org is a good page. This is the first non MD I have worked with either (other than encryption, des/aes, etc). sha3 is simply keccak-512 but the block padding is a 6 vs a 1 (at least I think that is the only diff). I read up an hour or so on keccak last nite trying to figure shit out. I could not find ANY online calcs that would do SHA3 properly. They would always give me keccak-512 (or 256). The only thing different about Keccak-512 and SHA3-512 is the call to keccak_init. One passes in a 1, one a 6. Look at the top of dynamic_compiler. I have some macros. The init is quite a bit different than for a MD. For keccak, you pass in several other parameters that adjust the soak up and squeeze out rates (and sizes), and final bit sizes, etc. But things like the update are simply the same call for 'all' flavors. Yes, I am not sure what we are doing on this one for SIMD. We may not be able to interleave the same way we do for MD's, I am not sure.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1127
No description provided.