资源简介
本资源内部包含两个CS文件,一个是Program.cs,另一个就是ECC.cs。Program.cs包含怎么将明文编码方式。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft;
namespace _ECC_Graduation_Design_Algorithms
{
class ECCurve
{
#region 椭圆曲线定义
public const double Inf = Double.PositiveInfinity;
private long _a;
public long a
{
get { return _a; }
set { _a = value; }
}
private long _b;
public long b
{
get { return _b; }
set { _b = value; }
}
private long _p;
public long p
{
get { return _p; }
set { _p = value; }
}
private double[] _G = new double[2];
public double[] G
{
get { return _G; }
set { _G = value; }
}
public ECCurve(long along blong pdouble Gxdouble Gy)
{
this._a = a;
this._b = b;
this._p = p;
this._G[0] = Gx;
this._G[1] = Gy;
}
#endregion
#region 全局变量
//私钥
public double k = 25;
//公钥
public double[] K = new double[2];
public double resx;
public double resy;
public double r = 6;
public double[] C1 = new double[2];
public double[] C2 = new double[2];
#endregion
#region 加法模块
//z是斜率
//pos返回点坐标
public double[] Add(double x1 double y1 double x2 double y2)
{
double[] pos = new double[2];
double z;
if (x1==x2&&y1==y2)
{
z = modfrac(3 * x1*x1 + a 2 * y1 p);
resx = Mod((z * z - x1 - x2)p);
resy = Mod((z * (x1 - resx) - y1) p);
}
if (x1 == x2 && y1 != y2)
{
resx = Inf;
resy = Inf;
}
if (x1!=x2)
{
z = modfrac(y2-y1x2-x1p);
resx = Mod (z *z - x1 - x2 p);
resy = Mod(z * (x1 - (double)resx) - y1 p);
}
pos[0] = (double)resx;
pos[1] = (double)resy;
return pos;
}
#endregion
#region 取模运算
//整数取模运算
public double Mod(double x double y)
{
double ans= 0;
if (y!=0)
{
ans = x - y * Math.Floor(x / y);
}
return ans;
}
//分数取模运算
public double modfrac(double ndouble ddouble m)
{
n = (double)Math.IEEERemainder( n m);
d = (double)Math.IEEERemainder(d m);
long i = 1;
while ((double)Math.IEEERemainder(d*im)!=1)
{
i = i+1;
}
return (double)Math.IEEERema
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2082 2019-04-20 16:32 Program.cs
文件 5051 2019-04-20 16:32 ECC.cs
- 上一篇:ArcEngine开发鹰眼功能C#实现
- 下一篇:基于sql与c#的学生选课系统
相关资源
- 压缩和解压(基于ICSharpCode)
- 寿星万年历的c#实现版本sxtwl_csharp_t
- CSharp language specification 5.0中文(C# 语
- Csharp串口通讯
- C# 配置PI数据库服务器(Snapshot )
- Csharp 网上商城代码
- [Csharp高级编程(第6版)].美内格尔
- csharp版64位含GEOS PROJ
- csharp免注册调用大漠插件.zip
- 教务系统c#可运行代码附带数据库
- 鹏哥特色教程之C#入门到精通 基础篇
- protobuf-csharp-3.2.0
- protobuf转换Csharp工具,转换为C#文件
- C#人事管理系统winform版
- C#深度学习源码
- Chart Control :所有 35 种基本图表
- c# winform大全(198个经典Csharp WinForm)
- CSharpGL.zip
- CSharp基础
- C#入门经典(Beginning C# 7 Programming wi
- gdal_csharp开发环境配置
- C# OPC 数据采集 .rar
- C#闹钟&&时钟小程序源代码
- C#(Csharp)多线程HTTP并发请求(Http
- c# 代码编辑控件(代码着色控件)
-
Js to CSharp sc
ript converter - C# 使用Timer控件显示当前时间
- c# DataGridView中添加下拉列表
- 树形列表控件CSharp,WinForm
- CSharp通讯录编程
评论
共有 条评论