.. _f-homomorphic: module ``td_2a.homomorphic`` ============================ .. inheritance-diagram:: ensae_teaching_cs.td_2a.homomorphic Short summary +++++++++++++ module ``ensae_teaching_cs.td_2a.homomorphic`` Implements "homomorphic number". :githublink:`%|py|6` Classes +++++++ +------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ | class | truncated documentation | +==============================================================================+================================================================================================================================+ | :class:`HomomorphicInt ` | Implements an "homomorphic integer". See `Homomorphic encryption `_. ... | +------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ Static Methods ++++++++++++++ +----------------------------------------------------------------------------+----------------------------------------------------+ | staticmethod | truncated documentation | +============================================================================+====================================================+ | :meth:`find_e ` | Finds one exposant for the :epkg:`RSA` encryption. | +----------------------------------------------------------------------------+----------------------------------------------------+ | :meth:`lcm ` | Computes the least common multiple (:epkg:`PPCM`). | +----------------------------------------------------------------------------+----------------------------------------------------+ | :meth:`pgcd ` | Computes the :epkg:`PGCD`. | +----------------------------------------------------------------------------+----------------------------------------------------+ Methods +++++++ +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | method | truncated documentation | +========================================================================================+====================================================================================================================+ | :py:meth:`__add__ ` | Addition. | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__div__ ` | Division, implies to find the inverse (so very costly). | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__mul__ ` | Multiplication. | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__pow__ ` | Power operator. | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__repr__ ` | Usual | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__sub__ ` | Soustraction. | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :meth:`crypt_add ` | Simple permutation. | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :meth:`crypt_mult ` | Crypt a number and preserve multiplication. We use `RSA `_. | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :meth:`decrypt_add ` | Decrypt a number and preserve multiplication. | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :meth:`decrypt_mult ` | Decrypt a number and preserve multiplication. | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :meth:`inv ` | Inversion. This only works in all cases if *n* is a prime number. We use :math:`a^{-1} \equiv a^{n-2} \mod n`. ... | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ | :meth:`new_int ` | Returns a :class:`HomomorphicInt` with the same encrypted parameters. | +----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+ Documentation +++++++++++++ .. automodule:: ensae_teaching_cs.td_2a.homomorphic :members: :special-members: __init__ :show-inheritance: