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.

4.6. Comparing elements<br />

These functions compare elements from the same algebraic structure.<br />

int element_is1(element_t n)<br />

Returns true if n is 1.<br />

int element_is0(element_t n)<br />

Returns true if n is 0.<br />

int element_cmp(element_t a, element_t b)<br />

Returns 0 if a and b are the same, nonzero otherwise.<br />

int element_is_sqr(element_t a)<br />

Returns nonzero if a is a perfect square (quadratic residue), zero otherwise.<br />

int element_sgn(element_t a)<br />

int element_sign(element_t a)<br />

Chapter 4. Element functions<br />

If a is zero, returns 0. For nozero a the behaviour depends on the algebraic structure, but has the property that<br />

element_sgn(a) = -element_sgn(-a) and element_sgn(a) = 0 implies a = 0 with overwhelming probability.<br />

4.7. Element I/O<br />

Functions for producing human-readable outputs for elements. Converting elements to and from bytes<br />

are discussed later.<br />

19

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

Saved successfully!

Ooh no, something went wrong!