Giter Site home page Giter Site logo

n1ghtf1re / public-key-ciphers Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 1.0 42 KB

The implementation of the public key ciphers: Elgamal

License: MIT License

Java 100.00%
public-key-cryptography public-key-encrption elgamal elgamal-encryption cryptography

public-key-ciphers's Introduction

Public-Key-Ciphers

Stars Total Downloads Latest Stable Version License

About the library

The library contains one public key ciphers: Elgamal

Class Elgamal:

Constructors:

  • Elgamal(long p, long x, long k) . p - prime number, x - Private key, number of range (1; p - 1), Session key, mutually prime with p number of range (1; p - 1)

Methods:

  • encrypt(byte[] plaintext) - Encodes an array of bytes
    • One byte of source array turns into two elements of the array of ints.
      • CIPHERTEXT[i] = g^k mod p
      • CIPHERTEXT[i+1] = (y^k * PlAINTEXT[i/2]) mod p
  • decrypt(byte[]) - Decodes an array of ints
    • Two elements of ciphertext array (int[]) turns into one byte of plaintext array
      • (b = ciphertext[i + 1], a = ciphertext[i])
      • PLAINTEXT[i/2] = ( b * (a^x)^-1 ) mod p = (b * (a^x)^(phi(p) - 1)) mod p, phi - Euler function
  • getPublicKey() - return Public Key object (p, g, y)

public-key-ciphers's People

Contributors

n1ghtf1re avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

raimundojimenez

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.