Skip to content

Instantly share code, notes, and snippets.

@creshal
Last active August 29, 2015 14:24
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 creshal/9b3258aefa7946378bdb to your computer and use it in GitHub Desktop.
Save creshal/9b3258aefa7946378bdb to your computer and use it in GitHub Desktop.
ssh-benchmark
#! /bin/bash
pgrep sshd >/dev/null || (echo "Please make sure SSH is running _locally_." && exit 1)
sz=${1:-128}
testfile=$(mktemp -p /run/user/$UID)
filename=$(basename $testfile)
echo "Generating temporary file, $sz MiB size. Supply a size argument to change. (Should be small enough to fit in RAM twice.)"
dd if=/dev/urandom of=$testfile bs=1048576 count=$sz
for cipher in 3des-cbc aes128-cbc aes128-ctr aes128-gcm@openssh.com arcfour arcfour128 blowfish-cbc cast128-cbc chacha20-poly1305@openssh.com; do
echo ""
echo "Cipher $cipher, without compression:"
scp -c $cipher $testfile localhost:/run/user/$UID/out-$filename
rm /run/user/$UID/out-$filename &>/dev/null
done
echo "Final test, compressed aes128-ctr:"
scp -C -c aes128-ctr $testfile localhost:/run/user/$UID/out-$filename
rm $testfile &>/dev/null
rm /run/user/$UID/out-$filename &>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment