Operators#
cuPQC-Hash operators are used to describe the hash operation to be performed and configure execution.
They are combined via addition (+) to form a cuPQC-Hash descriptor.
Description Operators#
Algorithm#
Sets the algorithm Alg to use. Valid values are:
-
enum algorithm#
-
-
enumerator SHA2_32#
SHA-2 32-bit word size hash functions (FIPS-180-4)
-
enumerator SHA2_64#
SHA-2 64-bit word size hash functions (FIPS-180-4)
-
enumerator POSEIDON2#
Poseidon2 hash functions
-
enumerator SHA2_32#
There is no default value.
SecurityCategory#
-
template<unsigned int Category>
SecurityCategory()#
Sets the NIST security category, which determines the parameter set of the algorithm to be used.
The valid values of Category depend on the value of the Algorithm operator.
Poseidon2 does not require a security category.
There is no default value.
Hash Family |
Name |
Alias |
||
|---|---|---|---|---|
SHA-2 |
SHA2-224 |
|
|
|
SHA2-256 |
|
|
||
SHA2-384 |
|
|
||
SHA2-512 |
|
|
||
SHA2-512/224 |
|
|
||
SHA2-512/256 |
|
|
||
SHA-3 |
SHA3-224 |
|
|
|
SHA3-256 |
|
|
||
SHA3-384 |
|
|
||
SHA3-512 |
|
|
||
SHAKE |
SHAKE-128 |
|
|
|
SHAKE-256 |
|
|
Description Operators - Poseidon2 Specific#
The Poseidon2 hash function operates over prime fields. Two fields are currently supported:
BabyBear: 231 - 227 + 1 (BabyBear constants)
KoalaBear: 231 - 224 + 1 (KoalaBear constants)
The constants pages provide the round constants and Maximum Distance Separable (MDS) matrix for each field.
Field#
-
template<field Field>
Field()#
Sets the prime field over which the Poseidon2 function operates.
Supported values: BabyBear, KoalaBear
Default: BabyBear
Width#
-
template<unsigned int Width>
Width()#
Sets the width (state size) of the Poseidon2 function.
Supported values: 16, 24
Default: 16
Capacity#
-
template<unsigned int Capacity>
Capacity()#
Sets the capacity of the Poseidon2 sponge construction.
Supported values: 8
Default: 8
Supported Configurations#
The following table shows all valid parameter combinations:
Name |
Full Rounds |
Partial Rounds |
Sbox |
Alias |
|||
|---|---|---|---|---|---|---|---|
BabyBear-16 |
|
|
|
|
|
x7 |
|
BabyBear-24 |
|
|
|
|
|
x7 |
|
KoalaBear-16 |
|
|
|
|
|
x3 |
|
KoalaBear-24 |
|
|
|
|
|
x3 |
|
Prime moduli: BabyBear = 231 - 227 + 1, KoalaBear = 231 - 224 + 1
Execution Operators#
Thread execution#
-
Thread()#
Specifies that the operator will execute independently for each thread.
Warp execution#
-
Warp()#
Specifies that the operator will execute on each CUDA warp (group of 32 threads). The device methods should be called with the same arguments for all threads in the warp.
Only the algorithm::SHA3 and algorithm::SHAKE algorithms are supported for this execution mode.