fhel 0.0.5-linux.1 copy "fhel: ^0.0.5-linux.1" to clipboard
fhel: ^0.0.5-linux.1 copied to clipboard

Natively supports Fully Homomorphic Encryption operations on sensitive data without revealing it. Supports Key Derivation, Encryption, Decryption, and Mathematical operations.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'addition.dart' show addVector, addInt;

void main() {
  runApp(const MyApp());
}

int intX = 1234;
int intAdd = 2468;
List<int> vecX = [1, 2, 3, 4];
List<int> vecAdd = [2, 4, 6, 8];

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late String ctxStatus;
  bool showIntResult = false;
  late int sumIntResult;
  bool showVecResult = false;
  late List<int> sumVecResult;
  late Map<String, int> intCtx;
  late Map<String, int> vecCtx;

  @override
  void initState() {
    super.initState();
    intCtx = {'polyModDegree': 4096, 'ptMod': 4096, 'secLevel': 128};
    sumIntResult = addInt(intCtx, intX, intAdd);
    // sumIntResult = -1;

    vecCtx = {'polyModDegree': 4096, 'ptModBit': 20, 'secLevel': 128};
    sumVecResult = addVector(vecCtx, vecX, vecAdd);
    // sumVecResult = [];
  }

  @override
  Widget build(BuildContext context) {
    const textStyle = TextStyle(fontSize: 25);
    const spacerSmall = SizedBox(height: 10);
    const spacerLarge = SizedBox(height: 20);
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('FHEL using Microsoft SEAL'),
        ),
        body: SingleChildScrollView(
          child: Container(
            padding: const EdgeInsets.all(8),
            child: Column(
              children: [
                const Text(
                  'BFV: Add Integers',
                  style: textStyle,
                  textAlign: TextAlign.center,
                ),
                spacerSmall,
                Text(
                  '${intX.toString()} + ${intAdd.toString()}',
                  style: textStyle,
                  textAlign: TextAlign.center,
                ),
                Text(
                  "=> ${sumIntResult.toString()}",
                  style: textStyle,
                  textAlign: TextAlign.center,
                ),
                spacerLarge,
                const Text(
                  'BFV: Add List<int>',
                  style: textStyle,
                  textAlign: TextAlign.center,
                ),
                spacerSmall,
                Text(
                  '${vecX.toString()} + ${vecAdd.toString()}',
                  style: textStyle,
                  textAlign: TextAlign.center,
                ),
                Text(
                  "=> ${sumVecResult.toString()}",
                  style: textStyle,
                  textAlign: TextAlign.center,
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
1
likes
0
pub points
26%
popularity

Publisher

verified publisherjeffmur.dev

Natively supports Fully Homomorphic Encryption operations on sensitive data without revealing it. Supports Key Derivation, Encryption, Decryption, and Mathematical operations.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ffi, flutter, path

More

Packages that depend on fhel