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

📄 evo_time.cpp

📁 ElGamal 数字签名源码
💻 CPP
字号:
// evo_time.cpp : implementation file
//

#include "stdafx.h"
#include "forward_secure.h"
#include "evo_time.h"
#include "BigInt.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// evo_time dialog


evo_time::evo_time(CWnd* pParent /*=NULL*/)
	: CDialog(evo_time::IDD, pParent)
{
	//{{AFX_DATA_INIT(evo_time)
	m_tav = 0.0f;
	m_t4 = 0.0f;
	m_t5 = 0.0f;
	m_t6 = 0.0f;
	m_t7 = 0.0f;
	m_t8 = 0.0f;
	m_t9 = 0.0f;
	m_t10 = 0.0f;
	m_t11 = 0.0f;
	m_t3 = 0.0f;
	m_t2 = 0.0f;
	//}}AFX_DATA_INIT
}


void evo_time::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(evo_time)
	DDX_Text(pDX, IDC_tave, m_tav);
	DDX_Text(pDX, IDC_t4, m_t4);
	DDX_Text(pDX, IDC_t5, m_t5);
	DDX_Text(pDX, IDC_t6, m_t6);
	DDX_Text(pDX, IDC_t7, m_t7);
	DDX_Text(pDX, IDC_t8, m_t8);
	DDX_Text(pDX, IDC_t9, m_t9);
	DDX_Text(pDX, IDC_t10, m_t10);
	DDX_Text(pDX, IDC_t11, m_t11);
	DDX_Text(pDX, IDC_t3, m_t3);
	DDX_Text(pDX, IDC_t2, m_t2);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(evo_time, CDialog)
	//{{AFX_MSG_MAP(evo_time)
	ON_BN_CLICKED(IDC_BUTTONcal, OnBUTTONcal)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// evo_time message handlers

BOOL evo_time::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
          // EXCEPTION: OCX Property Pages should return FALSE
  
}



void evo_time::OnBUTTONcal() 
{
	// TODO: Add your control notification handler code here
LARGE_INTEGER litmp;
LONGLONG QPart1,QPart2;
double dfMinus,dfFreq,dfTim;
QueryPerformanceFrequency(&litmp);
dfFreq=(double)litmp.QuadPart;
float evo_time[10],t_sum=0;
int tempi;
CBigInt tempk,temps,tempR,temp1,temp2;
tempk.Mov(k);
tempR.Mov(R);
temps.Mov(s);
tempi=timemark;
for(int i=0;i<10;i++)
{
	tempi++;
	QueryPerformanceCounter(&litmp);
	QPart1 = litmp.QuadPart;
	do{
        temp1=g.RsaTrans(tempk,p);
		tempR=tempR.Mul(temp1);
		tempR=tempR.Mod(p);
		temp2=tempR.Mul(tempR);
        temp2=temp2.Mod(p);
		temps=tempk.Add(tempk);
        temps=temps.Add(tempi);
        temps=temps.Add(s);
		temps=temps.Mod(p.Sub(1));
		tempk=tempk.Mul(tempk);
		tempk=tempk.Mod(q);
	}
	while((temps.m_nLength==1&&temps.m_ulValue[0]==0)
		||(temp1.m_nLength==1&&temp1.m_ulValue[0]==1)
		||(temp2.m_nLength==1&&temp2.m_ulValue[0]==1));
    QueryPerformanceCounter(&litmp); 
	QPart2=litmp.QuadPart;
	dfMinus=(double)(QPart2-QPart1);
	dfTim=dfMinus/dfFreq;
	evo_time[i]=(float)dfTim*1000;
	t_sum=t_sum+evo_time[i];
}
   m_tav=t_sum/10; 
   m_t2=evo_time[0];
   m_t3=evo_time[1];
   m_t4=evo_time[2];
   m_t5=evo_time[3];
   m_t6=evo_time[4];
   m_t7=evo_time[5];
   m_t8=evo_time[6];
   m_t9=evo_time[7];
   m_t10=evo_time[8];
   m_t11=evo_time[9];
		
   UpdateData(false);  
/*do{

k1.GetBigInt(t_length);
temp3=g.RsaTrans(k1,p);
temp4=temp3.Mul(temp3);
temp4=temp4.Mod(p);
temp1=k1.Add(k1);
temp1=temp1.Add(1);
temp1=temp1.Add(s);
temp2=temp1.Mod(p.Sub(1));} 
while((temp2.m_nLength==1&&temp2.m_ulValue[0]==0)||(temp4.m_nLength==1&&temp4.m_ulValue[0]==1));
*/
	
}

⌨️ 快捷键说明

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