Git Product home page Git Product logo

crypto-incognito's Introduction

libepir - EllipticPIR client library

CMake Rust Node.js CI codecov

EllipticPIR is a private information retrieval (PIR) implementation backed by the EC-ElGamal encryption.

Try online WebAssembly demo: https://demo.ellipticpir.com/

This library contains cryptographic functions which are required to encrypt a query (a selector) to the EllipticPIR server and to decrypt a reply from the EllipticPIR server.

This repository provides native C library implementation and bindings for C++, native Rust implementation and JavaScript and TypeScript programming languages.

C / C++

The C implementation has no runtime heap memory allocation. The C++ bindings is a header-only library.

Install

$ git clone https://github.com/EllipticPIR/libepir.git
$ cd libepir
$ mkdir build_c
$ cd build_c
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make -j4  # (change the number "4" to your physical CPU cores to parallelize the build).
$ sudo make install

Generate mG.bin

$ epir_genm

Usage

Include epir.h (C) or epir.hpp (C++) in your source code.

For general usage, see ./src_c/bench_*.(c|cpp) files.

Rust

Install

cargo

cargo install epir

git

$ git clone https://github.com/EllipticPIR/libepir.git
$ cd libepir
$ cargo build

Generate mG.bin

$ cargo run --bin gen_mg

Usage

Visit docs.rs/epir for usage.

Node.js / TypeScript

This library both includes Node.js native addons (faster, no browser support) and WebAssembly builds (slower, browser support).

Install

npm

$ npm install epir

Build your own

$ git clone https://github.com/EllipticPIR/libepir.git
$ cd libepir
$ npm ci

Usage

See ./src_ts/types.ts for Node.js binding definitions.

For general usage, see files under the ./src_ts/__tests__ directory and ./pages/index.vue.

FAQs

What is mG.bin?

To decrypt a server's reply, you need to generate the mG.bin file. This file contains the pre-computation values of (G, 2*G, .., (0xFFFFFF)*G), where G is the generater of the Ed25519 curve.

To generate mG.bin, run

$ epir_genm

or

$ npm run epir_genm

The computation may take tens of seconds to finish. The computation time depends on the CPU power of your machine. (For comparison, on my desktop (Intel Core i7-7700K) it takes about ~15sec.)

The generated file will be located in $HOME/.EllipticPIR/mG.bin. The file size will be ~576MiB.

If you will not decrypt a server's reply, you can skip this step.

crypto-incognito's People

Contributors

visvirial avatar

Watchers

 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.