https://github.com/golemfactory/gmorph
Fully Homomorphic Encryption library
https://github.com/golemfactory/gmorph
Last synced: 11 months ago
JSON representation
Fully Homomorphic Encryption library
- Host: GitHub
- URL: https://github.com/golemfactory/gmorph
- Owner: golemfactory
- License: gpl-3.0
- Created: 2019-08-29T11:06:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-25T10:53:00.000Z (about 6 years ago)
- Last Synced: 2025-07-02T00:48:34.480Z (12 months ago)
- Language: Rust
- Size: 832 KB
- Stars: 25
- Watchers: 7
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
`gMorph` is written entirely in Rust and is meant to be easily cross-compiled to WebAssembly for use in [gWasm].
[gWasm]: https://docs.golem.network/#/Products/Brass-Beta/gWASM
[here]: https://github.com/golemfactory/gmorph/issues
## 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].
```toml
# Cargo.toml
[dependencies]
gmorph = "0.1"
```
## Example usage:
```rust
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](examples) folder.
For instance, to run `examples/simple_mul.rs`, invoke:
```
cargo run --release --example simple_mul
```