mpyc.sectypes
index
github.com/lschoe/mpyc/blob/v0.10/mpyc/sectypes.py

This module collects basic secure (secret-shared) types for MPyC.
 
Secure number (array) types all use common base classes, which
ensures that operators such as +,*,>= are defined by operator overloading.

 
Modules
       
mpyc.asyncoro
mpyc.finfields
mpyc.fingroups
functools
mpyc.gfpx
mpyc.gmpy
math
mpyc.numpy
operator
numpy.core.umath

 
Classes
       
mpyc.asyncoro.SecureObject(builtins.object)
SecureArray
SecureFiniteFieldArray
SecureFixedPointArray
SecureIntegerArray
SecureNumber
SecureFiniteField
SecureFixedPoint
SecureFloat
SecureInteger

 
class SecureArray(mpyc.asyncoro.SecureObject)
    SecureArray(value=None, shape=None)
 
Base class for secure (secret-shared) number arrays.
 
 
Method resolution order:
SecureArray
mpyc.asyncoro.SecureObject
builtins.object

Methods defined here:
__abs__(self)
Matrix absolute value.
__add__(self, other)
Matrix addition.
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__bool__(self)
Return True if secure array is nonempty, False otherwise.
__eq__(self, other)
Equality testing.
__ge__(self, other)
Greater-than or equal comparison.
__getitem__(self, i)
__gt__(self, other)
Strictly greater-than comparison.
__init__(self, value=None, shape=None)
Initialize a secure array.
 
The given value must be None, a Future, or a finite field array of correct type.
If value is None (default) or a Future, shape must not be None.
 
The given shape must be a (possibly empty) tuple of nonnegative integers.
If shape is None (default), value should be a finite field array.
__iter__(self)
__le__(self, other)
Less-than or equal comparison.
__len__(self)
__lt__(self, other)
Strictly less-than comparison.
__matmul__(self, other)
Matrix multiplication.
__mul__(self, other)
Multiplication.
__ne__(self, other)
Negated equality testing.
__neg__(self)
Matrix negation.
__pow__(self, other)
Exponentiation for public integral exponent.
__radd__ = __add__(self, other)
__rmatmul__(self, other)
Matrix multiplication (with reflected arguments).
__rmul__ = __mul__(self, other)
__rsub__(self, other)
Matrix subtraction.
__rtruediv__(self, other)
Division (with reflected arguments).
__sub__(self, other)
Matrix subtraction.
__truediv__(self, other)
Division.
argmax(self, *args, **kwargs)
Returns the indices of the maximum values along an axis.
 
If no axis is given (default), array is flattened first.
 
By default, the indices are returned as unit vectors.
Also, by default, the maximum values are returned (next to the indices).
 
NB: Different defaults than for np_argmax(). Latter behaves like np.argmax()
for NumPy arrays, returning the indices as numbers and omitting the maximum values.
argmin(self, *args, **kwargs)
Returns the indices of the minimum values along an axis.
 
If no axis is given (default), array is flattened first.
 
By default, the indices are returned as unit vectors.
Also, by default, the minimum values are returned (next to the indices).
 
NB: Different defaults than for np_argmin(). Latter behaves like np.argmin()
for NumPy arrays, returning the indices as numbers and omitting the minimum values.
copy(self, order='C')
flatten(self, order='C')
reshape(self, *shape, order='C')
sort(self, *args, **kwargs)
Returns new array sorted along an axis.
 
By default, axis=-1.
If axis is None, the array is flattened.
sum(self, *args, **kwargs)
swapaxes(self, axis1, axis2)
tolist(self)
transpose(self, *axes)

Readonly properties defined here:
T
flat
ndim
size

Data descriptors defined here:
shape

Data and other attributes defined here:
__annotations__ = {'sectype': <class 'type'>}
__hash__ = None

Methods inherited from mpyc.asyncoro.SecureObject:
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).
__deepcopy__(self, memo)
Let SecureObjects behave as immutable objects.
 
Introduced for github.com/meilof/oblif.
set_share(self, value)
Set share to the given value.
 
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.

