Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Get the Hash of a File on Different Operating Systems

May 04, 2023 — Gregg Szumowski

Sometimes you just need to hash something. Here are some command lines to do just that.

Windows PowerShell:

Get-FileHash C:\path\to\file.iso -Algorithm [MD5|SHA1|SHA256|SHA384|SHA512|MACTripleDES|RIPEMD160]

(SHA256 is the default if the parameter is omitted)

Linux:

md5sum /path/to/file
sha1sum /path/to/file
sha256sum /path/to/file

macOS:

MD5: md5 /path/to/file
SHA1: shasum /path/to/file or shasum -a 1 /path/to/file
SHA-256: shasum -a 256 /path/to/file

Tags: cli, motd