myl7/fss 2.0.0
Function secret sharing (FSS) primitives including distributed point/comparison function (DPF/DCF)
Loading...
Searching...
No Matches
hash.cuh
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
7
8#pragma once
9#include <cuda_runtime.h>
10#include <cuda/std/array>
11#include <cuda/std/span>
12#include <cuda/std/tuple>
13#include <concepts>
14
19template <typename Hash>
20concept Hashable = requires(Hash hash, cuda::std::span<const int4, 4> msg) {
21 { hash.Hash(msg) } -> std::same_as<cuda::std::array<int4, 2>>;
22};
23
49template <typename Hash>
51 requires(Hash hash, cuda::std::span<const cuda::std::array<int4, 4>, 4> msgs) {
52 { hash.Hash4(msgs) } -> std::same_as<cuda::std::array<cuda::std::array<int4, 2>, 4>>;
53};
54
71template <typename Hash>
72concept XorHashable = requires(Hash hash, cuda::std::tuple<int4, const int4> msg) {
73 { hash.Hash(msg) } -> std::same_as<cuda::std::array<int4, 4>>;
74};
75
85template <typename Hash>
86concept CcrHashable = requires(Hash hash, int4 block) {
87 { hash.Hash(block) } -> std::same_as<int4>;
88};
89
90// -----------------------------------------------------------------------------
91
92namespace fss::detail {
93
94template <typename Hash>
95cuda::std::array<int4, 8> HashBatch(Hash &hash, const cuda::std::array<int4, 8> &blocks) {
96 cuda::std::array<int4, 8> out;
97 for (int i = 0; i < 8; ++i) out[i] = hash.Hash(blocks[i]);
98 return out;
99}
100
101} // namespace fss::detail
Circular-correlation-robust (CCR) hash interface for HalfTree schemes.
Definition hash.cuh:86
Optional four-message batch extension of Hashable.
Definition hash.cuh:50
Collision-resistant hash interface.
Definition hash.cuh:20
Collision-resistant and XOR-collision-resistant hash interface.
Definition hash.cuh:72