Data descriptors inherited from mpyc.asyncoro.SecureObject:
share

 
class SecureFiniteField(SecureNumber)
    SecureFiniteField(value=None)
 
Base class for secure (secret-shared) finite field elements.
 
NB: bit-oriented operations will be supported for prime fields.
 
 
Method resolution order:
SecureFiniteField
SecureNumber
mpyc.asyncoro.SecureObject
builtins.object

Methods defined here:
__abs__(self)
Currently no support at all.
__and__(self, other)
Bitwise and for binary fields (otherwise 1-bit only).
__divmod__(self, other)
Currently no support at all.
__floordiv__(self, other)
Currently no support at all.
__ge__(self, other)
Currently no support at all.
__gt__(self, other)
Currently no support at all.
__init__(self, value=None)
Initialize a secure finite field element.
 
Value must be None, int, or correct field type.
__invert__(self)
Bitwise not (inversion) for binary fields (otherwise 1-bit only).
__le__(self, other)
Currently no support at all.
__lshift__(self, other)
Currently no support at all.
__lt__(self, other)
Currently no support at all.
__mod__(self, other)
Currently no support at all.
__or__(self, other)
Bitwise or for binary fields (otherwise 1-bit only).
__rdivmod__(self, other)
Currently no support at all.
__rfloordiv__(self, other)
Currently no support at all.
__rlshift__(self, other)
Currently no support at all.
__rmod__(self, other)
Currently no support at all.
__rrshift__(self, other)
Currently no support at all.
__rshift__(self, other)
Currently no support at all.
__xor__(self, other)
Bitwise exclusive-or for binary fields (otherwise 1-bit only).

Data and other attributes defined here:
__annotations__ = {'field': <class 'type'>, 'subfield': <class 'type'>}
frac_length = 0

Methods inherited from SecureNumber:
__add__(self, other)
Addition.
__eq__(self, other)
Equality testing.
__mul__(self, other)
Multiplication.
 
Special case: repeat of additive group operation.
__ne__(self, other)
Negated equality testing.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__pow__(self, other)
Exponentiation for public integral exponent.
__radd__ = __add__(self, other)
__rand__ = __and__(self, other)
Bitwise and, for now 1-bit only.
__rmul__ = __mul__(self, other)
__ror__ = __or__(self, other)
Bitwise or, for now 1-bit only.
__rpow__(self, other)
Exponentiation (with reflected arguments) for secret exponent.
 
Special case: repeat of multiplicative group operation.
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__rxor__(self, other)
Bitwise exclusive-or, for now 1-bit only.
 
Special case: repeat of finite group operation.
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
if_else(self, x, y)
Use SecureNumber as condition for secure selection between x and y.
if_swap(self, x, y)
Use SecureNumber as condition for secure swap of x and y.

Data and other attributes inherited from SecureNumber:
__hash__ = None
bit_length = None

Methods inherited from mpyc.asyncoro.SecureObject:
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).
__bool__(self)
Use of secret-shared objects in Boolean expressions makes no sense.
__deepcopy__(self, memo)
Let SecureObjects behave as immutable objects.
 
Introduced for github.com/meilof/oblif.
set_share(self, value)
Set share to the given value.
 
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.

Data descriptors inherited from mpyc.asyncoro.SecureObject:
share

 
class SecureFiniteFieldArray(SecureArray)
    SecureFiniteFieldArray(value=None, shape=None)
 
Base class for secure (secret-shared) arrays of finite field elements.
 
 
Method resolution order:
SecureFiniteFieldArray
SecureArray
mpyc.asyncoro.SecureObject
builtins.object

Methods defined here:
__init__(self, value=None, shape=None)
Initialize a secure finite field array to the given value.
 
If value is None (default), shape must not be None.
The given value must be array of the appropriate type (int/polynomial/finite field array).
The given shape must be a (possibly empty) tuple of nonnegative integers.

Data and other attributes defined here:
__annotations__ = {}
frac_length = 0

