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
17 _check
="$(./ltsha256)"
19 _check
="$(printf '%b' "$_val" | ./ltsha256)"
21 die
"could not run ltsha256 utility"
23 [ "$_check" = "$_hash" ] || _result
="not ok"
24 testnum
="$(( $testnum + 1 ))"
25 printf '%s %u - %s\n' "$_result" "$testnum" "$_test"
32 ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad \
36 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" \
37 248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 \
38 abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq
42 15e2b0d3c33891ebb0f1ef609ec419420c20e320ce94c65fbc8c3312448eb225 \
46 "The quick brown fox jumped over the lazy dog.\n" \
47 40d5c6f7fe5672fb52269f651c2b985867dfcfa4a5c5258e3d4f8736d5095037 \
52 473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813 \
53 "git sha256 empty blob"
57 6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321 \
58 "git sha256 empty tree"