top of page
Writer's pictureBrian

The Hash Slinging Slasher



In my last blog post I discussed, the python hashlib module which can be used to obtain hash values. I frequently find myself hashing files and I usually use Hashdeep to do so. I determined that I could use a better hashing tool, so I decided to write one. This resulted in the Hash Slinging Slasher, a Python script that applies either the MD5, SHA256, and SHA1 hash algorithms to a selected file.


This script uses the hashlib module, so it is necessary to install the module prior to running the script. Hashlib can be installed using PIP in the following fashion.


$ pip install hashlib


Once run from the command line, the script asks the user if they wish to hash a file. If the user selects yes, then the user is then presented with three hash algorithm options. Each hash algorithm has its own function which asks for the name of the file that should be hashed, before running it through the hash algorithm. Once the file is hashed, the user then encounters the original prompt asking if the user would like to hash a file. If the user chooses to hash an additional file, they will once again be presented with the hash selection. I ran hss.py on a test file named test.txt to show how to use the script, this can be seen below.


Hash Slinging Slasher from the command line:

Hash Slinging Slasher source code:


This script can be downloaded from https://github.com/CarrCyberSec/hss.


Please remember to run this script in the same directory as the file which you wish to hash. If you don’t, you may need to specify the entire file path.


Once hss.py has been downloaded, the hashlib module has been downloaded and installed, and the file has been moved into the same directory as hss.py, the program can then be used.


The program should be run like the following.


$ ./hss.py


The program will then ask the user if they would like to hash a file if ‘N’ is entered the program will exit. As long as ‘Y’ is entered at this prompt, the user will then be asked which hash algorithm they would like to use. Entering ‘1’ will then prompt the user for a file name, before applying the MD5 hash algorithm to the file. Entering ‘2’ will also prompt the user for a file name, but this selection will apply the SHA256 hash algorithm to the selected file. Entering ‘3’ prompts the user for a file name, and then applies a SHA1 hash algorithm to the selected file.


Below, I’ve compared the output of hss.py to the output of Hashdeep to verify that my program was functioning correctly.


111 views0 comments

Recent Posts

See All

Comments


bottom of page