Methods inherited from SecureArray:
__abs__(self)
Matrix absolute value.
__add__(self, other)
Matrix addition.
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__bool__(self)
Return True if secure array is nonempty, False otherwise.
__eq__(self, other)
Equality testing.
__ge__(self, other)
Greater-than or equal comparison.
__getitem__(self, i)
__gt__(self, other)
Strictly greater-than comparison.
__iter__(self)
__le__(self, other)
Less-than or equal comparison.
__len__(self)
__lt__(self, other)
Strictly less-than comparison.
__matmul__(self, other)
Matrix multiplication.
__mul__(self, other)
Multiplication.
__ne__(self, other)
Negated equality testing.
__neg__(self)
Matrix negation.
__pow__(self, other)
Exponentiation for public integral exponent.
__radd__ = __add__(self, other)
__rmatmul__(self, other)
Matrix multiplication (with reflected arguments).
__rmul__ = __mul__(self, other)
__rsub__(self, other)
Matrix subtraction.
__rtruediv__(self, other)
Division (with reflected arguments).
__sub__(self, other)
Matrix subtraction.
__truediv__(self, other)
Division.
argmax(self, *args, **kwargs)
Returns the indices of the maximum values along an axis.
 
If no axis is given (default), array is flattened first.
 
By default, the indices are returned as unit vectors.
Also, by default, the maximum values are returned (next to the indices).
 
NB: Different defaults than for np_argmax(). Latter behaves like np.argmax()
for NumPy arrays, returning the indices as numbers and omitting the maximum values.
argmin(self, *args, **kwargs)
Returns the indices of the minimum values along an axis.
 
If no axis is given (default), array is flattened first.
 
By default, the indices are returned as unit vectors.
Also, by default, the minimum values are returned (next to the indices).
 
NB: Different defaults than for np_argmin(). Latter behaves like np.argmin()
for NumPy arrays, returning the indices as numbers and omitting the minimum values.
copy(self, order='C')
flatten(self, order='C')
reshape(self, *shape, order='C')
sort(self, *args, **kwargs)
Returns new array sorted along an axis.
 
By default, axis=-1.
If axis is None, the array is flattened.
sum(self, *args, **kwargs)
swapaxes(self, axis1, axis2)
tolist(self)
transpose(self, *axes)

Readonly properties inherited from SecureArray:
T
flat
ndim
size

Data descriptors inherited from SecureArray:
shape

Data and other attributes inherited from SecureArray:
__hash__ = None

Methods inherited from mpyc.asyncoro.SecureObject:
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).
__deepcopy__(self, memo)
Let SecureObjects behave as immutable objects.
 
Introduced for github.com/meilof/oblif.
set_share(self, value)
Set share to the given value.
 
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.

Data descriptors inherited from mpyc.asyncoro.SecureObject:
share

 
class SecureFixedPoint(SecureNumber)
    SecureFixedPoint(value=None, integral=None)
 
Base class for secure (secret-shared) fixed-point numbers.
 
 
Method resolution order:
SecureFixedPoint
SecureNumber
mpyc.asyncoro.SecureObject
builtins.object

Methods defined here:
__init__(self, value=None, integral=None)
Initialize a secure fixed-point number.
 
Value must be None, int, float, or correct field type.
 
Boolean flag integral sets the attribute integral of the secure fixed-point number.
If integral=True or integral=False, the attribute integral is set accordingly.
Otherwise, if integral=None (not set), the attribute integral is inferred from value
(set to True if value is a whole number of type int or float).

Data descriptors defined here:
integral

Data and other attributes defined here:
__annotations__ = {'field': <class 'type'>}
frac_length = 0

Methods inherited from SecureNumber:
__abs__(self)
Absolute value.
__add__(self, other)
Addition.
__and__(self, other)
Bitwise and, for now 1-bit only.
__divmod__(self, other)
Integer division with public divisor.
__eq__(self, other)
Equality testing.
__floordiv__(self, other)
Integer quotient with public divisor.
__ge__(self, other)
Greater-than or equal comparison.
__gt__(self, other)
Strictly greater-than comparison.
__invert__(self)
Bitwise not (inversion), for now 1-bit only.
__le__(self, other)
Less-than or equal comparison.
__lshift__(self, other)
Left shift with public integral offset.
__lt__(self, other)
Strictly less-than comparison.
__mod__(self, other)
Integer remainder with public divisor.
__mul__(self, other)
Multiplication.
 
