aboutsummaryrefslogtreecommitdiffstats
path: root/moon-abe/pbc-0.5.14/doc/quickstart.txt
blob: 2f94e46e981e83430701a64cea196149a9fadcad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
== Installing PBC ==

The PBC library needs http://www.swox.com/gmp/[the GMP library].

This build system has been tested and works on Linux and Mac OS X with a
fink installation.

  $ ./configure
  $ make
  $ make install

On Windows, the configure command requires a couple of options:

  $ ./configure -disable-static -enable-shared

By default the library is installed in `/usr/local/lib`.  On some systems, this
may not be in the library path. One way to fix this is to edit
`/etc/ld.so.conf` and run `ldconfig`.

=== Simple Makefile ===

For speed and simplicity, I use `simple.make` during development.
Naturally it is less portable.

  $ make -f simple.make

PBC uses some GNU C extensions such as nested functions.

[[pbcintro]]
=== Quick start ===

We shall use the following notation. For our purposes, the pairing is a
bilinear map from two cyclic groups, G1 and G2 to a third group GT, where each
group has prime order r.

Run `pbc/pbc` and type:

  g := rnd(G1);
  g;

The first line generates a random element g of the group G1,
while the second prints out the value of g. (The syntax was influenced
by `bc`, an arbitrary precision calculator.)
Next, enter:

  h := rnd(G2);
  h;

This assigns h to a random element of the group G2. Actually, the default
pairing `pbc` uses is symmetric so G1 and G2 are in fact the same group, but in
general they are distinct. To compute the pairing applied to g and h, type:

  pairing(g,h);

The order of both g and h is r. Let's generate two random numbers between
1 and r:

  a := rnd(Zr);
  b := rnd(Zr);

By bilinearity, the resulting output of both of these lines should be
identical:

  pairing(g^a,h^b);
  pairing(g,h)^(a*b);

This program has <<pbcref, other features>> but the commands shown here should
be enough to quickly and interactively experiment with many pairing-based
cryptosystems using real numbers.