⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ecparameters.java

📁 椭圆曲线相关参数的生成
💻 JAVA
字号:

import java.math.*;
public class ECParameters
{
	
	static BigInteger p;
	static BigInteger a;
	static BigInteger b;
	static ECPoint G;
	static BigInteger n;
	
    //此构造方法是用于接收EC类的参数
	public ECParameters(String str)//str用于区别构造方法
	{
		EC ec=new EC();
		ec.initialize();
		this.p=ec.p;
		this.a=ec.a;
		this.b=ec.b;
		this.G=ec.getECPoint();
		this.n=ec.getGOrdor();
	}
	
	//在此椭圆曲线参数使用的是一组给定的值
	public ECParameters()
	{
		this.p=new BigInteger("BDB6F4FE3E8B1D9E0DA8C0D46F4C318CEFE4AFE3B6B8551F",16);
        this.a=new BigInteger("BB8E5E8FBC115E139FE6A814FE48AAA6F0ADA1AA5DF91985",16);
        this.b=new BigInteger("1854BEBDC31B21B7AEFC80AB0ECD10D5B1B3308E6DBF11C1",16);
        this.G=new ECPoint(new BigInteger("4AD5F7048DE709AD51236DE65E4D4B482C836DC6E4106640",16),new BigInteger("02BB3A02D4AAADACAE24817A4CA3A1B014B5270432DB27D2",16));
        this.n=n=new BigInteger("BDB6F4FE3E8B1D9E0DA8C0D40FC962195DFAE76F56564677",16);

	}
	
	//以下是获取本类参数的一些方法
	static BigInteger getP()
	{
		return p;
	//    return BigInteger.valueOf(23);
	}
	
	static BigInteger getA()
	{
		return a;
	//    return BigInteger.valueOf(1);
	}	
	
	static BigInteger getB()
	{
		return b;
	//	return BigInteger.valueOf(4);
	}
	
	static ECPoint getG()
	{
		return G;
	//    return new ECPointLU(BigInteger.valueOf(0),BigInteger.valueOf(2));
	}
	
	static BigInteger getN()
	{
		return n;
	//    return BigInteger.valueOf(29);
	}
	public static void main(String args[])
	{
		ECParameters ecp=new ECParameters();
		System.out.println("*****************椭圆曲线参数的值*****************");
		System.out.println("参数a的值:"+ecp.getA());
		System.out.println("参数b的值:"+ecp.getB());
		System.out.println("基点G的值:"+ecp.getG());
		System.out.println("基点G的阶值:"+ecp.getN());
		System.out.println("大素数p的值:"+ecp.getP());
		System.out.println("*****************椭圆曲线参数的值*****************");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -