Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


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:

$ wget -c -O - | tar -xz
$ cd pbc-0.5.14
$ ./configure
$ make
$ sudo make install

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

NOTE: the PBC library is installed to /usr/local/lib so you may need to add export LD_LIBRARY_PATH=/usr/local/lib/ to your .profile or equivalent

Running BGN

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

Testing BGN

$ cd bgn
$ make install && make build
$ go test
$ go test -bench=.

Disclaimer ⚠️

None of the cryptography used in this project was verified by experts. The code is intended to be used for research purposes only. DO NOT USE THIS CODE IN PRODUCTION.


BGN encryption scheme implementation using Go




No releases published


No packages published