fhel 0.0.5-linux fhel: ^0.0.5-linux copied to clipboard
Natively supports Fully Homomorphic Encryption operations on sensitive data without revealing it. Supports Key Derivation, Encryption, Decryption, and Mathematical operations.
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
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);