fhel 0.0.13-dev copy "fhel: ^0.0.13-dev" to clipboard
fhel: ^0.0.13-dev copied to clipboard

Native support for Fully Homomorphic Encryption using Microsoft SEAL. Perform basic arithmetic, key management, encryption, and decryption on encrypted data.

FHEL #

A Fully Homomorphic Encryption Library (FHEL) interface that exposes the basic functionalities of Microsoft SEAL. Supports Android and Linux.

Usage #

To use this plugin, add fhel as a dependency in your pubspec.yaml

Download Binaries #

Stored in Github Releases

flutter pub add fhel
dart run fhel:setup <platform> --arch <architecture>
Platform Architecture
Android x86_64 (default) arm64-v8a armeabi-v7a
Linux x64 (default)
MacOS arm64 (default)
import 'package:fhel/seal.dart';

// Generate context w/ parameters
Map<String, int> ctx = {
'polyModDegree': 4096,
'ptMod': 1024,
'secLevel': 128
};
// SEALContext with BFV Scheme
final bfv = Seal('bfv');

// Initialize context and verify
String status = bfv.genContext(ctx);
assert(status == 'success: valid', status);

// Generate public/private keys
bfv.genKeys();

// Create Plaintext obj, contains pointer C obj in memory
final plainOne = bfv.plain(2.toRadixString(16));
final plainTwo = bfv.plain(2.toRadixString(16));

// Create Ciphertext obj, contain pointer to SEALCiphertext
final cipherOne = bfv.encrypt(plainOne);

// Add Ciphertexts, enc(1) + 2 = enc(3)
final cipherAdd = bfv.addPlain(cipherOne, plainTwo);
final plainAdd = bfv.decrypt(cipherAdd);

// Decode Plaintext to int
final result = int.parse(plainAdd.text, radix: 16);
assert(result == 4, result);

2
likes
70
points
86
downloads

Publisher

verified publisherjeffmur.dev

Weekly Downloads

Native support for Fully Homomorphic Encryption using Microsoft SEAL. Perform basic arithmetic, key management, encryption, and decryption on encrypted data.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

archive, args, ffi, path, stack_trace

More

Packages that depend on fhel