Special case: repeat of additive group operation.
__ne__(self, other)
Negated equality testing.
__neg__(self)
Negation.
__or__(self, other)
Bitwise or, for now 1-bit only.
__pos__(self)
Unary +.
__pow__(self, other)
Exponentiation for public integral exponent.
__radd__ = __add__(self, other)
__rand__ = __and__(self, other)
__rdivmod__(self, other)
Integer division (with reflected arguments).
__rfloordiv__(self, other)
Integer quotient (with reflected arguments).
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmod__(self, other)
Integer remainder (with reflected arguments).
__rmul__ = __mul__(self, other)
__ror__ = __or__(self, other)
__rpow__(self, other)
Exponentiation (with reflected arguments) for secret exponent.
 
Special case: repeat of multiplicative group operation.
__rrshift__(self, other)
Right shift (with reflected arguments).
__rshift__(self, other)
Right shift with public integral offset.
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__rxor__(self, other)
Bitwise exclusive-or, for now 1-bit only.
 
Special case: repeat of finite group operation.
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
__xor__(self, other)
Bitwise exclusive-or, for now 1-bit only.
if_else(self, x, y)
Use SecureNumber as condition for secure selection between x and y.
if_swap(self, x, y)
Use SecureNumber as condition for secure swap of x and y.

Data and other attributes inherited from SecureNumber:
__hash__ = None
bit_length = None

Methods inherited from mpyc.asyncoro.SecureObject:
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).
__bool__(self)
Use of secret-shared objects in Boolean expressions makes no sense.
__deepcopy__(self, memo)
Let SecureObjects behave as immutable objects.
 
Introduced for github.com/meilof/oblif.
set_share(self, value)
Set share to the given value.
 
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.

Data descriptors inherited from mpyc.asyncoro.SecureObject:
share

 
class SecureFixedPointArray(SecureArray)
    SecureFixedPointArray(value=None, shape=None, integral=None)
 
Base class for secure (secret-shared) arrays of fixed-point numbers.
 
 
Method resolution order:
SecureFixedPointArray
SecureArray
mpyc.asyncoro.SecureObject
builtins.object

Methods defined here:
__init__(self, value=None, shape=None, integral=None)
Initialize a secure fixed-point array to the given value.
 
If value is None (default), shape must not be None.
The given value must be an array of the appropriate type (int/float/finite field array).
The given shape must be a (possibly empty) tuple of nonnegative integers.

Data descriptors defined here:
integral

Data and other attributes defined here:
__annotations__ = {}
frac_length = 0

Methods inherited from SecureArray:
__abs__(self)
Matrix absolute value.
__add__(self, other)
Matrix addition.
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__bool__(self)
Return True if secure array is nonempty, False otherwise.
__eq__(self, other)
Equality testing.
__ge__(self, other)
Greater-than or equal comparison.
__getitem__(self, i)
__gt__(self, other)
Strictly greater-than comparison.
__iter__(self)
__le__(self, other)
Less-than or equal comparison.
__len__(self)
__lt__(self, other)
Strictly less-than comparison.
__matmul__(self, other)
Matrix multiplication.
__mul__(self, other)
Multiplication.
__ne__(self, other)
Negated equality testing.
__neg__(self)
Matrix negation.
__pow__(self, other)
Exponentiation for public integral exponent.
__radd__ = __add__(self, other)
__rmatmul__(self, other)
Matrix multiplication (with reflected arguments).
__rmul__ = __mul__(self, other)
__rsub__(self, other)
Matrix subtraction.
__rtruediv__(self, other)
Division (with reflected arguments).
__sub__(self, other)
Matrix subtraction.
__truediv__(self, other)
Division.
argmax(self, *args, **kwargs)
Returns the indices of the maximum values along an axis.
 
If no axis is given (default), array is flattened first.
 
By default, the indices are returned as unit vectors.
Also, by default, the maximum values are returned (next to the indices).
 
NB: Different defaults than for np_argmax(). Latter behaves like np.argmax()
for NumPy arrays, returning the indices as numbers and omitting the maximum values.
argmin(self, *args, **kwargs)
Returns the indices of the minimum values along an axis.
 
