Skip to content

Instantly share code, notes, and snippets.

@trajakovic
Created April 20, 2017 06:48
Show Gist options
  • Save trajakovic/0896409d009ff83a682265e57256d5c9 to your computer and use it in GitHub Desktop.
Save trajakovic/0896409d009ff83a682265e57256d5c9 to your computer and use it in GitHub Desktop.
Generate binary files with random content...and calculate their sha256
#!/bin/bash
#size magnitude
sizes=( "" "K" "M" )
for magnitude in "${sizes[@]}"; do
for size in `seq 1 5 51`; do
echo "Generating ${size}${magnitude}"
head -c ${size}${magnitude} </dev/urandom >file-${size}${magnitude}.bin
done
done
#generate sha256checksums
rm -f sha256checksums
find . -name "*.bin" -type f -exec sha256sum "{}" + > sha256checksums
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment