| 1 |
#include <stdio.h> |
| 2 |
#include <sys/time.h> |
| 3 |
#include <unistd.h> |
| 4 |
#include "des.h" |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
main () { |
| 9 |
des_key_schedule k; |
| 10 |
unsigned char in[1024*1024]; |
| 11 |
unsigned char out[1024*1024]; |
| 12 |
unsigned char ivec[8]; |
| 13 |
int i; |
| 14 |
struct timeval tv; |
| 15 |
double t1,t2; |
| 16 |
|
| 17 |
des_set_key("abcdefgh",k); |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
for (i=0; i<8; i++) ivec[i] = 0; |
| 24 |
for (i=0; i<1024*1024; i++) in[i] = ' '; |
| 25 |
|
| 26 |
gettimeofday(&tv, NULL); |
| 27 |
t1 = tv.tv_sec + tv.tv_usec * 1E-6; |
| 28 |
|
| 29 |
des_cbc_encrypt(in, out, 1024*1024, k, ivec, 1); |
| 30 |
|
| 31 |
gettimeofday(&tv, NULL); |
| 32 |
t2 = tv.tv_sec + tv.tv_usec * 1E-6; |
| 33 |
|
| 34 |
printf("%f\n", t2-t1); |
| 35 |
} |