Giter VIP home page Giter VIP logo

aqtfhe2's Introduction

aqTFHE2

Yet another implementation of TFHE in C++17.

About 7.7 ms/gate on Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz.

Simple Usage

Write code like this:

#include "aqtfhe2.hpp"

int main()
{
    using P = aqtfhe2::params::CGGI16;
    std::random_device rand;

    auto sk = aqtfhe2::secret_key<P>::make(rand);
    auto ck = aqtfhe2::cloud_key<P>::make(rand, sk);

    auto e0 = sk.encrypt(rand, false), e1 = sk.encrypt(rand, true);

    auto eres = ck.nand(e0, e1);

    assert(sk.decrypt(eres) == true);
}

And compile it:

$ clang++ -std=c++17 -march=native -O3 hoge.cpp -I spqlios/ -L spqlios/build/ -lspqlios
$ ./a.out

Performance

About 7.7 ms/gate for old parameter [CGGI16], and 12.6 ms/gate for new parameter [CGGI19]. Both are measured on Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz.

You can verify this results by using main.cpp:

$ make     # Compile main.cpp
$ ./main   # Run
Old parameter [CGGI16]:	7650us / gate
New parameter [CGGI19]:	12570us / gate

Caveat

Some functions in aqTFHE2 need a random number generator as argument. Use std::random_device there if you don't care about it, because it is supposed to be the only cryptographically secure pseudo-random number generator (CSPRNG) in C++ standard library (See here for the details).

Licenses

This project is licensed under Apache License Version 2.0. See the file LICENSE.

However the directory spqlios/ is not my work but TFHE's one. See the file spqlios/LICENSE.

References

aqtfhe2's People

Contributors

ushitora-anqou avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.