If no axis is given (default), array is flattened first.
 
By default, the indices are returned as unit vectors.
Also, by default, the minimum values are returned (next to the indices).
 
NB: Different defaults than for np_argmin(). Latter behaves like np.argmin()
for NumPy arrays, returning the indices as numbers and omitting the minimum values.
copy(self, order='C')
flatten(self, order='C')
reshape(self, *shape, order='C')
sort(self, *args, **kwargs)
Returns new array sorted along an axis.
 
By default, axis=-1.
If axis is None, the array is flattened.
sum(self, *args, **kwargs)
swapaxes(self, axis1, axis2)
tolist(self)
transpose(self, *axes)

Readonly properties inherited from SecureArray:
T
flat
ndim
size

Data descriptors inherited from SecureArray:
shape

Data and other attributes inherited from SecureArray:
__hash__ = None

Methods inherited from mpyc.asyncoro.SecureObject:
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).
__deepcopy__(self, memo)
Let SecureObjects behave as immutable objects.
 
Introduced for github.com/meilof/oblif.
set_share(self, value)
Set share to the given value.
 
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.

Data descriptors inherited from mpyc.asyncoro.SecureObject:
share

 
class SecureFloat(SecureNumber)
    SecureFloat(value=None)
 
Base class for secure (secret-shared) floating-point numbers.
 
Basic arithmetic +,-,*,/ and comparisons <,<=,--,>,>=,!= are supported for secure floats,
as well as input()/output() and sorting operations like min()/argmax()/sorted().
Other operations like sum()/prod()/all()/any()/in_prod() are currently not supported for
secure floats.
 
Implementation is kept simple, representing a secure float as a pair consisting of
a secure fixed-point number for the significand and a secure integer for the exponent.
Note, however, that even basic arithmetic +,-,*,/ with secure floats is very
demanding performance-wise (due to dependence on secure bitwise operations).
 
 
Method resolution order:
SecureFloat
SecureNumber
mpyc.asyncoro.SecureObject
builtins.object

Methods defined here:
__abs__(self)
Absolute value.
__add__(self, other)
Addition.
__eq__(self, other)
Equality testing.
__ge__(self, other)
Greater-than or equal comparison.
__gt__(self, other)
Strictly greater-than comparison.
__init__(self, value=None)
Initialize a secure floating-point number.
 
Value must be None, int, or float.
__le__(self, other)
Less-than or equal comparison.
__lt__(self, other)
Strictly less-than comparison.
__mul__(self, other)
Multiplication.
__ne__(self, other)
Negated equality testing.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__radd__ = __add__(self, other)
__rmul__ = __mul__(self, other)
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
reciprocal(self)
Secure reciprocal (multiplicative inverse).
set_share(self, value)
Set share to the given value.
 
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.

Static methods defined here:
is_zero_public(a)
Called by runtime.is_zero_public().

Data and other attributes defined here:
__annotations__ = {'exponent_type': <class 'type'>, 'significand_type': <class 'type'>}
__hash__ = None

Methods inherited from SecureNumber:
__and__(self, other)
Bitwise and, for now 1-bit only.
__divmod__(self, other)
Integer division with public divisor.
__floordiv__(self, other)
Integer quotient with public divisor.
__invert__(self)
Bitwise not (inversion), for now 1-bit only.
__lshift__(self, other)
Left shift with public integral offset.
__mod__(self, other)
Integer remainder with public divisor.
__or__(self, other)
Bitwise or, for now 1-bit only.
__pow__(self, other)
Exponentiation for public integral exponent.
__rand__ = __and__(self, other)
__rdivmod__(self, other)
Integer division (with reflected arguments).
__rfloordiv__(self, other)
Integer quotient (with reflected arguments).
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmod__(self, other)
Integer remainder (with reflected arguments).
__ror__ = __or__(self, other)
__rpow__(self, other)
Exponentiation (with reflected arguments) for secret exponent.
 
Special case: repeat of multiplicative group operation.
__rrshift__(self, other)
Right shift (with reflected arguments).
__rshift__(self, other)
Right shift with public integral offset.
__rxor__(self, other)
Bitwise exclusive-or, for now 1-bit only.
 
