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

SHA-256 keyed hash. More...

Public Member Functions

 Sha256 (int4 key)
 Constructor.
cuda::std::array< int4, 2 > Hash (cuda::std::span< const int4, 4 > msg)
 Hash a 64B message with the key.
cuda::std::array< int4, 4 > Hash (cuda::std::tuple< int4, const int4 > msg)
 Hash a 128+127-bit logical message into two 32B digests.

Detailed Description

SHA-256 keyed hash.

Only for host side. Device use fails to build with an unresolved-extern error naming fss_host_only_Sha256_used_in_device_code.

Constructor & Destructor Documentation

◆ Sha256()

fss::hash::Sha256::Sha256 ( int4 key)
inlineexplicit

Constructor.

Parameters
key16B key stored by value.

Member Function Documentation

◆ Hash() [1/2]

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

Hash a 64B message with the key.

Parameters
msg4 int4 blocks (64B).
Returns
2 int4 blocks (32B) SHA-256 digest.
Exceptions
std::runtime_errorif EVP_Digest fails.

◆ Hash() [2/2]

cuda::std::array< int4, 4 > fss::hash::Sha256::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 hashes the configured 16B key prefix followed by the two message blocks, for 48B total. This is a prefixed SHA-256 hash.

Parameters
msgTuple of (a, b), with the reserved bit in the second block.
Returns
4 int4 blocks (64B).
Exceptions
std::runtime_errorif context allocation or a digest operation fails or returns an invalid length.

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