mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1749] Introduce AVX-512's ternary logic instruction #1157
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#1157
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lei-april on GitHub (Sep 11, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1749
Originally assigned to: @lei-april on GitHub.
Theoretically, all 3-argument operations like
SHA1_I()can be implemented with just one ternary logic instruction.However, one thing that bothers me a bit is that simd-intrinsics.c might eventually be bloated with things like
#if ... #else ... #endif, which I (we) wish to appear only in pseudo-intrinsics.h.@magnumripper commented on GitHub (Sep 11, 2015):
I see what you mean but I think it's the right thing for now. Compare with HAVE_ANDNOT or whatever it was we just introduced. We need to do it that way unless we want to move things like MD4_F into pseudo-intrinsics.h (and that would not make sense).
If you come up with a better idea I'm all ears though!
@magnumripper commented on GitHub (Sep 12, 2015):
So what is this, bitselect() on acid? Oh, it's like LOP3.LUT... So can we implement any MD4/5/SHA function using a single instruction?
Note to self: http://wm.ite.pl/articles/avx512-ternary-functions.html
@magnumripper commented on GitHub (Sep 12, 2015):
I can't find it in https://software.intel.com/sites/landingpage/IntrinsicsGuide
@magnumripper commented on GitHub (Sep 12, 2015):
https://software.intel.com/en-us/node/523807
@lei-april commented on GitHub (Sep 12, 2015):
Not necessarily. But at least they can be compacted to use much fewer instructions.
@magnumripper commented on GitHub (Sep 12, 2015):
But if the function is
F(x, y, z)it should always be implementable with a single instruction, no? You'd just need a trivial tool to find out the truth table.@magnumripper commented on GitHub (Sep 12, 2015):
OK, not if there are bit shifts within the function of course. But as long as there's only and, or, not and so on, in any combination.
@lei-april commented on GitHub (Sep 12, 2015):
I have a question regarding to the code: what's the difference between
MD5_H()andMD5_H2()? It seems to me they are doing the same thing, i.e.x^y^z.Then why are the operands written in different orders?
@magnumripper commented on GitHub (Sep 12, 2015):
They are originally like this
If you expand that, you'll see that we do
a ^ btwice (order doesn't matter forx ^ y ^ z). So with this optimization we store the result from the first and re-use it. Obviously we need to have a spare register at hand for it to be any net gain.@magnumripper commented on GitHub (Sep 12, 2015):
BTW for plain scalar C, we just do it like this. It merely hints to the optimizer that it should do the same thing (and a good optimizer might see it anyway):
@lei-april commented on GitHub (Sep 13, 2015):
I'm using this command:
./configure CC="gcc-5 -mavx512f" --host=x86_64-linux, but it still got configured as AVX2. OTOH, using./configure CC="icc -xCOMMON-AVX512" --host=x86_64-linux, it's configured correctly as AVX512F.Any hint about this?
@magnumripper commented on GitHub (Sep 13, 2015):
When I tried a while ago, gcc could produce the assembler but as(1) didn't understand the new instructions. Maybe this is the case here for you?
@lei-april commented on GitHub (Sep 14, 2015):
Oh, I figured it out. When compiling some non-AVX512 test code in ./configure, gcc generated code that can execute natively. Although I used
--host=x86_64-linux, it's still not configured as cross-compiling.OTOH, when compiling the same test code, icc emitted some AVX512 instructions in the generated code, which cannot run natively. So ./configure correctly recognized it as cross-compiling.
Is there a way that I can force ./configure to cross-compile?
@magnumripper commented on GitHub (Sep 14, 2015):
--disable-native-tests should fix that
@lei-april commented on GitHub (Sep 14, 2015):
Oh, thanks! That's exactly what I'm looking for.
@magnumripper commented on GitHub (Sep 14, 2015):
Done in #1762. Good stuff!