Special case: repeat of finite group operation.
__xor__(self, other)
Bitwise exclusive-or, for now 1-bit only.
if_else(self, x, y)
Use SecureNumber as condition for secure selection between x and y.
if_swap(self, x, y)
Use SecureNumber as condition for secure swap of x and y.

Data and other attributes inherited from SecureNumber:
bit_length = None

Methods inherited from mpyc.asyncoro.SecureObject:
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).
__bool__(self)
Use of secret-shared objects in Boolean expressions makes no sense.
__deepcopy__(self, memo)
Let SecureObjects behave as immutable objects.
 
Introduced for github.com/meilof/oblif.

Data descriptors inherited from mpyc.asyncoro.SecureObject:
share

 
class SecureInteger(SecureNumber)
    SecureInteger(value=None)
 
Base class for secure (secret-shared) integers.
 
 
Method resolution order:
SecureInteger
SecureNumber
mpyc.asyncoro.SecureObject
builtins.object

Methods defined here:
__init__(self, value=None)
Initialize a secure integer.
 
Value must be None, int, or correct field type.

Data and other attributes defined here:
__annotations__ = {'field': <class 'type'>}
frac_length = 0

Methods inherited from SecureNumber:
__abs__(self)
Absolute value.
__add__(self, other)
Addition.
__and__(self, other)
Bitwise and, for now 1-bit only.
__divmod__(self, other)
Integer division with public divisor.
__eq__(self, other)
Equality testing.
__floordiv__(self, other)
Integer quotient with public divisor.
__ge__(self, other)
Greater-than or equal comparison.
__gt__(self, other)
Strictly greater-than comparison.
__invert__(self)
Bitwise not (inversion), for now 1-bit only.
__le__(self, other)
Less-than or equal comparison.
__lshift__(self, other)
Left shift with public integral offset.
__lt__(self, other)
Strictly less-than comparison.
__mod__(self, other)
Integer remainder with public divisor.
__mul__(self, other)
Multiplication.
 
Special case: repeat of additive group operation.
__ne__(self, other)
Negated equality testing.
__neg__(self)
Negation.
__or__(self, other)
Bitwise or, for now 1-bit only.
__pos__(self)
Unary +.
__pow__(self, other)
Exponentiation for public integral exponent.
__radd__ = __add__(self, other)
__rand__ = __and__(self, other)
__rdivmod__(self, other)
Integer division (with reflected arguments).
__rfloordiv__(self, other)
Integer quotient (with reflected arguments).
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmod__(self, other)
Integer remainder (with reflected arguments).
__rmul__ = __mul__(self, other)
__ror__ = __or__(self, other)
__rpow__(self, other)
Exponentiation (with reflected arguments) for secret exponent.
 
Special case: repeat of multiplicative group operation.
__rrshift__(self, other)
Right shift (with reflected arguments).
__rshift__(self, other)
Right shift with public integral offset.
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__rxor__(self, other)
Bitwise exclusive-or, for now 1-bit only.
 
Special case: repeat of finite group operation.
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
__xor__(self, other)
Bitwise exclusive-or, for now 1-bit only.
if_else(self, x, y)
Use SecureNumber as condition for secure selection between x and y.
if_swap(self, x, y)
Use SecureNumber as condition for secure swap of x and y.

Data and other attributes inherited from SecureNumber:
__hash__ = None
bit_length = None

Methods inherited from mpyc.asyncoro.SecureObject:
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).
__bool__(self)
Use of secret-shared objects in Boolean expressions makes no sense.
__deepcopy__(self, memo)
Let SecureObjects behave as immutable objects.
 
Introduced for github.com/meilof/oblif.
set_share(self, value)
Set share to the given value.
 
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.

Data descriptors inherited from mpyc.asyncoro.SecureObject:
share

 
class SecureIntegerArray(SecureArray)
    SecureIntegerArray(value=None, shape=None)
 
Base class for secure (secret-shared) integer arrays.
 
 
Method resolution order:
SecureIntegerArray
SecureArray
mpyc.asyncoro.SecureObject
builtins.object

