GithubHelp home page GithubHelp logo

sietseringers / android-pbc Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 4.0 824 KB

A small Android library containing an Android-build of the PBC library and the JPBC library

License: GNU Lesser General Public License v2.1

Makefile 9.91% Java 90.09%

android-pbc's Introduction

android-bpc

A small Android library that simultaneously contains an Android-build of the PBC library and the JPBC library, enabling fast computations on elliptic curves and pairings on Android.

The library is essentially a thin wrapper around the following three native libraries.

For each of these builds are included for the ARM and ARMv7 platforms.

Usage

Assuming you use gradle, perform the following steps:

  1. git clone this repository somewhere, cd to it and run ./gradlew install.
  2. Add compile "net.sietseringers:android-pbc:0.1" to the dependencies of your app.
  3. Put the line
net.sietseringers.androidpbc.AndroidPBC.Initialize();

somewhere before you use any of the functionality of JPBC in Java.

After this, you can use the entire API that JPBC provides in the it.unisa.dia.gas namespace, including the part that refers to the PBC wrapper. Whenever you do, the included native library is used. For example, you can create a asymmetric (Type 3) bilinear pairing (called 'Type D' by the PBC documentation) as follows:

import it.unisa.dia.gas.plaf.jpbc.pbc.PBCPairingFactory;
import it.unisa.dia.gas.plaf.jpbc.pbc.curve.PBCTypeDCurveGenerator;
import it.unisa.dia.gas.jpbc.PairingParameters;

Pairing e = PBCPairingFactory.getPairing(new PBCTypeDCurveGenerator(9563).generate());

(Note that generating the curve parameters takes much longer than instantiating the pairing (which takes only ~ 0.5 seconds), so you should probably store and reuse the parameters that the PBCTypeDCurveGenerator constructor outputs.)

Warning

I cannot guarantee that this software will work. I have run just a few tests on only my own Android device. It works fine under those circumstances but more testing is certainly needed, so use with care.

Rebuilding GMP and PBC

The upper two libraries have been included as submodules in the jni/ folder. Assuming you have the Android NDK installed, they can be compiled as follows:

./gradlew ndkBuild

This will place them in the libs/ folder, after which they will be included in the final .aar file. For some reason this process also deletes the libjnidispatch.so files from the libs/ folder, you'll have to checkout those again.

android-pbc's People

Contributors

sietseringers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.