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

Function main

ciphercore-base/src/bin/ciphercore_sort.rs:37–58  ·  view source on GitHub ↗

This binary prints the serialized sorting context on the non-encrypted input in (serde) JSON format. Main context graph is based on [the Radix Sort MPC protocol](https://eprint.iacr.org/2019/695.pdf) implemented [here](../ciphercore_base/applications/sort/fn.create_sort_graph.html). # Arguments `n` - number of elements of an array `st` - scalar type of array elements # Usage `< this_binary > -

()

Source from the content-addressed store, hash-verified

35///
36/// `< this_binary > -s <st> <n>`
37fn main() {
38 // Initialize a logger that collects information about errors and panics within CipherCore.
39 // This information can be accessed via RUST_LOG.
40 env_logger::init();
41 // Execute CipherCore code such that all the internal errors are properly formatted and logged.
42 execute_main(|| -> Result<()> {
43 let args = Args::parse();
44 let st = ScalarType::from_str(&args.scalar_type)?;
45 // Create a context
46 let context = create_context()?;
47 // Create a sort graph in the context
48 let graph: Graph = create_sort_graph(context.clone(), args.n, st)?;
49 // Set this graph as main to be able to finalize the context
50 context.set_main_graph(graph)?;
51 // Finalize the context. This makes sure that all the graphs of the contexts are ready for computation.
52 // After this action the context can't be changed.
53 context.finalize()?;
54 // Serialize the context and print it to stdout
55 println!("{}", serde_json::to_string(&context)?);
56 Ok(())
57 });
58}

Callers

nothing calls this directly

Calls 6

execute_mainFunction · 0.85
create_sort_graphFunction · 0.85
cloneMethod · 0.80
create_contextFunction · 0.50
set_main_graphMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected