cuPQC-Hash: Cryptographic Hash Functions#
The cuPQC-Hash library provides GPU-optimized implementations of cryptographic hash functions designed for direct integration into CUDA kernels. As a device-side library, cuPQC-Hash enables you to perform hashing operations within your kernels, eliminating data movement overhead and maximizing throughput.
Supported Hash Functions#
The cuPQC-Hash library supports a comprehensive range of cryptographic hash functions including SHA-2, SHA-3, SHAKE, and Poseidon2 variants.
Family |
Algorithms |
Output size |
|---|---|---|
SHA-2 |
|
|
SHA-2 truncated |
|
512-bit computation, digest truncated to the second number. |
SHA-3 |
|
|
SHAKE |
|
Any length (XOF) Requested per call, in bytes. |
Poseidon2 |
|
Any number of field elements Each element is a |
Supported Merkle Tree Configurations#
The cuPQC-Hash library provides two distinct computation modes optimized for different use cases:
Single-Block Mode (High Throughput): One thread block computes one complete Merkle tree. This mode enables efficient batching where multiple trees can be calculated in parallel across different blocks, maximizing throughput for applications that need to compute many independent Merkle trees.
Multi-Block Mode (Low Latency): Multiple thread blocks collaborate to compute a single large Merkle tree by generating subtrees that are combined. This parallel approach reduces latency for computing individual large trees by leveraging more GPU resources simultaneously.
Both modes require power-of-two leaf counts. Single-block mode completes the Merkle reduction with Generate Tree (Generate Subtree is not used in this mode). Multi-block mode uses Generate Subtree to create subtrees, then Generate Tree over the subtree roots to finish the tree (two successive kernel calls that typically lower latency on large trees).
Notation for N and M
N, total tree size (power-of-two).M, multi-block subtree leaf count (power-of-two).
For each mode, the table below gives the supported tree and subtree sizes together with the size parameter that each Merkle device function expects. A dash marks a column that does not apply to the mode.
Mode |
Supported sizes (# of leaves) |
Size parameter consumed by |
||||
|---|---|---|---|---|---|---|
Tree |
Subtree |
|||||
Single |
|
— |
|
— |
|
|
Multi |
|
|
|
|
|
|
Supported Merkle Tree Hash Functions#
The following hash algorithms are supported for Merkle Tree operations, with their respective I/O data types:
Family |
Algorithms |
Precision |
|---|---|---|
SHA-2 |
|
Byte-oriented input. |
SHA-3 |
|
|
SHAKE |
|
|
Poseidon2 |
|
Field elements. |
Key Features#
High Performance: GPU-optimized implementations with batched operations for high throughput and GPU utilization.
Merkle Tree Support: High-performance Merkle Tree API for efficient proof generation and verification, compatible with supported hash functions.
Flexible Merkle Tree Modes: Choose between single-block mode for high-throughput batch processing of multiple trees, or multi-block mode for low-latency computation of individual large trees.
Algorithm Coverage: NIST-standardized SHA-2, SHA-3, and SHAKE for traditional cryptographic applications, alongside Poseidon2 for zero-knowledge proof systems.