Throughout the years, I have composed several scripts to simplify my tasks. One such utility was sigs.py (which served as a reimplementation of an older Perl script, sigs.pl) for hashing files. I aimed for something versatile that could function as a substitute for tools like md5sum, sha1sum, and others (and can compute hashes such as sha512, sha3-224, and sha3-384). There have even been instances where my Python script executed faster than those Linux utilities. In any case, in various recent projects, I’ve encountered manifests containing hashes, and to confirm that I have reliable copies, I sought to validate the hashes. At times, I received md5s, at others, sha1s, and on some occasions, sha256s. On Linux, utilities like md5sum, sha1sum, sha256sum, etc., feature the -c option to facilitate this verification; however, my script originally lacked that functionality. So, I dedicated an hour over the weekend recently to integrate that feature. The script identifies which hash to utilize based on the length of the hash it detects in the text file, enabling it to verify any of the hashes it can compute.
