a portable and fast pairing-based cryptography library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
MITSUNARI Shigeo a63abe39c4 detect bmi2 feature 8 years ago
bin add .emptydir for empty directory 8 years ago
include/mcl a little faster sqrFp4 8 years ago
java add include header 8 years ago
lib add .emptydir for empty directory 8 years ago
misc rename fp_llvm to low_func_llvm 8 years ago
obj add .emptydir for empty directory 8 years ago
sample add preset of bn256 8 years ago
src detect bmi2 feature 8 years ago
test move test code 8 years ago
COPYRIGHT from mie 10 years ago
Makefile support w/wo bmi2 8 years ago
common.mk asm is not used 8 years ago
common.props change include dir of cybozulib_ext 9 years ago
debug.props change /MD to /MT 9 years ago
mcl.sln add bn_test vc proj 9 years ago
mklib.bat add how to use mklib.bat and mk.bat for win 8 years ago
readme.md update benchmark of ARM64 8 years ago
release.props change /MD to /MT 9 years ago

readme.md

mcl

A class library of finite field, elliptic curve and pairing

Abstract

mcl is a library for pairing-based cryptography. The current version supports the optimal Ate pairing over BN curves.

Support architecture

  • 64-bit Windows + Visual Studio
  • x86, x86-64 Linux + gcc/clang
  • ARM
  • ARM64
  • (maybe any platform to be supported by LLVM)

Installation Requirements

apt install libgmp-dev

Create a working directory (e.g., work) and clone the following repositories.

mkdir work
cd work
git clone git://github.com/herumi/mcl.git
git clone git://github.com/herumi/cybozulib.git
git clone git://github.com/herumi/xbyak.git
git clone git://github.com/herumi/cybozulib_ext.git
  • Xbyak is a prerequisite for optimizing the operations in the finite field on x86-64.
  • Cybozulib_ext is a prerequisite for running OpenSSL and GMP on VC (Visual C++).

Build and test

To make lib/libmcl.a and test, run

make test

To measure pairing, run

bin/bn_test.exe

To make sample programs, run

make sample

If LLVM is installed, then

make MCL_USE_LLVM=1 LLVM_VER=-3.8

Change LLVM_VER=-3.8 to LLVM_VER=-3.7 if the version of LLVM is 3.7.

Build for 32-bit Linux

Build openssl and gmp for 32-bit mode and install

make ARCH=x86 CFLAGS_USER="-I <lib32>/include" LDFLAGS_USER="-L <lib32>/lib -Wl,-rpath,<lib32>/lib"

Build for 64-bit Windows

  1. make library
>mklib.bat
  1. make exe binary of sample\pairing.cpp
>mk sample\pairing.cpp

open mcl.sln and build or if you have msbuild.exe

msbuild /p:Configuration=Release

Build for ARM64 Linux

make MCL_USE_LLVM=1 LLVM_VER=-3.7 ARCH=aarch64

Build for ARM Linux

make MCL_USE_LLVM=1 LLVM_VER=-3.8 ARCH=arm

Benchmark

A benchmark of a BN curve over the 254-bit prime.

  • x64, x86 ; Inte Core i7-6700 3.4GHz(Skylake) upto 4GHz
    • sudo cpufreq-set -g performance
  • arm ; 900MHz quad-core ARM Cortex-A7 on Raspberry Pi2, Linux 4.4.11-v7+
  • arm64 ; 1.2GHz ARM Cortex-A53 HiKey
software x64 x86 arm arm64(msec)
ate-pairing 0.21 - - -
mcl 0.35 2.0 27 4.4
TEPLA 1.76 3.7 37 17.9
RELIC PRIME=254 1.31 3.5 36 -
MIRACL ake12bnx 4.2 - 78 -
NEONabe - - 16 -

License

modified new BSD License http://opensource.org/licenses/BSD-3-Clause

The original source of the followings are https://github.com/aistcrypt/Lifted-ElGamal . These files are licensed by BSD-3-Clause and are used for only tests.

include/mcl/elgamal.hpp
include/mcl/window_method.hpp
test/elgamal_test.cpp
test/window_method_test.cpp
sample/vote.cpp

This library contains mie and Lifted-ElGamal.

References

Author

光成滋生 MITSUNARI Shigeo(herumi@nifty.com)