Added environment config for test.sh

Fortune for chacha20's current commit: Blessing − 吉
mmap-feature
Avril 2 years ago
parent 03b33e6472
commit 2e679167c7
Signed by: flanchan
GPG Key ID: 284488987C31F630

2
Cargo.lock generated

@ -34,7 +34,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chacha20" name = "chacha20"
version = "2.0.0" version = "2.0.1"
dependencies = [ dependencies = [
"base64", "base64",
"getrandom", "getrandom",

@ -1,7 +1,7 @@
[package] [package]
name = "chacha20" name = "chacha20"
description = "chacha20_poly1305 encryption tool" description = "chacha20_poly1305 encryption tool"
version = "2.0.0" version = "2.0.1"
authors = ["Avril <flanchan@cumallover.me>"] authors = ["Avril <flanchan@cumallover.me>"]
edition = "2021" edition = "2021"
license = "gpl-3.0-or-later" license = "gpl-3.0-or-later"

@ -8,6 +8,7 @@ mkdir -p test || exit -1
cd test || exit -1 cd test || exit -1
PROG=../target/${1:-release}/chacha20 PROG=../target/${1:-release}/chacha20
TEST_ENV="${TEST_ENV:-""}"
if [[ ! -f $PROG ]]; then if [[ ! -f $PROG ]]; then
echo "Couldn't find executable \"$PROG\"" echo "Couldn't find executable \"$PROG\""
@ -27,9 +28,9 @@ KEYS=$($PROG k)
echo "$KEYS" echo "$KEYS"
echo ">>> Encrypting" echo ">>> Encrypting"
time $PROG e $KEYS < test.txt > test.cc20 || exit 1 time $TEST_ENV $PROG e $KEYS < test.txt > test.cc20 || exit 1
echo ">>> Decrypting" echo ">>> Decrypting"
time $PROG d $KEYS < test.cc20 > test.out.txt || exit 2 time $TEST_ENV $PROG d $KEYS < test.cc20 > test.out.txt || exit 2
echo ">>> Comparing" echo ">>> Comparing"
echo "Input (SHA256 sum): $(sha256sum test.txt)" echo "Input (SHA256 sum): $(sha256sum test.txt)"

Loading…
Cancel
Save