MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / get_equality_graph

Function get_equality_graph

ciphercore-base/src/mpc/mpc_psi.rs:274–305  ·  view source on GitHub ↗
(
    context: Context,
    type1: Type,
    type2: Type,
    key_header: String,
    is_input1_private: bool,
    is_input2_private: bool,
)

Source from the content-addressed store, hash-verified

272}
273
274fn get_equality_graph(
275 context: Context,
276 type1: Type,
277 type2: Type,
278 key_header: String,
279 is_input1_private: bool,
280 is_input2_private: bool,
281) -> Result<Graph> {
282 let eq_context = simple_context(|g| {
283 let i0 = g.input(type1)?;
284 let i1 = g.input(type2)?;
285
286 let key_columns_0 = i0.named_tuple_get(key_header.clone())?;
287 let key_columns_1 = i1.named_tuple_get(key_header)?;
288
289 let eq_bits = g.custom_op(
290 CustomOperation::new(Equal {}),
291 vec![key_columns_0, key_columns_1],
292 )?;
293
294 let null_0 = i0.named_tuple_get(NULL_HEADER.to_owned())?;
295 let null_1 = i1.named_tuple_get(NULL_HEADER.to_owned())?;
296
297 null_0.multiply(null_1)?.multiply(eq_bits)
298 })?;
299
300 convert_main_graph_to_mpc(
301 eq_context,
302 context,
303 vec![is_input1_private, is_input2_private],
304 )
305}
306
307// Extracts the null column and the column masks of key headers, and computes their product.
308// The Boolean output indicates whether PRF keys are needed.

Callers 1

instantiateMethod · 0.85

Calls 7

simple_contextFunction · 0.85
cloneMethod · 0.80
inputMethod · 0.45
named_tuple_getMethod · 0.45
custom_opMethod · 0.45
multiplyMethod · 0.45

Tested by

no test coverage detected