Skip to content

Instantly share code, notes, and snippets.

@AaronActu
AaronActu / test_integrity.sh
Created September 19, 2021 18:57
Test integrity of a given file, with a given hash. Supports MD5 and SHA256.
#!/bin/bash
filename=$1
hash=${2^^}
algo=sha256
[[ -n "$3" ]] && algo=$3
if [[ ! -f "$filename" ]]; then
echo "$filename" does not exists
exit 1