85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
hash="$2"
hashMethod="$3"
if [ "${hashMethod}" = 'null' ]; then
return 0
fi
checkHash="$(openssl "${hashMethod}" "${file}" | sed 's@.*= *@@')"
if [ "${checkHash}" = "${hash}" ]; then
return 0
fi
echo "Hash (${hashMethod}) mismatch: Got: ${checkHash}; Expected: ${hash}" >&2
|
|
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
hash="$2"
hashMethod="$3"
if [ "${hashMethod}" = 'null' ]; then
return 0
fi
checkHash="$(openssl dgst "-${hashMethod}" "${file}" | sed 's@.*= *@@')"
if [ "${checkHash}" = "${hash}" ]; then
return 0
fi
echo "Hash (${hashMethod}) mismatch: Got: ${checkHash}; Expected: ${hash}" >&2
|