Skip to content

File Hashes

What hashes? File whatsits?

Yeah, I’m just going to let the experts do the talking here, and then I’ll add a link to a tool or two which do the trick you’re looking for.

What is Hashing?

These days, pretty much everything has some kind of unique identifier; for example, stock items have SKUs, cars have VINs, employees have IDs, US citizens have SSNs, etc.. One could say that hashing is an attempt to “label” some chunk of data with a fixed-length, unique identifier. A message digest, or hash, is a signature that identifies some amount of data, usually a file or message. Cryptographic hashing algorithms are one-directional mathematical formulae designed to generate a unique value for every possible input-in this case, the data. Common algorithms include MDS, SHA-1, SHA-256, and SHA-512, although there exist a number of more esoteric or use-case-specific methods.

Obviously, one cannot represent an infinite number of inputs with a finite-sized signature; when two inputs result in the same output, this is called a hash collision. Algorithms that produce a shorter hash are more likely to cause collisions. Both the MDS and SHA-1 hashing algorithms have methods of producing collisions that threat actors can use to hide malicious content.

Hashes, Vendors, and You

Often, vendors will provide hashes with downloads of firmware or other critical files. This can provide an extra level of security Isafety when downloading files and help to prevent watering hole attacks. If your vendor does not provide hashes, it may be possible to contact them and ask before deploying a new package. Additional safety measures are never a bad thing, especially when it comes to downloading files, even from trusted sources.

Excerpts from: https://www.cisa.gov/uscert/sites/default/files/FactSheets/NCCIC%20ICS_Factsheet_File_Hashing_S508C.pdf

Also check out HowToGeek’s explanation:

https://www.howtogeek.com/67241/htg-explains-what-are-md5-sha-1-hashes-and-how-do-i-check-them/

Or a slightly more legal point of view, so to speak:

And my go-to hashing tool of choice; once downloaded and run, you can opt to create a submenu item in Windows Explorer: simply right click any file, and select the HashMyFiles option. Note that that’s the only action required – hashing a file using this app is not an action to be performed, it’s simply a matter of looking at the already calculated hashes that are shown. Double– and right-clicking in any file’s hash detail field allows you to copy them to your clipboard.

Right-click menu option added to Explorer
And the file’s hash details – right-clicked once again to copy the hash text

Download the app at: https://www.nirsoft.net/utils/hash_my_files.html

Alternatively…

Feeling particularly hardcore/geeky, or just don’t feel like downloading an app to calculate a string from a file?

Microsoft’s got your back:

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-7.2