Methods defined here:
__init__(self, value=None, shape=None)
Initialize a secure integer array to the given value.
 
If value is None (default), shape must not be None.
The given value must be array of the appropriate type (int/finite field array).
The given shape must be a (possibly empty) tuple of nonnegative integers.

Data and other attributes defined here:
__annotations__ = {}
frac_length = 0

Methods inherited from SecureArray:
__abs__(self)
Matrix absolute value.
__add__(self, other)
Matrix addition.
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__bool__(self)
Return True if secure array is nonempty, False otherwise.
__eq__(self, other)
Equality testing.
__ge__(self, other)
Greater-than or equal comparison.
__getitem__(self, i)
__gt__(self, other)
Strictly greater-than comparison.
__iter__(self)
__le__(self, other)
Less-than or equal comparison.
__len__(self)
__lt__(self, other)
Strictly less-than comparison.
__matmul__(self, other)
Matrix multiplication.
__mul__(self, other)
Multiplication.
__ne__(self, other)
Negated equality testing.
__neg__(self)
Matrix negation.
__pow__(self, other)
Exponentiation for public integral exponent.
__radd__ = __add__(self, other)
__rmatmul__(self, other)
Matrix multiplication (with reflected arguments).
__rmul__ = __mul__(self, other)
__rsub__(self, other)
Matrix subtraction.
__rtruediv__(self, other)
Division (with reflected arguments).
__sub__(self, other)
Matrix subtraction.
__truediv__(self, other)
Division.
argmax(self, *args, **kwargs)
Returns the indices of the maximum values along an axis.
 
If no axis is given (default), array is flattened first.
 
By default, the indices are returned as unit vectors.
Also, by default, the maximum values are returned (next to the indices).
 
NB: Different defaults than for np_argmax(). Latter behaves like np.argmax()
for NumPy arrays, returning the indices as numbers and omitting the maximum values.
argmin(self, *args, **kwargs)
Returns the indices of the minimum values along an axis.
 
If no axis is given (default), array is flattened first.
 
By default, the indices are returned as unit vectors.
Also, by default, the minimum values are returned (next to the indices).
 
NB: Different defaults than for np_argmin(). Latter behaves like np.argmin()
for NumPy arrays, returning the indices as numbers and omitting the minimum values.
copy(self, order='C')
flatten(self, order='C')
reshape(self, *shape, order='C')
sort(self, *args, **kwargs)
Returns new array sorted along an axis.
 
By default, axis=-1.
If axis is None, the array is flattened.
sum(self, *args, **kwargs)
swapaxes(self, axis1, axis2)
tolist(self)
transpose(self, *axes)

Readonly properties inherited from SecureArray:
T
flat
ndim
size

Data descriptors inherited from SecureArray:
shape

Data and other attributes inherited from SecureArray:
__hash__ = None

Methods inherited from mpyc.asyncoro.SecureObject:
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).
__deepcopy__(self, memo)
Let SecureObjects behave as immutable objects.
 
Introduced for github.com/meilof/oblif.
set_share(self, value)
Set share to the given value.
 
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.

Data descriptors inherited from mpyc.asyncoro.SecureObject:
share

 
class SecureNumber(mpyc.asyncoro.SecureObject)
    SecureNumber(value=None)
 
Base class for secure (secret-shared) numbers.
 
 
Method resolution order:
SecureNumber
mpyc.asyncoro.SecureObject
builtins.object

Methods defined here:
__abs__(self)
Absolute value.
__add__(self, other)
Addition.
__and__(self, other)
Bitwise and, for now 1-bit only.
__divmod__(self, other)
Integer division with public divisor.
__eq__(self, other)
Equality testing.
__floordiv__(self, other)
Integer quotient with public divisor.
__ge__(self, other)
Greater-than or equal comparison.
__gt__(self, other)
Strictly greater-than comparison.
__invert__(self)
Bitwise not (inversion), for now 1-bit only.
__le__(self, other)
Less-than or equal comparison.
__lshift__(self, other)
Left shift with public integral offset.
__lt__(self, other)
Strictly less-than comparison.
__mod__(self, other)
Integer remainder with public divisor.
__mul__(self, other)
Multiplication.
 
Special case: repeat of additive group operation.
__ne__(self, other)
Negated equality testing.
__neg__(self)
Negation.
__or__(self, other)
Bitwise or, for now 1-bit only.
__pos__(self)
Unary +.
__pow__(self, other)
Exponentiation for public integral exponent.
__radd__ = __add__(self, other)
__rand__ = __and__(self, other)
__rdivmod__(self, other)
Integer division (with reflected arguments).
__rfloordiv__(self, other)
Integer quotient (with reflected arguments).
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmod__(self, other)
Integer remainder (with reflected arguments).
__rmul__ = __mul__(self, other)
__ror__ = __or__(self, other)
__rpow__(self, other)
Exponentiation (with reflected arguments) for secret exponent.
 
Special case: repeat of multiplicative group operation.
__rrshift__(self, other)
Right shift (with reflected arguments).
__rshift__(self, other)
Right shift with public integral offset.
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__rxor__(self, other)
Bitwise exclusive-or, for now 1-bit only.
 
Special case: repeat of finite group operation.
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
__xor__(self, other)
Bitwise exclusive-or, for now 1-bit only.
if_else(self, x, y)
Use SecureNumber as condition for secure selection between x and y.
if_swap(self, x, y)
Use SecureNumber as condition for secure swap of x and y.

Data and other attributes defined here:
__annotations__ = {}
__hash__ = None
bit_length = None

Methods inherited from mpyc.asyncoro.SecureObject:
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).
__bool__(self)
Use of secret-shared objects in Boolean expressions makes no sense.
__deepcopy__(self, memo)
Let SecureObjects behave as immutable objects.
 
Introduced for github.com/meilof/oblif.
__init__(self, value=None)
Initialize share.
 
If value is None (default), the SecureObject starts out as an empty
placeholder (implemented as a Future).
set_share(self, value)
Set share to the given value.
 
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.

Data descriptors inherited from mpyc.asyncoro.SecureObject:
share

 
Functions
       
SecFld(order=None, modulus=None, char=None, ext_deg=None, min_order=None, signed=False)
Secure finite field of order q = p**d.
 
Order q >= min_order.
Field is prime (d = 1) by default and if modulus is prime.
Extension degree d > 1 if order is a prime power p**d with d > 1,
if modulus is a polynomial or a string or an integer > char,
or if ext_deg is an integer > 1, or if min_order > char.
SecFlt(l=None, s=None, e=None)
Secure l-bit floating-point number with s-bit significand and e-bit exponent, where l=s+e.
 
The significand is an (s+1)-bit secure (signed) fixed-point number. The absolute value
of a nonzero significand is normalized between 0.5 and 1.0. Here, both 0.5 and 1.0 are
included and therefore one extra bit is used.
The exponent is an e-bit secure (signed) integer.
SecFxp(l=None, f=None, p=None, n=2)
Secure l-bit fixed-point numbers with f-bit fractional part.
 
NB: if dividing secure fixed-point numbers, make sure that l =~ 2f.
SecInt(l=None, p=None, n=2)
Secure l-bit integers.
__array_function__(self, func, types, args, kwargs)
Redirect __array_function__ call to array class, if any.
 
To support calls like np.block([[secint(9), -1], [1, secint(7)]]).
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
Delegate __array_ufunc__ call to corresponding operator call.
 
Provisional support for calls like np.less(secint(9), 10).

 
Data
        binary_ops = {<ufunc 'less'>: <built-in function lt>, <ufunc 'less_equal'>: <built-in function le>, <ufunc 'equal'>: <built-in function eq>, <ufunc 'not_equal'>: <built-in function ne>, <ufunc 'greater'>: <built-in function gt>, <ufunc 'greater_equal'>: <built-in function ge>, <ufunc 'add'>: <built-in function add>, <ufunc 'subtract'>: <built-in function sub>, <ufunc 'multiply'>: <built-in function mul>, <ufunc 'divide'>: <built-in function truediv>, ...}
runtime = None
unary_ops = {<ufunc 'negative'>: <built-in function neg>, <ufunc 'positive'>: <built-in function pos>, <ufunc 'absolute'>: <built-in function abs>}