0 votes
in Hacking by

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' '

for example we have above code in script.sh and test.txt contains wordlist then we will run code as:

 script.sh test.txt

Please log in or register to answer this question.

Welcome to My QtoA, where you can ask questions and receive answers from other members of the community.