This research paper, titled "Maximizing the Potential of Custom RISC-V Vector Extensions for Speeding up SHA-3 Hash Functions," presents a novel approach to accelerating one of the most critical cryptographic building blocks in modern security.
TL;DR
The authors propose ten custom RISC-V vector instructions specifically designed to parallelize the Keccak-f[1600] permutation used in SHA-3. By implementing these extensions in a scalable SIMD processor, they achieved throughput gains of up to 45x over existing specialized architectures, making it a significant milestone for high-performance post-quantum cryptography.
What Problem Does This Paper Address?
SHA-3 (Secure Hash Algorithm-3) is a cornerstone of modern cryptography, particularly in the emerging field of Post-Quantum Cryptography (PQC). Algorithms like CRYSTALS-Kyber rely heavily on SHA-3 for generating seeds and hashes. However, SHA-3 is computationally expensive. It relies on the Keccak-f[1600] permutation, which operates on a massive 1,600-bit internal state.
Standard processors usually handle this state sequentially in 32-bit or 64-bit chunks, which creates a bottleneck. While parallelization is the obvious solution, standard Instruction Set Architectures (ISAs) lack the specific operations—like complex bit-rotations and 5x5 matrix shuffles—needed to handle Keccak efficiently in a vector (SIMD) pipeline. The authors set out to bridge this gap using the open-source flexibility of RISC-V.
Methods
The researchers designed a scalable SIMD RISC-V processor in SystemVerilog and introduced ten custom vector instructions tailored to the five "step mappings" of the Keccak permutation ($\theta, \rho, \pi, \chi, \iota$).
Key methodological highlights include:
- Architecture Support: They developed versions for both 32-bit and 64-bit architectures.
- Modulo-Five Vector Slides: Standard vector "slides" (moving data across registers) don't align with Keccak’s 5x5 lane structure. The authors created
vslidedownmandvslideupmto perform slides that respect the modulo-5 boundaries of the Keccak state. - Custom Rotations and Permutations: They implemented instructions like
v64rhoandvpito handle the complex bit-level rotations and lane shuffles that are notoriously slow in software. - Multi-State Parallelism: By leveraging the RISC-V Vector (RVV) "LMUL" (length multiplier) feature, they enabled the processor to handle up to six Keccak states simultaneously in the vector registers, drastically increasing throughput.
Datasets
As this is a hardware architecture and algorithm optimization paper, it does not use traditional "datasets." Instead, the researchers used:
- Standard Keccak-f[1600] Permutation: The core algorithm of SHA-3 as defined by NIST.
- Benchmarking References: They compared their results against several established academic and industrial designs, including LEON3, MIPS-based ASIPs (Application-Specific Instruction set Processors), and previous RISC-V accelerators like OASIP and DASIP.
Key Insights and Ideas
- The Power of Modulo-Five: The "aha moment" in this paper is the realization that standard SIMD shifts are inefficient for Keccak. By baking "modulo-five" logic directly into the vector slide instructions, they eliminated the need for expensive data-rearrangement code.
- Lane Splitting vs. Interleaving: For 32-bit systems, rather than using complex "bit-interleaving" (which makes the code incompatible with non-SHA-3 tasks), they opted to split 64-bit lanes into simple Most Significant Bit (MSB) and Least Significant Bit (LSB) parts. This maintained high performance while keeping the system flexible.
- Instruction Customization vs. Fusion: Unlike some designs that "fuse" multiple steps into one giant, inflexible instruction, the authors kept their ten instructions distinct. This allows for a more transparent vectorization process and easier integration into different cryptographic schemes.
Key Results
The custom extensions delivered dramatic performance improvements:
- 64-bit Performance: Their design achieved a throughput of 5,073.00 × 10⁻³ bits/cycle, outperforming previous vector-processing units by a factor of 5.3x.
- 32-bit Performance: Compared to the MIPS Co-processor ISE, their 32-bit architecture was 45.7x faster in terms of throughput.
- Efficiency: Even when accounting for the hardware area (slices), the "Throughput/Area" metric showed that their 64-bit design was significantly more efficient than all related work.
- Latency: The execution time for a single Keccak round was reduced to just 75 cycles (64-bit) and 147 cycles (32-bit).
Limitations and Future Work
The authors noted a few areas for further exploration:
- Operation Fusion: While they avoided fusing operations to keep the design simple and modular, they admit that fusing the $\rho$ and $\pi$ steps could yield even higher speeds.
- Full PQC Integration: The current work focuses on the SHA-3 component. The next step is to integrate these instructions into full PQC implementations like CRYSTALS-Kyber and Dilithium to measure the "end-to-end" speedup for a complete cryptographic handshake.
- Compiler Support: The current implementation requires manual assembly or intrinsic calls; developing automated compiler support for these custom RISC-V extensions would make them more accessible to developers.
Summary updated