Code Monkey home page Code Monkey logo

aes_encryption's Introduction

Key Generation steps

  • Choose a 300-bit prime p.
  • Choose a generator g of the cyclic group Zp*
  • Choose a number a uniformly at random from the set {2, 3, . . . , p - 2}.
  • Compute h = g^a mod p (using square and multiply)
  • PublicKey = (p, g, h)
  • SecretKey = a

Encryption:

The input to this algorithm is a message-file F and the PublicKey (p, g, h). It outputs a encryption of F as follows:

  • Choose a random key K from the set {0,1}^128
  • Compute C1 = AES.Enc(F, K) [using pycrypto]
  • Compute K' = int(K), where int(K) denotes the integer value of K.
  • Choose a number r uniformly at random from the set {0, 1, . . . , p - 2}
  • Compute C2 = g^r mod p, and C3 = K'h^r mod p (square and multiply)
  • Output a ciphertext C = C1, C2, C3

Decryption:

The input to this algorithm is a ciphertext C = C1, C2, C3 and the SecretKey a. It returns a plaintext and file as follows:

  • Compute C2' = C2^a mod p (square and multiply)
  • Compute K' = C3(C2')^-1 mod p (Euclidean algo. for inverse)
  • Compute K = Bin(K'), where Bin(K') turns K' into binary
  • Compute F = AES.Dec(C1, K) [using pycrypto]
  • output F

Python version : 2.7.6 Linux distribution : Ubuntu 14.04.1 LTS

aes_encryption's People

Contributors

sivssdn avatar

Watchers

James Cloos avatar  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.