Git Product home page Git Product logo

dhexchange's Introduction

Diffie–Hellman key exchange algorithm

a very simple 128bit Diffie–Hellman key exchange algorithm

Build:

gcc test.c dhexchange.c -o test
./test

the result looks like:

alice_private=  21020c4a4c949fd14d0cf2a2402f2aff
alice_public=   500c1bdba67f00684715fa5cdaf82724
bob_private=    ad7521da95e27fc1e96c4bcda7e650b6
bob_public=     c3e1e42bcb39d2f64b4c222fc6510801
alice_secret=   c5156ec39e8bb1e7940f8dbfd53fd89c
bob_secret=     c5156ec39e8bb1e7940f8dbfd53fd89c

About Diffie–Hellman key exchange

http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange

How to use

(1) Alice: Generate private key and public key

DH_KEY alice_private, alice_public;
DH_generate_key_pair(alice_public, alice_private);

(2) Bob: Generate private key and public key

DH_KEY bob_private, bob_public;
DH_generate_key_pair(bob_public, bob_private);

(3) Exchange: Alice send her public key to Bob, and Bob send his public key to alice

(4) Alice: Generate secret key

DH_KEY alice_secret;
DH_generate_key_secret(alice_secret, alice_private, bob_public);

(5) Bob: Generate secret key

DH_KEY bob_secret;
DH_generate_key_secret(bob_secret, bob_private, alice_public);

dhexchange's People

Contributors

thejinchao 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.