PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Geschwindigkeit der cryptoapi testen



slime
15.07.04, 21:31
hi,
mit diesem kleinen script könnt ihr (falls die passenden module geladen sind, und wenn eure version on losetup >= 2.12 ist) testen wie schnell die verschienden crypto-alogrithmen sind.


#!/bin/bash
VERSION="0.1"


#
# Settings
#
ALOG="aes blowfish twofish serpent";
SIZE="30";
TMP="/tmp";
DEV="/dev/loop2";
PASS="helloworld";


#
# prepare
#
echo "*** test_enc.sh "$VERSION;
mkdir -p $TMP/mountpoint;
dd if=/dev/zero of=$TMP/crypt_test.img bs=1024k count=$(($SIZE * 2)) 2> /dev/null;
echo "*** Creating a file with random data. This could take a moment.";
dd if=/dev/urandom of=$TMP/random.file bs=1024k count=$SIZE 2> /dev/null;
losetup -d $DEV 2> /dev/null

#
# test each algo
#
for i in $ALOG; do
echo "*** Testing Algo \"$i\"...";
echo $PASS | losetup --pass-fd 0 -e $i $DEV $TMP/crypt_test.img;
mkfs.ext3 -q -j $DEV 2> /dev/null;
mount -t ext3 $DEV $TMP/mountpoint;
time cp $TMP/random.file $TMP/mountpoint;
umount $TMP/mountpoint;
losetup -d $DEV;
done


#
# cleanup
#
rmdir $TMP/mountpoint;
rm $TMP/crypt_test.img;
rm $TMP/random.file;