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

📄 testaes.cpp

📁 aes算法的c++实现及其加密解密过程所需时间的测试,无解压密码
💻 CPP
字号:
// TestAes.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Aes1.h"
#include <iostream.h>
#include<string.h>
#include<stdio.h>
 #include <windows.h>
  


int main(int argc, char* argv[])
{   char s[1000];
     
	 
  SYSTEMTIME  begin,end;
   


  
   
  
 
    
	//BYTE keys[16]=
	//	{0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff};
	  BYTE input[] = {0x00, 0x11, 0x22, 0x33, 0x44,0x55, 
		 0x66, 0x77,0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; 
       
	 BYTE keyBytes[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 
      0x07,0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,0x10, 0x11, 
      0x12, 0x13, 0x14, 0x15, 0x16, 0x17};

//	AES aes( AES::BIT192 , keys);
	 AES  aes(AES::BIT192, keyBytes);
     
//	BYTE* input=new BYTE[1024];	
	BYTE* output=new BYTE[1024];
	 
 
	//sprintf((char*)input,"Hello,world");
	 // for(int i=0;i<sizeof(input);i++)
	  //{cout<<hex<<(int)input[i];
	  //cout<<" ";}
	  //GetSystemTime(&t);
	 // cout<<t.wMilliseconds<<endl;
      GetSystemTime(&begin);
	  for(int j=0;j<10000;j++)
 	aes.Cipher(input,output);
    GetSystemTime(&end);
  printf("%u\n",end.wSecond-begin.wSecond);
 printf("%u\n",end.wMilliseconds-begin.wMilliseconds);
    
 // for(int j=0;j<1000;j++);
 
 //	for(i=0;i<16;i++)
	 //{cout<<hex<<(int)output[i];
	 // cout<<" ";}	 
 GetSystemTime(&begin);
	  for(j=0;j<10000;j++)
     aes.InvCipher(output,input);
	    GetSystemTime(&end);
  printf("%u\n",end.wSecond-begin.wSecond);
 printf("%u\n",end.wMilliseconds-begin.wMilliseconds);
    
	  //for(i=0;i<sizeof(input);i++)
	  //{cout<<hex<<(int)input[i];
	  //cout<<" ";}
  
	return 0;
}

⌨️ 快捷键说明

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