[GH-ISSUE #2734] Support for Intel SHA extensions #1757

Closed
opened 2026-10-15 04:24:05 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @kholia on GitHub (Sep 7, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2734

References,

It seems that Intel Software Development Emulator can be used to development and testing.

intel-sha-extensions_1.zip <- code from Intel.

Originally created by @kholia on GitHub (Sep 7, 2017). Original GitHub issue: https://github.com/openwall/john/issues/2734 References, * https://software.intel.com/en-us/articles/intel-sha-extensions-implementations (has sample code) * https://en.wikipedia.org/wiki/Intel_SHA_extensions It seems that Intel Software Development Emulator can be used to development and testing. [intel-sha-extensions_1.zip](https://github.com/magnumripper/JohnTheRipper/files/1283939/intel-sha-extensions_1.zip) <- code from Intel.
bsakaguchi 2026-10-15 04:24:05 +07:00
Author
Owner

@magnumripper commented on GitHub (Sep 7, 2017):

"The SHA instructions are non-SIMD although they are defined with XMM width operands"

I had a look at this some time ago. As far as I understood it, the extensions are fast at producing a single SHA-1 or SHA-256 digest, as opposed to our current code producing eg. eight in parallel. At the time, my conclusion was we wouldn't gain anything (unless they are several times faster than our current code). I hope someone can prove me wrong!

<!-- gh-comment-id:327730389 --> @magnumripper commented on GitHub (Sep 7, 2017): "The SHA instructions are non-SIMD although they are defined with XMM width operands" I had a look at this some time ago. As far as I understood it, the extensions are fast at producing a single SHA-1 or SHA-256 digest, as opposed to our current code producing eg. eight in parallel. At the time, my conclusion was we wouldn't gain anything (unless they are several times faster than our current code). I hope someone can prove me wrong!
Author
Owner

@magnumripper commented on GitHub (Sep 7, 2017):

@solardiz do you have insights?

<!-- gh-comment-id:327731036 --> @magnumripper commented on GitHub (Sep 7, 2017): @solardiz do you have insights?
Author
Owner

@solardiz commented on GitHub (Sep 7, 2017):

It's hard to tell without testing on real hardware, including interleaving of several instances of SHA using those instructions and maybe our usual SIMD at once. We might gain something. Without access to hardware yet, we could review documentation for what uop port(s) those instructions are issued on - do they fully conflict with SIMD or not. Also need their latency & throughput numbers, to compare that against what we achieve with SIMD.

At four (SHA-1) or two (SHA-256) rounds per instructions and interleaving of several instances (to be friendly to CPU's pipelining), these might be competitive with AVX2 or AVX-512 even despite of computing fewer instances.

AMD Ryzen hardware is already available, cheaply. So maybe one of us should get a machine like that and try? Then we'll also need to try/tune on Intel, which might or might not require different tuning - interleaving factor and whether and how much SIMD to use as well.

Per http://instlatx64.atw.hu it looks like on Ryzen the 4 rounds of SHA-1 may only be issued once per 4 cycles, and the 2 rounds of SHA-256 only once per 2 cycles. If so, I wouldn't expect them to be useful for us on those CPUs unless we can efficiently interleave with SIMD.

<!-- gh-comment-id:327782805 --> @solardiz commented on GitHub (Sep 7, 2017): It's hard to tell without testing on real hardware, including interleaving of several instances of SHA using those instructions and maybe our usual SIMD at once. We _might_ gain something. Without access to hardware yet, we could review documentation for what uop port(s) those instructions are issued on - do they fully conflict with SIMD or not. Also need their latency & throughput numbers, to compare that against what we achieve with SIMD. At four (SHA-1) or two (SHA-256) rounds per instructions and interleaving of several instances (to be friendly to CPU's pipelining), these _might_ be competitive with AVX2 or AVX-512 even despite of computing fewer instances. AMD Ryzen hardware is already available, cheaply. So maybe one of us should get a machine like that and try? Then we'll also need to try/tune on Intel, which might or might not require different tuning - interleaving factor and whether and how much SIMD to use as well. Per http://instlatx64.atw.hu it looks like on Ryzen the 4 rounds of SHA-1 may only be issued once per 4 cycles, and the 2 rounds of SHA-256 only once per 2 cycles. If so, I wouldn't expect them to be useful for us on those CPUs unless we can efficiently interleave with SIMD.
Author
Owner

@magnumripper commented on GitHub (Sep 7, 2017):

This would be a great GSoC project, or the like.

<!-- gh-comment-id:327937257 --> @magnumripper commented on GitHub (Sep 7, 2017): This would be a great GSoC project, or the like.
Author
Owner

@solardiz commented on GitHub (May 25, 2024):

Closing this in favor of #5437.

<!-- gh-comment-id:2131313851 --> @solardiz commented on GitHub (May 25, 2024): Closing this in favor of #5437.
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#1757
No description provided.