Skip to content

Instantly share code, notes, and snippets.

@SafeEval
Last active September 20, 2024 02:07
Show Gist options
  • Save SafeEval/8bf756c1a3b465bb00f3e048bc978573 to your computer and use it in GitHub Desktop.
Save SafeEval/8bf756c1a3b465bb00f3e048bc978573 to your computer and use it in GitHub Desktop.
Generate the sha256 hashes of all six digit OTPs in 970 seconds (16 minutes, 69 MB)
#!/bin/bash
OUTFILE="otp-hashes.csv"
function gen_hash() {
otp=$1;
hash=$(echo -n $otp | sha256sum | awk '{print $1}');
echo "$otp,$hash" >> $OUTFILE;
}
start=$(date +%s)
for otp in $(seq -w 000000 999999); do
gen_hash $otp &
echo "$otp";
done
wait
end=$(date +%s)
elapsed=$(( end - start ))
echo "Elapsed time: $elapsed seconds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment