gmorph

Crates.iogmorph
lib.rsgmorph
version0.1.0
sourcesrc
created_at2020-03-25 11:01:38.170972
updated_at2020-03-25 11:01:38.170972
descriptionFully homomorphic encryption library for gWasm
homepagehttps://github.com/golemfactory/gmorph
repositoryhttps://github.com/golemfactory/gmorph
max_upload_size
id222610
size94,667
Przemysław Rekucki (prekucki)

documentation

https://docs.rs/gmorph

README

gmorph

Fully homomorphic encryption library for gWasm.

Crates.io version Download docs.rs docs

gMorph is written entirely in Rust and is meant to be easily cross-compiled to WebAssembly for use in gWasm.

Disclaimer

gMorph is very much experimental in nature so things are expected to break unexpectedly. Also, please note that we make no claims about security of the encryption scheme. This work is provided as the Proof of Concept for FHE on gWASM, basically for demonstration purposes. If you find a bug, please file a bug report here.

# Cargo.toml
[dependencies]
gmorph = "0.1"

Example usage:

use gmorph::*;
use num_traits::Zero;

let key_pair = KeyPair::default();
let enc: Vec<_> = (1..10)
    .map(|x| Encoded::encode(x).encrypt(&key_pair))
    .collect();
let enc = enc.into_iter().fold(Encoded::zero(), |acc, x| acc + x);
let given = enc.decrypt(&key_pair).decode();
let expected: u32 = (1..10).sum();

assert_eq!(expected, given, "the sums should be equal, and equal to 45");

Examples

You can find some more examples in examples folder. For instance, to run examples/simple_mul.rs, invoke:

cargo run --release --example simple_mul
Commit count: 25

cargo fmt