pegh/test.sh

21 lines
514 B
Bash
Raw Normal View History

2019-12-25 01:21:43 -05:00
#!/bin/bash
set -euo pipefail
# try different size files to encrypt/decrypt
[ -e /dev/shm/randombytes ] || dd if=/dev/urandom bs=1M count=100 of=/dev/shm/randombytes
# compile C and rust code this way
gcc pegh.c -lcrypto -O3 -o pegh
#cargo build --release
export key=$(openssl rand -base64 20)
echo "key: $key"
test () {
bin=$1
2019-12-26 01:19:05 -05:00
tee >(md5sum 1>&2) < /dev/shm/randombytes | $bin -e $key | $bin -d $key | md5sum 1>&2
#$bin -e $key < /dev/shm/randombytes | $bin -d $key &>/dev/null
2019-12-25 01:21:43 -05:00
}
time test ./pegh