Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > c0e885b27ff9741f30a06a7c559c98ff > files > 20

ocaml-cryptgps-devel-0.2.1-1mdv2010.1.x86_64.rpm

#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include "blowfish.h"



main () {
    BF_KEY k;
    unsigned char in[1024*1024];
    unsigned char out[1024*1024];
    unsigned char ivec[8];
    int i;
    struct timeval tv;
    double t1,t2;

    BF_set_key(&k, 16, "abcdefghijklmnop");


    /* CBC TEST */
    

    for (i=0; i<8; i++) ivec[i] = 0;
    for (i=0; i<1024*1024; i++) in[i] = ' ';

    gettimeofday(&tv, NULL);
    t1 = tv.tv_sec + tv.tv_usec * 1E-6;

    BF_cbc_encrypt(in, out, 1024*1024, &k, ivec, 1);

    gettimeofday(&tv, NULL);
    t2 = tv.tv_sec + tv.tv_usec * 1E-6;

    printf("%f\n", t2-t1);
}