we have collection of sample words in a text file, and we want to calculate hash (md5/sha1/etc..) of these words.
below we are calculating sha1 (we can replace sha1sum by md5sum or any other desired) of text file ( passing test.txt as a parameter to script):
#! /bin/bash
cat "$@" | while read -r line; do
printf %s "$line" | sha1sum | cut -f1 -d' '
done
for example we have above code in script.sh and test.txt contains wordlist then we will run code as:
script.sh test.txt