MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / fake_keys

Method fake_keys

FHEOffline/SimpleMachine.cpp:230–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228
229template <class FD>
230void MultiplicativeMachine::fake_keys(int slack)
231{
232 PlainPlayer P(N, "fake");
233 octetStream os;
234 PartSetup<FD>& part_setup = setup.part<FD>();
235 if (P.my_num() == 0)
236 {
237 part_setup.generate_setup(N.num_players(), field_size, sec, slack, true);
238 vector<PartSetup<FD> > setups;
239 part_setup.fake(setups, P.num_players(), false);
240 for (int i = 1; i < P.num_players(); i++)
241 {
242 setups[i].pack(os);
243 P.send_to(i, os);
244 os.reset_write_head();
245 }
246 // same transmission for all players, less problem
247 setups[0].pack(os);
248 }
249 else
250 {
251 P.receive_player(0, os);
252 }
253 part_setup.unpack(os);
254 part_setup.check();
255
256 SeededPRNG G;
257 part_setup.alphai.randomize(G);
258 Share<typename FD::T>::set_mac_key(part_setup.alphai);
259 Plaintext_<FD> m(part_setup.FieldD);
260 m.assign_constant(part_setup.alphai);
261 vector<Ciphertext> C({part_setup.pk.encrypt(m)});
262 TreeSum<Ciphertext>().run(C, P);
263 part_setup.calpha = C[0];
264
265 if (output)
266 part_setup.output(N);
267}
268
269void MachineBase::run()
270{

Callers

nothing calls this directly

Calls 15

assign_constantMethod · 0.80
encryptMethod · 0.60
my_numMethod · 0.45
generate_setupMethod · 0.45
num_playersMethod · 0.45
fakeMethod · 0.45
packMethod · 0.45
send_toMethod · 0.45
reset_write_headMethod · 0.45
receive_playerMethod · 0.45
unpackMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected