Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am randhindi on github.
  • I am randhindi (https://keybase.io/randhindi) on keybase.
  • I have a public key whose fingerprint is 98BA 8D5F 66E4 2674 40F1 3672 8477 4711 8743 5CAE

To claim this, I am signing this object:

import hnumpy as hnp
import numpy as np
weights = np.array([0.1, 0.2, 0.3, 0.4, 0.5])
bias = np.array([0.1])
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def func(x):
@randhindi
randhindi / logreg_compilation.py
Created September 29, 2021 09:01
Logreg Compilation
h = hnp.compile_fhe(
func,
{'x': hnp.encrypted_ndarray(bounds=(-1, 1), shape=(5,))}
)
@randhindi
randhindi / logreg_simulate.py
Created September 29, 2021 09:05
Logreg Simulate
x = np.random.uniform(-1, 1, 5)
print(f"Simulation result: {h.simulate(x)}")
print(f"Plain NumPy result: {func(x)}")
@randhindi
randhindi / concrete_boolean.rs
Created September 30, 2021 11:32
Concrete Boolean example
extern crate concrete_boolean;
use concrete_boolean::gen_keys;
// We generate a set of client/server keys, using the default parameters:
let (client_key, server_key) = gen_keys();
// We use the client secret key to encrypt two messages:
let ct_1 = client_key.encrypt(true);
let ct_2 = client_key.encrypt(false);