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

📄 ebrick.cpp

📁 miracl-大数运算库,大家使用有什么问题请多多提意见
💻 CPP
字号:
/*
 *   Test program to implement Brickell et al's method for fast
 *   computation of e.G on the elliptic curve E(F_p) for fixed G and E, 
 *   using precomputation. 
 *   This idea can be used to substantially speed up certain phases 
 *   of the Digital Signature Standard (DSS).
 *
 *   See "Fast Exponentiation with Precomputation"
 *   by E. Brickell et al. in Proceedings Eurocrypt 1992
 *
 *   Requires: big.cpp ecn.cpp
 *
 *   Copyright (c) 1988-1997 Shamus Software Ltd.
 */

#include <iostream>
#include <fstream>
#include "ecn.h"
#include "ebrick.h"   /* include MIRACL system */

using namespace std;

Miracl precision=50;

int main()
{
    ifstream common("common.ecs");
    Big a,b,x,y,e,n,r;
    int bits,nb;
    miracl *mip=&precision;
    common >> bits; 
    mip->IOBASE=16;
    common >> n >> a >> b >> r >> x >> y;
    mip->IOBASE=10;

    cout << "Enter size of exponent in bits = ";
    cin >> nb;

    EBrick B(x,y,a,b,n,nb); 

    e=rand(nb,2); /* random exponent */

    cout << "naive method" << endl;
    ecurve(a,b,n,MR_PROJECTIVE);
    ECn G(x,y);
    G*=e;
    G.get(x,y);
    cout << x << endl;

    x=0;
    cout << "Brickell et al. method" << endl;

    B.mul(e,x,y);

    cout << x << endl;
    return 0;
}

⌨️ 快捷键说明

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