Upgrade to PRO for Only $50/Yearโ€”Limited-Time Offer! ๐Ÿ”ฅ

Homomorphic Encryption In Python

Homomorphic Encryption Inย Python

Slides of my talk given at PyData London's 86th meet-up

Avatar for Sefik Serengil

Sefik Serengil

July 03, 2024
Tweet

Other Decks in Programming

Transcript

  1. PyData London โ€˜24 PyData Londonโ€™s 74th Meetup 2023, May 2

    2024, June 16 Billion-Scale Facial Recognition The Art and Science of Deep Face Recognition in Python
  2. sefiks.com @serengil @sefiks serengil On-Prem Cloud encrypted_salary encrypted_salary We cannot

    use the computation power of cloud in this design! encrypted_salary
  3. RSA sefiks.com @serengil @sefiks serengil ๐œ€(๐‘š) = ๐‘š๐‘’๐‘š๐‘œ๐‘‘๐‘› ๐œ€(๐‘š1 )

    = (๐‘š1 )๐‘’๐‘š๐‘œ๐‘‘๐‘› ๐œ€(๐‘š2 ) = (๐‘š2 )๐‘’๐‘š๐‘œ๐‘‘๐‘› ๐œ€(๐‘š1 ) ร— ๐œ€(๐‘š2 ) = (๐‘š1 )๐‘’ ร— (๐‘š2 )๐‘’๐‘š๐‘œ๐‘‘๐‘› ๐œ€(๐‘š1 ) ร— ๐œ€(๐‘š2 ) = (๐‘š1 ร— ๐‘š2 )๐‘’๐‘š๐‘œ๐‘‘๐‘› ๐œ€(๐‘š1 ร— ๐‘š2 ) = (๐‘š1 ร— ๐‘š2 )๐‘’๐‘š๐‘œ๐‘‘๐‘› ๐œ€(๐‘š1 ร— ๐‘š2 ) = ๐œ€(๐‘š1 ) ร— ๐œ€(๐‘š2 ) RSA is multiplicatively homomorphic! https://sefiks.com/2018/05/21/the-math-behind-rsa-algorithm/
  4. Paillier sefiks.com @serengil @sefiks serengil ๐œ€(๐‘š, ๐‘Ÿ) = ๐‘”๐‘š ร—

    ๐‘Ÿ๐‘›๐‘š๐‘œ๐‘‘๐‘›2 ๐œ€(๐‘š1 , ๐‘Ÿ1 ) = ๐‘”๐‘š1 ร— (๐‘Ÿ1 )๐‘›๐‘š๐‘œ๐‘‘๐‘›2 ๐œ€(๐‘š2 , ๐‘Ÿ2 ) = ๐‘”๐‘š2 ร— (๐‘Ÿ2 )๐‘›๐‘š๐‘œ๐‘‘๐‘›2 ๐œ€(๐‘š1 , ๐‘Ÿ1 ) ร— ๐œ€(๐‘š2 , ๐‘Ÿ2 ) = ๐‘”๐‘š1 ร— (๐‘Ÿ1 )๐‘› ร— ๐‘”๐‘š2 ร— (๐‘Ÿ2 )๐‘›๐‘š๐‘œ๐‘‘๐‘›2 ๐œ€(๐‘š1 , ๐‘Ÿ1 ) ร— ๐œ€(๐‘š2 , ๐‘Ÿ2 ) = ๐‘”๐‘š1+๐‘š2 ร— (๐‘Ÿ1 ร— ๐‘Ÿ2 )๐‘›๐‘š๐‘œ๐‘‘๐‘›2 ๐œ€(๐‘š1 + ๐‘š2 , ๐‘Ÿ1 ร— ๐‘Ÿ2 ) = ๐‘”๐‘š1+๐‘š2 ร— (๐‘Ÿ1 ร— ๐‘Ÿ2 )๐‘›๐‘š๐‘œ๐‘‘๐‘›2 ๐œ€(๐‘š1 + ๐‘š2 , ๐‘Ÿ1 ร— ๐‘Ÿ2 ) = ๐œ€(๐‘š1 , ๐‘Ÿ1 ) ร— ๐œ€(๐‘š2 , ๐‘Ÿ2 ) Paillier is additively homomorphic sefiks.com/2023/04/03/a-step-by-step-partially-homomorphic-encryption-example-with-paillier-in-python/
  5. LightPHE A Hybrid Partially Homomorphic Encryption Library for Python โ€ข

    Open sourced at github.com/serengil/LightPHE under MIT license โ€ข Can be installed with command `pip install lightphe` โ€ข Wrapping RSA, ElGamal, Exponential ElGamal, Elliptic Curve ElGamal, Paillier, Damgard-Jurik, Okamotoโ€“Uchiyama, Benaloh, Naccacheโ€“Stern, Goldwasserโ€“Micali โ€ข Stars are welcome! sefiks.com @serengil @sefiks serengil LightPHE
  6. PHE vs FHE โ€ข Notably faster โ€ข Demands fewer computational

    resources โ€ข Generating much smaller ciphertexts โ€ข Distributing much smaller keys โ€ข Well-suited for memory-constrained environments โ€ข Strikes a favorable balance for practical use cases sefiks.com @serengil @sefiks serengil