pbc subdirectory contains
the pairing-based calculator,
which is loosely based on
well-known arbitrary precision calculator.
pairing_test.pbc for an
example script. Some differences: the assignment operator is
:=, and newlines are ordinary
whitespace and not statement terminators.
If started with the
the syntax is compatible with
newlines are treated as statement terminators and
= is assignment. Additionally,
pbc displays a prompt. This mode may be easier
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
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
Awith 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]);