GitXplorerGitXplorer
z

fhevm-tfhe-cli

public
4 stars
2 forks
2 issues

Commits

List of commits on branch main.
Verified
10aecb8c421b84f29dfc45af187359a5c7b5c8cb

Merge pull request #23 from zama-ai/update-tfhe-rs

ddavid-zk committed 9 months ago
Unverified
45ffa416f1ef65fffb356402ff70bf9aa4347910

Update tfhe-rs to 0.6.1

ddavid-zk committed 9 months ago
Verified
a13f4e3b1a0f3e035124260cc27e53f42293d69d

Merge pull request #22 from zama-ai/update-readme

aaquint-zama committed 10 months ago
Verified
06e9af2575d4c8c3f3006620b6a90ed7956c11f0

doc: update README with information on generated keys

aaquint-zama committed 10 months ago
Verified
42f4db63663d51534c20dc9fadcfdb0975da8fd1

Merge pull request #21 from zama-ai/ci/publish-on-release

lleventdem committed a year ago
Unverified
598c0fa83778cfa77f1dab6cd306ab0481efc84e

ci(publish): publish new image on release

lleventdem committed a year ago

README

The README file for this repository.

TFHE-CLI

The TFHE-CLI tool allows developers to use tfhe-rs features through a user-friendly CLI.

This tool can be used locally or through a docker image.

Docker images versioning

Registry and image name: docker pull ghcr.io/zama-ai/fhevm-tfhe-cli

Tags:

  • v0.2.1: based on tfhe-rs 0.3.1
  • v0.2.2: based on tfhe-rs 0.4.0
  • v0.2.3: based on tfhe-rs 0.4.1
  • v0.2.4: based on tfhe-rs 0.5.1

Build

Local

# for x86 CPUs
cargo build --features tfhe/x86_64-unix --release

# for ARM64
cargo build --features tfhe/aarch64-unix --release

Docker

Either download latest image:

docker pull ghcr.io/zama-ai/fhevm-tfhe-cli:latest

or build it locally:

docker build -t fhevm-tfhe-cli:latest .

Running operations

Make sure you either have Docker or the Rust toolchain installed on your host machine.

Please replace FHEVM_TFHE_CLI with either:

  • "cargo run --features tfhe/aarch64-unix --release -- " - for ARM CPUs when running locally on the host
  • "cargo run --features tfhe/x86_64-unix --release -- " - for x86 CPUs when running locally on the host
  • "docker run -v $LOCAL_DIR:/usr/local/app ghcr.io/zama-ai/fhevm-tfhe-cli:latest fhevm-tfhe-cli"
    • replace LOCAL_DIR with a local directory of choice in order to persist output from the tool when using Docker

For more information on Docker, see below.

For more information on supported operations and their variations, please see the built-in help:

FHEVM_TFHE_CLI help

Key generation

mkdir -p /path/to/keys/directory
FHEVM_TFHE_CLI generate-keys -d /path/to/keys/directory

It will generate 3 keys in /path/to/keys/directory:

  • cks: the private key, used for data decryption, that should never be shared publicly.
  • pks: the public key, used for data encryption, that could be shared publicly.
  • sks: the evaluation key, used for performing operations, that could be shared publicly.

Public encryption

# Encryption requires the public key `pks`.
FHEVM_TFHE_CLI public-encrypt-integer32 -c ./ciphertext -p /path/to/keys/directory/pks -v 42

Decryption

# Decryption requires the secret key `cks`.
FHEVM_TFHE_CLI decrypt-ciphertext -c ./ciphertext -s /path/to/keys/directory/cks