myl7/fss 1.1.0
Function secret sharing (FSS) primitives including distributed point/comparison function (DPF/DCF)
Loading...
Searching...
No Matches
bytes.cuh
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
8#pragma once
9#include <fss/group.cuh>
10#include <cuda_runtime.h>
11#include <cassert>
12#include <fss/util.cuh>
13
14namespace fss::group {
15
19struct Bytes {
20 int4 val;
21
22 __host__ __device__ Bytes operator+(Bytes rhs) const {
23 return util::Xor(val, rhs.val);
24 }
25
26 __host__ __device__ Bytes operator-() const {
27 return *this;
28 }
29
30 __host__ __device__ Bytes() : val({0, 0, 0, 0}) {}
31
32 __host__ __device__ static Bytes From(int4 buf) {
33 assert((buf.w & 1) == 0);
34 return Bytes(buf);
35 }
36
37 __host__ __device__ int4 Into() const {
38 return val;
39 }
40
41private:
42 __host__ __device__ Bytes(int4 buf) : val(buf) {}
43};
44static_assert(Groupable<Bytes>);
45
46} // namespace fss::group
Group interface.
Definition group.cuh:40
Bytes with XOR as a group.
Definition bytes.cuh:19