Re: Alpha 500 MHz or Pentium II 400 MHz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thor Dreier wrote:
> I'm about to set up a file server with encrypted drives. I have an
> AlphaServer 800 w/500 MHz cpu and a Pentium II 400 MHz computer. Would
> it be better to use the Pentium with loop-AES because there's assembler
> code for newer x86 CPU's, or should I use the Alpha as the server?

If you want to test AES cipher speed, just compile and run included
userspace test program (save it as aes-test4.c). This test program needs
aes.c aes.h and aes-i586.S files from loop-AES-v1.7c tarball.

Compile command on P2:

    gcc -O2 -Wall -march=i686 aes-test4.c aes-i586.S -o aes-test4

Compile command on alpha:

    gcc -O2 -Wall aes-test4.c aes.c -o aes-test4

And then just run it on unloaded box like this:

    ./aes-test4

Regards,
Jari Ruusu <jari.ruusu@xxxxxxxxxx>


-------- cut here --------
/*
 *  aes-test4.c
 *
 *  Written by Jari Ruusu, April 16 2001
 *
 *  Copyright 2001 by Jari Ruusu.
 *  Redistribution of this file is permitted under the GNU Public License.
 */

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

#include "aes.h"
aes_context   ctx;

extern int rand();

unsigned char usrKey[32];
unsigned char srcbuf[16];
unsigned char newbuf[16];

int main(void)
{
    register int x, y;
    int kl;
    struct timeval ot, nt;
    unsigned long long lv;

    for(x = 0; x < 32; x++) {
        usrKey[x] = rand();
    }

    for(kl = 128; kl <= 256; kl += 64) {
        aes_set_key(&ctx, usrKey, kl >> 3, 0);
        for(y = 0; y < 16; y++) {
             srcbuf[y] = rand();
        }

        /* test encrypt speed */
        gettimeofday(&ot, (struct timezone *)0);
        for(x = 0; x < 10000000; x++) {
            aes_encrypt(&ctx, srcbuf, srcbuf);
        }
        gettimeofday(&nt, (struct timezone *)0);
        lv = ((unsigned long long)nt.tv_sec * 1000000) + nt.tv_usec;
        lv -= (((unsigned long long)ot.tv_sec * 1000000) + ot.tv_usec);
        if(!lv) lv = 1;
        printf("key length %d bits, encrypt speed %.1f Mbits/sec\n", kl,
            ((double)10000000 * 128) / (double)lv);

        /* test decrypt speed */
        gettimeofday(&ot, (struct timezone *)0);
        for(x = 0; x < 10000000; x++) {
            aes_decrypt(&ctx, srcbuf, newbuf);
        }
        gettimeofday(&nt, (struct timezone *)0);
        lv = ((unsigned long long)nt.tv_sec * 1000000) + nt.tv_usec;
        lv -= (((unsigned long long)ot.tv_sec * 1000000) + ot.tv_usec);
        if(!lv) lv = 1;
        printf("key length %d bits, decrypt speed %.1f Mbits/sec\n", kl,
            ((double)10000000 * 128) / (double)lv);
    }

    return(0);
}
-------- cut here --------

-
Linux-crypto:  cryptography in and on the Linux system
Archive:       http://mail.nl.linux.org/linux-crypto/


[Index of Archives]     [Kernel]     [Linux Crypto]     [Gnu Crypto]     [Gnu Classpath]     [Netfilter]     [Bugtraq]
  Powered by Linux