70 lines
3.0 KiB
Bash
70 lines
3.0 KiB
Bash
|
#!/bin/bash
|
||
|
set -e
|
||
|
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
||
|
|
||
|
function check_file() {
|
||
|
local checksum="$(sha512sum "${1}" | grep -Po '^\s*\K\w+')"
|
||
|
if [ "${checksum,,}" != "${2,,}" ]; then
|
||
|
echo "Error: Checksum of \"${1}\" does not match !!!"
|
||
|
echo "-> Expected: ${2,,}"
|
||
|
echo "-> Computed: ${checksum,,}"
|
||
|
exit 1
|
||
|
fi
|
||
|
echo "Checksum is correct."
|
||
|
}
|
||
|
|
||
|
for suffix in i686 x86_64; do
|
||
|
if [ ! -x ./slunkcrypt-${suffix} ]; then
|
||
|
echo "Required program file \"slunkcrypt-${suffix}\" not found !!!"
|
||
|
exit 1
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
echo -e "\n------------------------------------------------------------------------------"
|
||
|
echo "Clean up"
|
||
|
echo -e "------------------------------------------------------------------------------\n"
|
||
|
|
||
|
rm -vf "test-vectors.tar" "passphrase.txt" "sha512sums.txt"
|
||
|
rm -vf "test-"*"."{enc,png}
|
||
|
|
||
|
echo -e "\n------------------------------------------------------------------------------"
|
||
|
echo "Download"
|
||
|
echo -e "------------------------------------------------------------------------------\n"
|
||
|
|
||
|
curl -kLf -o "test-vectors.tar" "https://sourceforge.net/projects/muldersoft/files/SlunkCrypt/test-vectors.tar/download"
|
||
|
printf "\n"
|
||
|
|
||
|
tar -xvf "test-vectors.tar"
|
||
|
printf "\n"
|
||
|
|
||
|
check_file "test-v100-1.enc" "372358b8bd8f31834da449b456ef0d62ceeba95b3ac9e87d36f81ac0292be3da29cc7d1df55a72473dd08211bb5bab748f8c8b57f25b336d22862f2af2b4d3b2"
|
||
|
check_file "test-v100-2.enc" "a0e97b8e0b78a2fde215eb7234cff253e4af5b9ae426aaebfa85ddc84a79b3fa6ad1d7fad3b792610a4dd824ec56535dfb00a7352228fcefd011bf024af37dad"
|
||
|
check_file "test-v130-1.enc" "c13e6e001b08efba58909beed952957ea245a6f7fe52ad7022265f25f6f3a1c74423922f46cf171f2b23f948e4fde7004d83c89f95b62f825ff262cc7468bb48"
|
||
|
check_file "test-v130-2.enc" "48fe6ce4b82fb1c132d987b95576b6856deb43031047f669434347d9ffb8bc79a636e59548ffa18bd8031fbaeb034cb972a147087f49a61bf53a6b740434f3c6"
|
||
|
|
||
|
echo -e "\n------------------------------------------------------------------------------"
|
||
|
echo "Decrypt"
|
||
|
echo -e "------------------------------------------------------------------------------\n"
|
||
|
|
||
|
for suffix in i686 x86_64; do
|
||
|
SLUNK_LEGACY_COMPAT=1 ./slunkcrypt-${suffix} -d 'pass:Q8YRL4_SFGt9m(>I,(h=fDaw' "test-v100-1.enc" "test-v100-1-${suffix}.png"
|
||
|
SLUNK_LEGACY_COMPAT=1 ./slunkcrypt-${suffix} -d 'pass:1$SfiHiQW*G|RbpR8trFR$sp' "test-v100-2.enc" "test-v100-2-${suffix}.png"
|
||
|
SLUNK_LEGACY_COMPAT=0 ./slunkcrypt-${suffix} -d 'pass:Q8YRL4_SFGt9m(>I,(h=fDaw' "test-v130-1.enc" "test-v130-1-${suffix}.png"
|
||
|
SLUNK_LEGACY_COMPAT=0 ./slunkcrypt-${suffix} -d 'pass:1$SfiHiQW*G|RbpR8trFR$sp' "test-v130-2.enc" "test-v130-2-${suffix}.png"
|
||
|
done
|
||
|
|
||
|
echo -e "\n------------------------------------------------------------------------------"
|
||
|
echo "Verify checksums"
|
||
|
echo -e "------------------------------------------------------------------------------\n"
|
||
|
|
||
|
for suffix in i686 x86_64; do
|
||
|
for version_number in 100 130; do
|
||
|
for i in {1..2}; do
|
||
|
check_file "test-v${version_number}-${i}-${suffix}.png" "658a566d279070546dcb385f0ae1f236058edfe246caaaa149b8de448b788616cf78f229af7e70c3a06a23b649540aa5f53927f9a959a957b9b8b0ddf25063b1"
|
||
|
done
|
||
|
done
|
||
|
done
|
||
|
|
||
|
echo -e "\nEverything completed successfully."
|
||
|
printf "\n"
|