Something went wrong. Try again.
Implementations of Privacy Enhancing Technologies in Zig
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233const std = @import("std");const pets = @import("pets");
pub fn main(init: std.process.Init) !void { const gpa = init.gpa; const io = init.io;
const n = 9; const Dpf = pets.dpf.Dpf(n); const size = Dpf.domain_size; var prg_key: pets.dpf.PrgKey = undefined; try io.randomSecure(&prg_key.left); try io.randomSecure(&prg_key.right);
var dpf = Dpf.init(gpa, io, &prg_key); defer dpf.deinit();
const key0, const key1 = try dpf.generateKeys(1); defer { dpf.destroyKey(key0); dpf.destroyKey(key1); }
var acc: u1 = 0; for (0..size) |i| { const index: Dpf.Index = @intCast(i); const e0 = try dpf.evaluate(key0, index); const e1 = try dpf.evaluate(key1, index); acc ^= e0 ^ e1; } std.debug.print("acc {d}\n", .{acc});}