Coder Social home page Coder Social logo

usrbom / network-security Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 11 KB

Zero_Knowledge-proof demonstration using discrete log. Demonstration of 1-2 oblivious transfer protocol.

License: MIT License

Java 100.00%
network-security zero-knowledge discrete-logarithm oblivious-transfer protocol java cryptography

network-security's Introduction

Zero-knowledge-proof

Zero_Knowledge-proof demonstration using discrete log.

Problem:

Peggy wants to prove to Victor that she knows the discrete log of a given value in a given group. Peggy proves to know the value of x (for example her password).

Implementaion:

  • Say g is the generator and p is a large prime.
  • Peggy calculates first for one time the value y = (g^x) mod p and sends the value to Victor.
  • Peggy repeatedly calculates a random value r and C = (g^r) mod p . She tranfers the value C to Victor.
  • Victor requests Peggy the value "r" (i.e. request=0) or "(x+r) mod (p-1)" i.e. request=1.
  • In the first case Victor verifies C = (g^r) mod p. In the second case he verifies C.y = {g^((x+r)mod(p-1))} mod p . This is verified for a fixed number of iterations to ensure Peggy does possess the true value of x.

Oblivious transfer

Demonstration of Rabin's 1-2 oblivious transfer protocol.

Problem:

The sender(Alice) has two messages m0 and m1, and the receiver(Bob) has a bit b, and the receiver wishes to receive mb, without the sender learning b, while the sender wants to ensure that the receiver receives only one of the two messages.

Implementation:

  • Alice chooses two messages m0,m1 along with a RSA key pair, comprising the modulus N, the public exponent e and the private exponent d.
  • Alice generates two random values, x0, x1 and sends them to Bob along with her public modulus and exponent.
  • Bob picks bit b to be either 0 or 1, and selects either the first or second as xb.
  • Bob generates a random value k and blinds xb by computing v = (xb + k^e)mod N , which he sends to Alice. Alice doesn't know (and hopefully cannot determine) which of x0, x1 Bob chose. She applies both of her random values and comes up with two possible values for k i.e. k0 = {(v- x0) ^ d}mod N and k1 = {(v- x1) ^ d}mod N .One of these will be equal to k and can be correctly decrypted by Bob (but not Alice), while the other will produce a meaningless random value that does not reveal any information about k.
  • Alice combines the two secret messages with each of the possible keys, m0' = m0 + k0 and m1' = m1 + k1 , and sends them both to Bob.
  • Bob knows which of the two messages can be unblinded with k, so he is able to compute exactly one of the messages mb = mb' - k.

network-security's People

Contributors

usrbom avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

hossamsamy007

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.