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:-