**Table of Contents**

An application should first initialize a pairing object. This causes PBC to setup curves, groups and other mathematical miscellany. After that, elements can be initialized and manipulated for cryptographic operations.

Parameters for various pairings are included with the PBC library distribution
in the `param`

subdirectory, and some are suitable for cryptographic use. Some
programs in the `gen`

subdirectory may be used to generate parameters (see
Chapter 7, *Bundled programs*). Also, see the PBC website for many more
pairing parameters.

Pairings involve three groups of prime order. The PBC library calls them G1, G2, and GT, and calls the order r. The pairing is a bilinear map that takes two elements as input, one from G1 and one from G2, and outputs an element of GT.

The elements of G2 are at least as long as G1; G1 is guaranteed to be the
shorter of the two. Sometimes G1 and G2 are the same group (i.e. the pairing
is symmetric) so their elements can be mixed freely. In this case the
`pairing_is_symmetric`

function returns 1.

Bilinear pairings are stored in the data type `pairing_t`

. Functions that
operate on them start with `pairing_`

.

To initialize a pairing from an ASCIIZ string:

pairing_t pairing; pairing_init_set_str(pairing, s); // Where s is a char *.

The string *s* holds *pairing parameters* in a text format. The `param`

subdirectory contains several examples.

Alternatively, call:

pairing_t pairing; pairing_init_pbc_param(pairing, param);

where *param* is an initialized `pbc_param_t`

(see Chapter 5, *Param functions*).

int **pairing_init_set_str**(*pairing_t pairing*, *const char *s*)

Initialize pairing from parameters in a ASCIIZ string

strReturns 0 on success, 1 on failure.

int **pairing_init_set_buf**(*pairing_t pairing*, *const char *s*, *size_t len*)

Same, but read at most

lenbytes. Iflenis 0, it behaves as the previous function. Returns 0 on success, 1 on failure.

void **pairing_init_pbc_param**(*struct pairing_s *pairing*, *pbc_param_t p*)

Initialize a pairing with pairing parameters

p.

void **pairing_clear**(*pairing_t pairing*)

Free the space occupied by

pairing. Call whenever a`pairing_t`

variable is no longer needed. Only call this after all elements associated withpairinghave been cleared, as they need information stored in thepairingstructure.