[GH-ISSUE #1523] Reverse steps in shared SIMD functions #994

Closed
opened 2026-10-14 03:31:13 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @magnumripper on GitHub (Jul 9, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1523

Originally assigned to: @magnumripper on GitHub.

Since 6a0f06466 we have a SSEi_REVERSE_STEPS flag for our shared primary hash functions. For MD4 it's real reversing of steps, and used in the NT format. It does exactly the same reversing as Alain's NT assembler format. For MD5, SHA1 and SHA2 formats, it merely skips the final addition of constants. At least MD5 can be reversed a bit too.

  • MD4 function
  • raw-md4 format
  • NT format
  • MD5 function
  • raw-md5 format
  • SHA1 function
  • raw-sha1 format
  • raw-sha1-linkedin format
  • MSSQL format
  • MSSQL05 format
  • SHA256 function
  • raw-sha224 format
  • raw-sha256 format
  • SHA512 function
  • raw-sha384 format
  • raw-sha512 format
  • MSSQL12 format
Originally created by @magnumripper on GitHub (Jul 9, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1523 Originally assigned to: @magnumripper on GitHub. Since 6a0f06466 we have a SSEi_REVERSE_STEPS flag for our shared primary hash functions. For MD4 it's real reversing of steps, and used in the NT format. It does exactly the same reversing as Alain's NT assembler format. For MD5, SHA1 and SHA2 formats, it merely skips the final addition of constants. At least MD5 can be reversed a bit too. - [x] MD4 function - [x] raw-md4 format - [x] NT format - [x] MD5 function - [x] raw-md5 format - [x] SHA1 function - [x] raw-sha1 format - [x] raw-sha1-linkedin format - [x] MSSQL format - [x] MSSQL05 format - [x] SHA256 function - [x] raw-sha224 format - [x] raw-sha256 format - [x] SHA512 function - [x] raw-sha384 format - [x] raw-sha512 format - [x] MSSQL12 format
bsakaguchi 2026-10-14 03:31:13 +07:00
Author
Owner

@jfoug commented on GitHub (Jul 17, 2015):

I changed the dyna to not do this. I really do not see this as a viable option in dyna. It would add a major complexity issue, and for what ROI? Already dyna is NOT the fastest horse in the stable, no matter what, since there is other overhead involved. So making an already slower format a little faster but still slower is not really worth it, especially if it opens up another set of instability issues and drags on any form of forward development until these new issues are addressed.

I have 'commented it out'. It no longer shows on the count of todo items.

<!-- gh-comment-id:122404512 --> @jfoug commented on GitHub (Jul 17, 2015): I changed the dyna to not do this. I really do not see this as a viable option in dyna. It would add a major complexity issue, and for what ROI? Already dyna is NOT the fastest horse in the stable, no matter what, since there is other overhead involved. So making an already slower format a little faster but still slower is not really worth it, especially if it opens up another set of instability issues and drags on any form of forward development until these new issues are addressed. I have 'commented it out'. It no longer shows on the count of todo items.
Author
Owner

@magnumripper commented on GitHub (Jul 17, 2015):

Yeah that makes sense. And the SHA2 formats that remain will probably show insignificant gain. The real win here was the NT format. The recent AVX2 support was a major blow to Alain's format (now "nt-old") and this fix was another one: Now the intrinsics NT format should be faster on any SSE2 or better build.

<!-- gh-comment-id:122429627 --> @magnumripper commented on GitHub (Jul 17, 2015): Yeah that makes sense. And the SHA2 formats that remain will probably show insignificant gain. The real win here was the NT format. The recent AVX2 support was a major blow to Alain's format (now "nt-old") and this fix was another one: Now the intrinsics NT format should be faster on any SSE2 or better build.
Author
Owner

@magnumripper commented on GitHub (Jul 17, 2015):

Damn, I just tested a build with only SSE2 and Alain's format is still 2.5% faster than the intrinsics one. Probably due to the stacks of if that handles all SSEi flags... But when building with AVX we outrun it anyway and with AVX2 we obviously run in circles around it.

<!-- gh-comment-id:122430914 --> @magnumripper commented on GitHub (Jul 17, 2015): Damn, I just tested a build with only SSE2 and Alain's format is still 2.5% faster than the intrinsics one. Probably due to the stacks of `if` that handles all SSEi flags... But when building with AVX we outrun it anyway and with AVX2 we obviously run in circles around it.
Author
Owner

@magnumripper commented on GitHub (Jul 24, 2015):

48c80a4 improves SHA1 reversing for a 5% boost.

<!-- gh-comment-id:124694103 --> @magnumripper commented on GitHub (Jul 24, 2015): 48c80a4 improves SHA1 reversing for a 5% boost.
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#994
No description provided.