Skip to content

Instantly share code, notes, and snippets.

@WOnder93
Created June 30, 2016 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WOnder93/51bc8300bdf05c4654e9926477ed913c to your computer and use it in GitHub Desktop.
Save WOnder93/51bc8300bdf05c4654e9926477ed913c to your computer and use it in GitHub Desktop.
Cryptsetup benchmark script
#!/bin/bash
VERSIONS='1.6.8 1.7.0'
BACKENDS='openssl gcrypt'
HASHES='ripemd160 sha1 sha256 sha512'
TEMPFILE=$(mktemp)
dd if=/dev/zero of="$TEMPFILE" count=1 bs=8M
for BACKEND in $BACKENDS; do
for VER in $VERSIONS; do
DIR="cryptsetup-${VER}-${BACKEND}"
if ! [ -e "$DIR" ]; then
git clone https://gitlab.com/cryptsetup/cryptsetup.git "$DIR" || continue
(
cd "$DIR"
git checkout v${VER//\./_} || continue
./autogen.sh --with-crypto_backend=$BACKEND || continue
make || continue
)
fi
done
done
for BACKEND in $BACKENDS; do
for VER in $VERSIONS; do
DIR="cryptsetup-${VER}-${BACKEND}"
(
cd "$DIR"
echo "Benchmark for $DIR..."
for HASH in $HASHES; do
src/cryptsetup benchmark -s 256 -h "$HASH" | grep PBKDF2
done
for HASH in $HASHES; do
echo -n password | src/cryptsetup -h "$HASH" luksFormat "$TEMPFILE" /dev/stdin # --debug
echo -n "$HASH"
printf '\t'
src/cryptsetup luksDump "$TEMPFILE" | grep "Iterations" | egrep -o "[0-9]+"
done
)
done
done
rm -f "$TEMPFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment