Several binaries and curve parameters are bundled with the PBC library,
such as the
param subdirectory contains pairing parameters one might use in
a real cryptosystem. Many of the test programs read the parameters
from files such as these on standard input, for example:
$ benchmark/benchmark < param/c159.param $ example/bls < param/e.param
pbc subdirectory contains the pairing-based calculator,
which is loosely based on
bc, a well-known arbitrary precision
pairing_test.pbc for an example script. Some differences: the assignment
:=, and newlines are ordinary whitespace and not statement
If started with the
-y option, the syntax is compatible with
are treated as statement terminators and
= is assignment. Additionally,
pbc displays a prompt. This mode may be easier for beginners.
Initially, the variables G1, G2, GT and Zr are represent groups associated with a particular A pairing.
An element is represented with a tree of integers, such as
[[1,2], 3], or
Assignments such as
variable := expression; return the value of the variable.
The arithmetic operators
+, -, /, *, ^ have the standard precedence.
The C comparison operators and ternary operator are available.
Each statement should be terminated by a semicolon.
Comments are the same as in (original) C, or begin with "#" and end at a newline.
Some of the pbc functions:
Set the variables G1, G2, GT and Zr to the groups in a particular A pairing:
Other sample pairings can be used by replacing
A with one of
D, E, F, G.
Returns a random element of an algebraic structure G, e.g:
g := rnd(Zr);
Returns the pairing applied to g and h. The element g must be an element of G1 and h of G2, e.g:
Maps an element g to element of the field G, e.g:
Zr(123); GT([456, 789]);