14.07.2013 Views

PBC Library Manual 0.5.11 - Stanford Crypto Group

PBC Library Manual 0.5.11 - Stanford Crypto Group

PBC Library Manual 0.5.11 - Stanford Crypto Group

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 7. Bundled programs<br />

Several binaries and curve parameters are bundled with the <strong>PBC</strong> library, such as the pbc program.<br />

The param subdirectory contains pairing parameters one might use in a real cryptosystem. Many of the<br />

test programs read the parameters from files such as these on standard input, for example:<br />

$ benchmark/benchmark < param/c159.param<br />

$ example/bls < param/e.param<br />

7.1. Pairing-based calculator<br />

The pbc subdirectory contains the pairing-based calculator, pbc, which is loosely based on bc, a<br />

well-known arbitrary precision calculator.<br />

See pairing_test.pbc for an example script. Some differences: the assignment operator is :=, and<br />

newlines are ordinary whitespace and not statement terminators.<br />

If started with the -y option, the syntax is compatible with bc: newlines are treated as statement<br />

terminators and = is assignment. Additionally, pbc displays a prompt. This mode may be easier for<br />

beginners.<br />

Initially, the variables G1, G2, GT and Zr are represent groups associated with a particular A pairing.<br />

An element is represented with a tree of integers, such as [[1,2], 3], or 4.<br />

Assignments such as variable := expression; return the value of the variable.<br />

The arithmetic operators +, -, /, *, ^ have the standard precedence. The C comparison operators<br />

and ternary operator are available.<br />

Each statement should be terminated by a semicolon.<br />

Comments are the same as in (original) C, or begin with "#" and end at a newline.<br />

Some of the pbc functions:<br />

init_pairing_A()<br />

Set the variables G1, G2, GT and Zr to the groups in a particular A pairing:<br />

31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!