Monday, October 22, 2018

Elliptic curve cryptography using C programming language


This is a code for Elliptic curve cryptography using C programming language.



Elliptic curve cryptography:-
Source code:-

#include <iostream>
#include<math.h>
using namespace std;

int main(){
    int p,a,b,x,y;
    float temp;
    cin>>p>>a>>b;
    x = 0;
    cout<<"x\t"<<"y\t"<<"points"<<endl;
    while(x<p){
        temp = sqrt(((x*x*x) + x + 1) % p);
        y = temp;
        if(y == temp)
        {
            cout<<x<<"\t";
            cout<<y<<"\t";
            cout<<"("<<x<<","<<y<<") ";
            cout<<"("<<x<<","<<"-"<<y<<")";
        }
        else{
            cout<<x<<"\t";
            cout<<y<<"\t";
            cout<<"-";
            cout<<"-";
        }
        cout<<endl;
        x++;
    }
    return 0;
}


Output:-


Diffie–Hellman key exchange using C programming language

This is a code for  Diffie–Hellman key exchange  using C programming language. Diffie–Hellman key exchange :- Source code:- #in...