BGN encryption scheme implementation using Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Boneh Goh Nissim (BGN) crypto system implementation in Golang.


Installation is somewhat tedious since this library requires the GMP and PBC libraries to be installed on the machine. To do so, please follow the instructions below. It should only take a few minutes :)

Install the dependencies and devDependencies. This package must be compiled using cgo. It also requires the installation of GMP and PBC. During the build process, this package will attempt to include <gmp.h> and <pbc/pbc.h>, and then dynamically link to GMP and PBC.

Most systems include a package for GMP. To install GMP in Debian / Ubuntu:

$ sudo apt-get install libgmp-dev

For an RPM installation with YUM:

$ sudo yum install gmp-devel

For installation with Fink ( on Mac OS X:

$ sudo fink install gmp gmp-shlibs

For more information or to compile from source, visit

To install the PBC library, download the appropriate files for your system from PBC has three dependencies: the gcc compiler, flex (, and bison ( See the respective sites for installation instructions. Most distributions include packages for these libraries. For example, in Debian / Ubuntu:

$ sudo apt-get install build-essential flex bison

The PBC source can be compiled and installed using the usual GNU Build System:

$ ./configure
$ make
$ sudo make install

After installing, you may need to rebuild the search path for libraries:

Running BGN

$ cd bgn
$ make install && make build && make run


None of the cryptography used in this project was verified by experts and is intended to be used for research purposes only. Do not use this code when security guarantees are required.