GithubHelp home page GithubHelp logo

shigoto-dev19 / classic-elgamal-circom Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 196 KB

This repository is featuring a classic ElGamal Scheme implementation in Circom with focus on experimenting with exponentiation in a circuit. Note that this implementation is intentionally insecure and designed for educational purposes.

circom elgamal-encryption

classic-elgamal-circom's Introduction

Description

  • Classic ElGamal Scheme Circuit in Circom
  • Additively Homomorphic Properties (secret encoding => generatorsecret)
  • Mainly for playing around with Exponentiation which is quite challenging in circom.
  • Note:
    • This implementation is not secure and only meant for learning purposes!
    • For further details, refer to the Security section.

Documentation

See this notion page that I wrote for better Understanding Secure ElGamal Encryption Scheme.

Build

npm install to install all dependencies

Test

npm test to run Typescript & Circuit tests.

Note: If you have an error complaining about circom version run rm -rf "./node_modules/circom" to fix the error.

Security

  • Similar to DH encryption, the security of ElGamal Encryption Scheme is based on the assumption of the Discrete Logarithm Problem (DLP).

  • The recommended size for both private keys and public keys should be at least 2,048 bits size-wise (617digits).

  • The private & public keys are constrained to the size of the field element which is around 254 bits ==> The Classic ElGamal implementation in circom is not secure!

  • 2253 already overflows 253-bit unsigned integer ==> to prevent overflows, the possible maximum exponent value is 252.

  • Since 2253 can be described inside the circom integer range(the circom prime number is larger than 2253) ==> not secure for cryptographic algorithms based on the DLP assupmtion.

  • For this POC implementation, the maximum size for the secret is chosen to be ~254 bits which increased the security a little bit but caused overflows that inhibited the homomorphic properties of ElGamal Scheme.

classic-elgamal-circom's People

Contributors

shigoto-dev19 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.