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) '-' reads stdin
10 # $2 => lowercase sha256 hash expected
16 if [ "$_val" = "-" ]; then
19 _check
="$(printf '%b' "$_val" | ./ltsha1)"
21 die
"could not run ltsha1 utility"
23 [ "$_check" = "$_hash" ] || _result
="not ok"
24 testnum
="$(( $testnum + 1 ))"
25 printf '%s %u - %s\n' "$_result" "$testnum" "$_test"
32 a9993e364706816aba3e25717850c26c9cd0d89d \
36 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" \
37 84983e441c3bd26ebaae4aa1f95129e5e54670f1 \
38 abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq
42 f7c3bc1d808e04732adf679965ccc34ca7ae3441 \
46 "The quick brown fox jumped over the lazy dog.\n" \
47 bae5ed658ab3546aee12f23f36392f35dba1ebdd \
52 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 \
57 4b825dc642cb6eb9a060e54bf8d69288fbee4904 \