RustCrypto / RustCrypto/sponges

keccak: AVX2/AVX512 optimizations

Open
#108 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
56
Forks
23
PR merge metrics
No merged PRs in 30d

Description

I was looking through XKCP (eXtended Keccak Code Package, https://github.com/XKCP/XKCP) at what optimized implementations they have available.

I noticed they did have intrinsics-based implementations available for AVX2, but they compute e.g. Keccak-p1600 with 2, 4, or 8-way parallelism:

https://github.com/XKCP/XKCP/blob/716f007dd73ef28d357b8162173646be574ad1b7/lib/low/KeccakP-1600-times4/AVX2/KeccakP-1600-times4-AVX2.c

There also appears to be a non-parallel intrinsics implementation for AVX-512:

https://github.com/XKCP/XKCP/blob/716f007dd73ef28d357b8162173646be574ad1b7/lib/low/KeccakP-1600/AVX512/C/KeccakP-1600-AVX512.c

However, the non-parallel implementation for AVX2 is ASM-only:

https://github.com/XKCP/XKCP/blob/716f007dd73ef28d357b8162173646be574ad1b7/lib/low/KeccakP-1600/AVX2/KeccakP-1600-AVX2.s

See also the ARMv8 FEAT_SHA3 extensions: #93.

I'm not sure if this is because an intrinsics-based implementation doesn't make sense due to the need for a precisely designed register schedule, or because someone hasn't done the work yet to implement it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the referenced XKCP implementations: KeccakP-1600-times4-AVX2.c, KeccakP-1600-AVX512.c, and KeccakP-1600-AVX2.s. Compare them with the repository’s current Keccak implementation, then establish whether AVX2 and AVX512 support is practical; done requires a resolved implementation direction and corresponding optimization work or documented rationale.

Written by the indexing model from the issue text.

Assessment

Domain
cryptography, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.