myl7/fss 2.0.0
Function secret sharing (FSS) primitives including distributed point/comparison function (DPF/DCF)
Loading...
Searching...
No Matches
fss::hash::Blake3 Class Reference

BLAKE3 keyed hash (CPU+GPU). More...

Public Member Functions

 Blake3 (cuda::std::span< const int4, 2 > iv)
 Constructor.
cuda::std::array< int4, 2 > Hash (cuda::std::span< const int4, 4 > msg)
 Hash a 64B message.
cuda::std::array< int4, 4 > Hash (cuda::std::tuple< int4, const int4 > msg)
 Hash a 128+127-bit logical message into two 32B digests.
cuda::std::array< cuda::std::array< int4, 2 >, 4 > Hash4 (cuda::std::span< const cuda::std::array< int4, 4 >, 4 > msgs)
 Hash four 64B messages.

Detailed Description

BLAKE3 keyed hash (CPU+GPU).

The IV replaces BLAKE3's standard IV in keyed-hash mode. The KEYED_HASH flag is set on all compression calls.

Constructor & Destructor Documentation

◆ Blake3()

fss::hash::Blake3::Blake3 ( cuda::std::span< const int4, 2 > iv)
inlineexplicit

Constructor.

Parameters
ivCustom IV (2 int4s = 32B) replacing BLAKE3's standard IV in keyed-hash mode. Stored by value.

Member Function Documentation

◆ Hash() [1/2]

cuda::std::array< int4, 2 > fss::hash::Blake3::Hash ( cuda::std::span< const int4, 4 > msg)
inline

Hash a 64B message.

Single BLAKE3 compression: h=iv_, m=msg, counter=0, block_len=64. flags = CHUNK_START | CHUNK_END | ROOT | KEYED_HASH (0x1B).

Parameters
msg4 int4 blocks (64B).
Returns
2 int4 blocks (32B), the first 32B of the compression output.

◆ Hash() [2/2]

cuda::std::array< int4, 4 > fss::hash::Blake3::Hash ( cuda::std::tuple< int4, const int4 > msg)
inline

Hash a 128+127-bit logical message into two 32B digests.

All 128 bits of a are message data. Bit 0 of b.w is reserved for domain separation; its supplied value is ignored. The other 127 bits of b are message data. Hash a followed by a copy of b with its reserved bit set to 0, then to 1, and concatenate the digests in that order. The input blocks are not modified. Each digest uses a 32B message, counter 0, and flags CHUNK_START | CHUNK_END | ROOT | KEYED_HASH under the configured IV.

Parameters
msgTuple of (a, b), with the reserved bit in the second block.
Returns
4 int4 blocks (64B).

◆ Hash4()

cuda::std::array< cuda::std::array< int4, 2 >, 4 > fss::hash::Blake3::Hash4 ( cuda::std::span< const cuda::std::array< int4, 4 >, 4 > msgs)
inline

Hash four 64B messages.

Produces the same 32B digest as Hash for each message on this instance. The input is borrowed and the output is owned. Only for host side; device use fails to build with an unresolved-extern error naming fss_host_only_Blake3_Hash4_used_in_device_code.

Parameters
msgsFour 64B messages.
Returns
Four 32B digests.

The documentation for this class was generated from the following file: