module td_2a.homomorphic
¶
Classes¶
class |
truncated documentation |
---|---|
Implements an « homomorphic integer ». See Homomorphic encryption. … |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
Finds one exposant for the RSA encryption. |
|
Computes the least common multiple (PPCM). |
|
Computes the PGCD. |
Methods¶
method |
truncated documentation |
---|---|
Addition. |
|
Division, implies to find the inverse (so very costly). |
|
Multiplication. |
|
Power operator. |
|
Usual |
|
Soustraction. |
|
Simple permutation. |
|
Crypt a number and preserve multiplication. We use RSA. |
|
Decrypt a number and preserve multiplication. |
|
Decrypt a number and preserve multiplication. |
|
Inversion. This only works in all cases if n is a prime number. We use |
|
Returns a |
Documentation¶
Implements « homomorphic number ».
-
class
ensae_teaching_cs.td_2a.homomorphic.
HomomorphicInt
(value, p=673, q=821, e=None)¶ Bases :
object
Implements an « homomorphic integer ». See Homomorphic encryption.
- Paramètres
value – initial value
p – p for RSA
q – q for RSA
e – e for RSA (e, and inverse e)
Other prime numbers can be found at The First 100,008 Primes.
-
__add__
(o)¶ Addition.
-
__div__
(o)¶ Division, implies to find the inverse (so very costly).
-
__init__
(value, p=673, q=821, e=None)¶ - Paramètres
value – initial value
p – p for RSA
q – q for RSA
e – e for RSA (e, and inverse e)
Other prime numbers can be found at The First 100,008 Primes.
-
__mul__
(o)¶ Multiplication.
-
__pow__
(n)¶ Power operator.
-
__repr__
()¶ Usual
-
__slots__
= ['V', 'N', 'P', 'Q', 'E']¶
-
__sub__
(o)¶ Soustraction.
-
crypt_add
()¶ Simple permutation.
-
decrypt_add
()¶ Decrypt a number and preserve multiplication.
-
decrypt_mult
()¶ Decrypt a number and preserve multiplication.
-
inv
()¶ Inversion. This only works in all cases if n is a prime number. We use
. The implementation can be improved (use binary decomposition) and cached.
-
new_int
(v)¶ Returns a
HomomorphicInt
with the same encrypted parameters.