Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specialize SIMD SHA-256 for half-length input, iterated hashing #5426

Open
solardiz opened this issue Jan 14, 2024 · 2 comments
Open

Specialize SIMD SHA-256 for half-length input, iterated hashing #5426

solardiz opened this issue Jan 14, 2024 · 2 comments

Comments

@solardiz
Copy link
Member

Implement changes to SIMD SHA-256 and to some formats that use it, similarly to what #5425 did for SHA-512.

@solardiz
Copy link
Member Author

solardiz commented Jan 14, 2024

Additionally, we should probably be able to assume element 14 is zero in more cases - also for full length single-block or last block input - since for the only/last block it's high 32 bits of length (or high 64 for SHA-512). However, that would be a separate flag and it'd probably only be worth the overhead when building a specialized version (so the overhead would be removed by the compiler).

@solardiz solardiz changed the title Specialize SIMD SHA-256 for elements 9 to 14 being all zeroes Specialize SIMD SHA-256 for half-length input, iterated hashing Jan 16, 2024
@solardiz
Copy link
Member Author

solardiz commented Jan 16, 2024

Looks like these formats/uses would benefit from half-length input iterated hashing:

keyring_fmt_plug.c:		SIMDSHA256body(keys, keys32, NULL, SSEi_MIXED_IN|SSEi_OUTPUT_AS_INP_FMT);
pkcs12_plug.c:			SIMDSHA256body(sse_buf, (uint32_t*)sse_buf, NULL, SSEi_MIXED_IN|SSEi_OUTPUT_AS_INP_FMT);
pwsafe_fmt_plug.c:			SIMDSHA256body(keys, keys32, NULL, SSEi_MIXED_IN|SSEi_OUTPUT_AS_INP_FMT);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant