MCPcopy Index your code
hub / github.com/Sunscreen-tech/Sunscreen

github.com/Sunscreen-tech/Sunscreen @v0.8.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.8.1 ↗ · + Follow
2,254 symbols 8,477 edges 176 files 629 documented · 28%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Rust

Intro

Sunscreen is an ecosystem for building privacy-preserving applications using fully homomorphic encryption (and later on zero-knowledge proofs as well). Fully homomorphic encryption (FHE) is a special kind of encryption scheme that allows anyone to perform computations directly on encrypted data. Since it's quite hard to write FHE programs, we've created a "compiler" to make this process easier for developers.

If you'd like to try out our FHE compiler before downloading it, we offer a playground.

Extensive documentation can be found here.

WARNING! This library is meant for experiments only. It has not been externally audited and is not intended for use in production.

Set up

These directions cover the requirements for developing the sunscreen platform itself, which may be more than needed to merely consume it as a dependency. If you wish to develop an application using Sunscreen, see the installation.

Install Rust

Install Rustup and follow the directions for your OS. We recommend stable Rust 1.58 or later.

MacOS

brew install cmake git

Linux

Install prereqs

Using yum: sudo yum install gcc gcc-c++ cmake3 openssl-devel clang git

Using apt: sudo apt install build-essential clang cmake3 libssl-dev git

After installing prereqs, make a link to cmake3 named cmake sudo ln /usr/bin/cmake3 <somwhere/under/$PATH/>cmake

Windows

We recommend developing sunscreen on macOS or Linux, as Windows is really slow.

Cmake

Install cmake 3.

Clang

Install llvm+clang. In the installer, select the option to add LLVM to your %PATH%. If you forget to do check this option, add C:\Program Files\LLVM\bin to your %PATH%.

MSVC C++

Install the MSVC C++ toolchain

When prompted for what to install, ensure you additionally check the Windows 10 SDK. You'll need to rerun the tool and modify your installation if you forget to do this.

Enable long file paths

Some of our compilation tests produce really long file paths. These tests will fail unless you enable long file paths. TL;DR; run regedit.exe, set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem to 1 and reboot.

git

Install git. Defaults are fine.

Initialize submodules

git submodule update --init --recursive

Dev workflows

Working with Sunscreen is as you'd expect with any other Rust repository:

Build

cargo build

Test

cargo test --release

Docs

cargo doc --open

Format

cargo fmt

Debug

We have a launch.json checked in that defines a bunch of debug configurations. In VSCode, you should see a bunch of dropdowns in the debug menu to debug the tests and examples.

License

This project is licensed under the terms of the GNU AGPLv3 license. If you require a different license for your application, please reach out to us.

Contribute

Feel free to open up issues!

If you'd like to submit a pull request, you'll need to agree to a Contributor License Agreement. For more info, contact us at hello@sunscreen.tech.

Extension points exported contracts — how you extend this code

FheProgramInputTrait (Interface)
* A trait that denotes this type can be used as an * argument to an FHE program. */ [6 implementers]
sunscreen_runtime/src/lib.rs
ToBytes (Interface)
* A trait for converting objects into byte arrays. */ [6 implementers]
seal_fhe/src/lib.rs
InnerProduct (Interface)
* A trait for computing an inner product. */ [7 implementers]
logproof/src/linear_algebra.rs
Zero (Interface)
For an algebraic structure, this defines the additive identity. [7 implementers]
sunscreen_math/src/misc_traits.rs
GraphCipherInsert (Interface)
* Called when an Fhe Program encounters a literal type and inserts it as plaintext node. * * This trait is an implemen [5 …
sunscreen/src/types/ops/insert.rs
TypeName (Interface)
* A trait the gives a name an version to a given type */ [5 implementers]
sunscreen_compiler_common/src/lib.rs
Gadget (Interface)
* In ZKP circuits, it's often simpler for the prover to provide additional * inputs and prove they meet some criteria t [4 …
sunscreen_zkp_backend/src/lib.rs
NoiseModel (Interface)
* A model for predicting noise growth in an FHE program. */ [2 implementers]
sunscreen_backend/src/noise_model/mod.rs

Core symbols most depended-on inside this repo

iter
called by 258
sunscreen_math/src/cpu.rs
push
called by 162
sunscreen_compiler_common/src/transforms/graph_transforms.rs
convert_seal_error
called by 145
seal_fhe/src/error.rs
fhe_program
called by 119
sunscreen/src/compiler.rs
encrypt
called by 118
sunscreen_runtime/src/runtime.rs
len
called by 114
sunscreen_runtime/src/lib.rs
compile
called by 103
sunscreen/src/compiler.rs
decrypt
called by 102
sunscreen_runtime/src/runtime.rs

Shape

Method 1,023
Function 884
Class 165
Interface 114
Enum 68

Languages

Rust100%
Python1%

Modules by API surface

seal_fhe/src/bfv_evaluator.rs64 symbols
logproof/src/linear_relation.rs50 symbols
logproof/src/math.rs49 symbols
sunscreen_runtime/src/runtime.rs42 symbols
logproof/src/linear_algebra.rs42 symbols
sunscreen/src/compiler.rs41 symbols
sunscreen/src/zkp/mod.rs40 symbols
sunscreen_compiler_common/src/graph.rs35 symbols
sunscreen/src/types/bfv/rational.rs35 symbols
sunscreen_compiler_common/src/macros/mod.rs34 symbols
sunscreen/tests/rational.rs34 symbols
sunscreen/src/types/bfv/batched.rs34 symbols

For agents

$ claude mcp add Sunscreen \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page