Package viff :: Module equality
[hide private]
[frames] | no frames]

Module equality

source code

Equality protocol. The mixin class defined here provide an :meth:`equal` method to the :class:`Runtime <viff.runtime.Runtime>` it is mixed with.

Classes [hide private]
  ProbabilisticEqualityMixin
This class implements probabilistic constant-round secure equality-testing of secret shared numbers.
Functions [hide private]
 
legendre_mod_p(a)
Return the legendre symbol ``legendre(a, p)`` where *p* is the order of the field of *a*.
source code
Function Details [hide private]

legendre_mod_p(a)

source code 

Return the legendre symbol ``legendre(a, p)`` where *p* is the order of the field of *a*.

The legendre symbol is -1 if *a* is not a square mod *p*, 0 if ``gcd(a, p)`` is not 1, and 1 if *a* is a square mod *p*:

>>> from viff.field import GF
>>> legendre_mod_p(GF(5)(2))
-1
>>> legendre_mod_p(GF(5)(5))
0
>>> legendre_mod_p(GF(5)(4))
1