
Need to generate SHA1 HASH of multiple files in a folder, but running “sha1sum <file>” takes WAY TOO LONG!?
This small tool/script may be of help.
This script scans a user specified folder (including its sub-folders), and creates a file that contains a list with all filenames and it’s SHA1 HASH.
Go to the terminal, and write the follwing:
Step One:
“nano sha1gen.sh”
Step Two:
paste the following code into the file:
#!/bin/bash
# Description: Scan for files in chosen folder incl. subfolders
# Usage: ./sha1gen.sh <folder to scan>
find "$1" -type f -exec sha1sum {} \; > "$1" SHA1checksums.sha1
Press CTRL + O to save the document, and then CTRL + X to exit back into the terminal.
To use it you first need to make it executable. This is done by the following command in the terminal:
“sudo chmod +x sha1gen.sh”
The script should now be ready to go..
By typing for example: “./sha1gen.sh /home/digitalbrekke”, the script scans the entire home folder, and creates a file called “SHA1checksums.sha1” in that directory once it’s done scanning.
Hope this was helpful for anyone.