3 # License: public domain -or- http://www.wtfpl.net/txt/copying/
5 die
() { >&2 printf 'Bail out! %s\n' "$*"; exit 1; }
9 # $1 => value to hash (may contain escapes)
10 # $2 => lowercase sha256 hash expected
16 _check
="$(printf '%b' "$_val" | ./ltsha1)" ||
17 die
"could not run ltsha1 utility"
19 [ "$_check" = "$_hash" ] || _result
="not ok"
20 testnum
="$(( $testnum + 1 ))"
21 printf '%s %u - %s\n' "$_result" "$testnum" "$_test"
28 a9993e364706816aba3e25717850c26c9cd0d89d \
32 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" \
33 84983e441c3bd26ebaae4aa1f95129e5e54670f1 \
34 abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq
38 f7c3bc1d808e04732adf679965ccc34ca7ae3441 \
42 "The quick brown fox jumped over the lazy dog.\n" \
43 bae5ed658ab3546aee12f23f36392f35dba1ebdd \