++ed by:
1 non-PAUSE user
Author image Paul Miller


Crypt::PBC::Pairing - OO interface for the Stanford PBC library


    use Crypt::PBC;

    my $pairing = new Crypt::PBC("params_d.txt");
    my $G1      = $pairing->init_G1->random;
    my $G2      = $pairing->init_G2->random->double->square;
    my $GT      = $pairing->init_GT->pairing_apply( $G1, $G2 );

Initializer Functions

The only thing of use this package does is initialize elements in the pairing. It does many other things behind the scenes though.

    my $G1_element = $pairing->init_G1;  # returns Crypt::PBC::Element
    my $G2_element = $pairing->init_G2;  # objects
    my $GT_element = $pairing->init_GT;
    my $Zr_element = $pairing->init_Zr;

The most important thing the Pairing package does is handle memory for you. The package is a scalar ref of the C-pointer. $$pairing is the "address" as an integer!

It's important when clearing the PBC memory that pairings get cleared after elements and the Element and Pairing objects handle that on their own. You may safely ignore clearing elements and pairings if you use the OO interface.

Although, be sure that if you overload DESTROY that you call SUPER::DESTROY()!


GPL-ish licensing with the author: Paul Miller <jettero@cpan.org>.

Please see Crypt::PBC for further information.