OpenSSL can compute a checksum (digest) against a file.
To ensure that the contents of a file has not been tampered with, OpenSSL can compute a unique checksum for the file.
Once this checksum is computed, it can be shared and, for example, anyone downloading the file can run the same checksum process to ensure that they get the same checksum - which ensures that the contents of a file have not changed.
openssl dgst -list
returns:
Supported digests: -blake2b512 -blake2s256 -md4 -md5 -md5-sha1 -ripemd -ripemd160 -rmd160 -sha1 -sha224 -sha256 -sha3-224 -sha3-256 -sha3-384 -sha3-512 -sha384 -sha512 -sha512-224 -sha512-256 -shake128 -shake256 -sm3 -ssl3-md5 -ssl3-sha1 -whirlpool
openssl dgst -md5 test.sh
returns:
MD5(test.sh)= 68e2009b8a69745f4371011194a16116
NOTE: This can also be run as:
openssl md5 test.sh
OpenSSL can also be combined with find to produce fingerprints for several files:
find /home/peter -type f -print0 | xargs -0 openssl md5 or find /home/peter -type f| xargs -d '\n' openssl md5
NOTE: The xargs command takes white space characters (tabs, spaces, new lines) as delimiters.
To accommodate for files which may contain spaces, the -d option is used to limit xarg delimiters to only the new line characters ('\n').