FHE PROGRAMMING

FHELang
Programming Language

A programming language designed for Fully Homomorphic Encryption (FHE) computations. Write encrypted programs with familiar syntax and powerful cryptographic types.

Get Started
Coming Soon
// FHELang Example
fn
add
(a: secret<i32>, b: secret<i32>) -> secret<i32>
{
return a + b;
}

Language Features

FHELang combines familiar programming constructs with powerful cryptographic primitives for encrypted computation.

Encrypted Types

Native support for encrypted data types with secret<T> syntax for integers, floats, and booleans.

Familiar Syntax

Rust-inspired syntax with functions, loops, conditionals, and arrays. Easy to learn for developers familiar with modern languages.

Polycircuit Integration

Built-in access to POLYCIRCUIT components like ReLU, sign functions, and other cryptographic primitives.

Type System

Comprehensive type system supporting both plaintext and encrypted data with multi-dimensional arrays.

Plaintext Types

Fixed-precision integers: i8, i16, i32, i64
Unsigned integers: u8, u16, u32, u64
Floating-point: f32, f64
Boolean: bool

Encrypted Types

Encrypted integers: secret<i32>
Encrypted floats: secret<f64>
Encrypted booleans: secret<bool>
Multi-dimensional arrays: [[secret<i32>; N]; M]

Code Examples

See FHELang in action with real examples of encrypted computation.

01

Hello World

Basic FHELang program structure with constants, functions, and encrypted data types.

// FHELang Hello World
const
N
: i8 = 25;
fn
add
(a: i32, b: i32) -> i32
{
return a + b;
}
fn
main
(a: i8, mut points: [[[[secret<i32>; N]; N]; N]; M]) -> i8
{
let mut new_val_1: secret<i32> = secret<i32>::from(78);
return a;
}
// Using POLYCIRCUIT components
let s: secret<i32> = [[1,2,3], [4,5,6]];
let result: i64 = polycircuit::relu(s);
// Component calls
component.call("sign")
polycircuit::relu(points)
02

POLYCIRCUIT Integration

Seamlessly integrate with POLYCIRCUIT components for advanced cryptographic operations like ReLU, sign functions, and more.

03

Array Operations

Work with multi-dimensional arrays of encrypted and plaintext data with familiar indexing and assignment syntax.

// Array operations
let mut
array1
: [[i32; 5]; 2] = [[1,2,3,4,5], [6,7,8,9,10]];
let
array2
: [i32; 5] = [0,0,0,0,0];
array1[0] = array2;

Supported Operations

Rich set of operations for both encrypted and plaintext data with automatic type promotion and casting.

Arithmetic

Plaintext: +, -, *, /, %
Encrypted: +, *, -
Mixed: +, *, -, /

Relational

Plaintext only:
==, !=, <, >, <=, >=

Logical

Boolean: &&, ||
Complement: !

Shift

Cyclic shift:
<<, >>
Arrays only

Ready to Code in FHE?

FHELang is coming soon. Join our community to stay updated on the latest developments.