aboutsummaryrefslogtreecommitdiffstats
path: root/test
blob: 62f0e8533382601bbf5e9fb57a0152c8176fd7a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/bin/sh

set -v
set -e


if test -d .testdir; then
    rm -r .testdir
fi
mkdir .testdir


test "$(printf '' | ./sha3-224sum)" = '6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7  -'
test "$(printf '' | ./sha3-256sum)" = 'a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a  -'
test "$(printf '' | ./sha3-384sum)" = '0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004  -'
test "$(printf '' | ./sha3-512sum)" = 'a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26  -'


test "$(printf '' | ./sha3sum)" = '6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7  -'
test "$(printf '' | ./sha3sum -a224)" = '6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7  -'
test "$(printf '' | ./sha3sum -a256)" = 'a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a  -'
test "$(printf '' | ./sha3sum -a 384)" = '0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004  -'
test "$(printf '' | ./sha3sum -a 512)" = 'a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26  -'


test "$(printf '' | ./keccak-224sum)" = 'f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd  -'
test "$(printf '' | ./keccak-256sum)" = 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470  -'
test "$(printf '' | ./keccak-384sum)" = '2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff  -'
test "$(printf '' | ./keccak-512sum)" = '0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e  -'


test "$(printf '' | ./sha3-224sum -u)" = '6B4E03423667DBB73B6E15454F0EB1ABD4597F9A1B078E3F5B5A6BC7  -'
test "$(printf '' | ./sha3-224sum -l)" = '6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7  -'
test "$(printf '' | ./sha3-224sum -ul)" = '6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7  -'
test "$(printf '' | ./sha3-224sum -lu)" = '6B4E03423667DBB73B6E15454F0EB1ABD4597F9A1B078E3F5B5A6BC7  -'
test "$(printf '' | ./sha3-224sum -b)" = "$(printf '\153\116\003\102\066\147\333\267\073\156\025\105\117\016\261\253\324\131\177\232\033\007\216\077\133\132\153\307')"


test "$(printf '' | ./rawshake128sum -N 128)" = 'fa019a3b17630df6014853b5470773f1  -'
test "$(printf '' | ./rawshake256sum -N 128)" = '3a1108d4a90a31b85a10bdce77f4bfbd  -'
test "$(printf '' | ./rawshake256sum -N 8)" = '3a  -'
test "$(printf '' | ./rawshake512sum -N 128)" = '0ae7dac687c3525d5c2a6c4119ea3968  -'


test "$(printf '' | ./shake128sum -N 128)" = '7f9c2ba4e88f827d616045507605853e  -'
test "$(printf '' | ./shake256sum -N 128)" = '46b9dd2b0ba88d13233b3feb743eeb24  -'
test "$(printf '' | ./shake256sum -N 8)" = '46  -'
test "$(printf '' | ./shake512sum -N 128)" = 'ae1b4eea1eaf5ea633e66045f03ff11b  -'


! test "$(printf '' | ./sha3-224sum)" = "$(printf '\n' | ./sha3-224sum)"
test "$(printf '' | ./sha3-224sum -)" = "$(printf '' | ./sha3-224sum)"
! test "$(printf '' | ./sha3-224sum /dev/null)" = "$(printf '' | ./sha3-224sum)"


test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3-224sum)" = '22c8017ac8bcf65f59d1b7e92c9d4c6739d25e34ce5cb608b24ff096  -'
test "$(printf 'intensifierat sturdiness perl-image-exiftool vingla' | ./sha3-224sum)" = '43808dde2662143dc4eed5dac5e98c74b06711829f02a3b121bd74f3  -'
test "$(printf 'timjan avogadro uppdriven lib32-llvm-amdgpu-snapshot' | ./sha3-224sum)" = 'd32b4ac86065774dee5eb5cdd2f67b4e86501086d7373884e8b20a36  -'
test "$(printf "grilo-plugins auditorium tull dissimilarity's" | ./sha3-224sum)" = 'efbd76d45bfa952485148f8ad46143897f17c27ffdc8eb7287f9353b  -'
test "$(printf 'royalty tt yellowstone deficiencies' | ./sha3-224sum)" = '6705aa36ecf58f333e0e6364ac1d0b7931d402e13282127cfd6f876c  -'
test "$(printf "kdegames-kdiamond tunisisk occurrence's outtalad" | ./sha3-224sum)" = '803a0ff09dda0df306e483a9f91b20a3dbbf9c2ebb8d0a3b28f3b9e0  -'
test "$(printf "chevalier slat's spindel representations" | ./sha3-224sum)" = 'a64779aca943a6aef1d2e7c9a0f4e997f4dabd1f77112a22121d3ed5  -'
test "$(printf 'archery lexicographical equine veered' | ./sha3-224sum)" = 'f0a3e0587af7723f0aa4719059d3f5107115a5b3667cd5209cc4d867  -'
test "$(printf 'splay washbasin opposing there' | ./sha3-224sum)" = '312e7e3c6403ab1a086155fb9a52b22a3d0d257876afd2b93fb7272e  -'
test "$(printf 'faktum desist thundered klen' | ./sha3-224sum)" = '270ba05b764221ff5b5d94adfb4fdb1f36f07fe7c438904a5f3df071  -'

test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3sum)" = '22c8017ac8bcf65f59d1b7e92c9d4c6739d25e34ce5cb608b24ff096  -'
test "$(printf 'intensifierat sturdiness perl-image-exiftool vingla' | ./sha3sum)" = '43808dde2662143dc4eed5dac5e98c74b06711829f02a3b121bd74f3  -'
test "$(printf 'timjan avogadro uppdriven lib32-llvm-amdgpu-snapshot' | ./sha3sum)" = 'd32b4ac86065774dee5eb5cdd2f67b4e86501086d7373884e8b20a36  -'
test "$(printf "grilo-plugins auditorium tull dissimilarity's" | ./sha3sum)" = 'efbd76d45bfa952485148f8ad46143897f17c27ffdc8eb7287f9353b  -'
test "$(printf 'royalty tt yellowstone deficiencies' | ./sha3sum)" = '6705aa36ecf58f333e0e6364ac1d0b7931d402e13282127cfd6f876c  -'
test "$(printf "kdegames-kdiamond tunisisk occurrence's outtalad" | ./sha3sum)" = '803a0ff09dda0df306e483a9f91b20a3dbbf9c2ebb8d0a3b28f3b9e0  -'
test "$(printf "chevalier slat's spindel representations" | ./sha3sum)" = 'a64779aca943a6aef1d2e7c9a0f4e997f4dabd1f77112a22121d3ed5  -'
test "$(printf 'archery lexicographical equine veered' | ./sha3sum)" = 'f0a3e0587af7723f0aa4719059d3f5107115a5b3667cd5209cc4d867  -'
test "$(printf 'splay washbasin opposing there' | ./sha3sum)" = '312e7e3c6403ab1a086155fb9a52b22a3d0d257876afd2b93fb7272e  -'
test "$(printf 'faktum desist thundered klen' | ./sha3sum)" = '270ba05b764221ff5b5d94adfb4fdb1f36f07fe7c438904a5f3df071  -'


printf 'withdrew hypothesis snakebird qmc2' > .testdir/x
test "$(./sha3-224sum < .testdir/x)" = '22c8017ac8bcf65f59d1b7e92c9d4c6739d25e34ce5cb608b24ff096  -'
test "$(./sha3-224sum .testdir/x)" = '22c8017ac8bcf65f59d1b7e92c9d4c6739d25e34ce5cb608b24ff096  .testdir/x'


set +e
./sha3-224sum .testdir/no-such-file 2>/dev/null
x=$?
set -e
test $x = 1


printf "capitol's kvistfri broadly raping" > .testdir/x
test "$(./keccaksum -R 1024 -C 576 -N 256 < .testdir/x)" = '65070cdd6f91c0aadcfc470895a2606c828bce7ce3fa723418c9013de9225351  -'
test "$(./keccaksum -R 512 -C 1088 -N 256 < .testdir/x)" = 'e6f86ebc15b962f73f36f36fc8a84c3ae84b1c1023bfd4c5f1829389135aecc3  -'
test "$(./keccaksum -R 256 -C 1344 -N 256 < .testdir/x)" = '420b97fc88962c87ec2adaa8f48d74d9ff4ea7ae7d691f9c33b8713ca1d3d573  -'
test "$(./keccaksum -R 512 -C  288 -N 256 < .testdir/x)" = '524790afbe4706d938b6f753e14104f556890e2a415e211b0564d60499db0333  -'
test "$(./keccaksum -R 256 -C  544 -N 256 < .testdir/x)" = '04a6b4ad08b3018eefba0fb756272d949ac0f71c26f836d31dd13b28b884aa0f  -'
test "$(./keccaksum -R 256 -C  144 -N 256 < .testdir/x)" = 'd56f547791225e54460e6274ed31e57b7085820c11d65f1f322a16a3352c85ed  -'
test "$(./keccaksum -R 128 -C  272 -N 256 < .testdir/x)" = 'ceec066a57b9b31a5a0661df7bafec4183a26d0ed81e50bc958471f84fa347a7  -'
test "$(./keccaksum -R 128 -C   72 -N 256 < .testdir/x)" = 'b18f679c7105a72a993f70fa5adb3f17ef7ccffaffb4dc0f6fed74aa2f565194  -'
test "$(./keccaksum -R  64 -C  136 -N 256 < .testdir/x)" = '9b845c1ecc2b1b3a48ba42ef29ccc4b348da8ab15074a870d8e799ca33c15e4b  -'


test "$(printf '' | ./keccaksum)" = '6753e3380c09e385d0339eb6b050a68f66cfd60a73476e6fd6adeb72f5edd7c6f04a5d017a19cbe291935855b4860f69df04c98aa78b407a9ba9826f7266ef14  -'
test "$(printf '' | ./keccaksum -R 1024)" = '6753e3380c09e385d0339eb6b050a68f66cfd60a73476e6fd6adeb72f5edd7c6f04a5d017a19cbe291935855b4860f69df04c98aa78b407a9ba9826f7266ef14ba6d3f90c4fe154d27c2858ea6db8c117411a1bc5c499410c391b298f37bf636b0f5c31dbd6487a7d3d8cf2a97b619697e66d894299b8b4d80e0498538e18544c3a2fa33f0bfb1cfef8da7875c4967f3  -'
test "$(printf '' | ./keccaksum -C 512)" = 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4703dbb9a2cd87ca974b9a2b0ec61119bcb5cedf9c0c411221f6141a25f17c60d82d24680abbcbfba815b762b24b751d5b1e85325ba5e6df23c10725bfe986ace3ba2d24535a79f7dbabb153bb0d33c0dfa09cec712ebd7fe3b49a9194e859c82eb  -'
test "$(printf '' | ./keccaksum -N 100)" = '6753e3380c09e385d0339eb600  -'
test "$(printf '' | ./keccaksum -S 800)" = '681c4ecfe190d9625b011baaced04540c73a1ff62def9aee443dea516387fbc8  -'


test "$(printf 'a' | ./sha3-224sum)" = "$(printf '61' | ./sha3-224sum -x)"


test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3-224sum -Z 2)" = '03fe12b4b51d56d96377d927e5cd498fc4bc3aee389b2f2ff8393aa5  -'
test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3-224sum -Z 3)" = '0b8fb64ee5d8836956f49cbe4577afbc638c855c1d553452fc1eceb8  -'
test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3-224sum -Z 4)" = '1e03b4cd9eef3892a7b5e865fce393c4bc90120d9aea84d0a0dff3b8  -'
test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3-224sum -Z 5)" = 'aac92fbfd22ce62e83ddaf2e61bd7bf696326e46d1327defa4530e20  -'

test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3sum -Z 2)" = '03fe12b4b51d56d96377d927e5cd498fc4bc3aee389b2f2ff8393aa5  -'
test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3sum -Z 3)" = '0b8fb64ee5d8836956f49cbe4577afbc638c855c1d553452fc1eceb8  -'
test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3sum -Z 4)" = '1e03b4cd9eef3892a7b5e865fce393c4bc90120d9aea84d0a0dff3b8  -'
test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3sum -Z 5)" = 'aac92fbfd22ce62e83ddaf2e61bd7bf696326e46d1327defa4530e20  -'

test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3sum -a 224 -Z 2)" = '03fe12b4b51d56d96377d927e5cd498fc4bc3aee389b2f2ff8393aa5  -'
test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3sum -a 224 -Z 3)" = '0b8fb64ee5d8836956f49cbe4577afbc638c855c1d553452fc1eceb8  -'
test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3sum -a 224 -Z 4)" = '1e03b4cd9eef3892a7b5e865fce393c4bc90120d9aea84d0a0dff3b8  -'
test "$(printf 'withdrew hypothesis snakebird qmc2' | ./sha3sum -a 224 -Z 5)" = 'aac92fbfd22ce62e83ddaf2e61bd7bf696326e46d1327defa4530e20  -'

test "$(printf 'abc xyz' | ./sha3sum -a 256)" = "$(printf 'abc xyz' | ./sha3-256sum)"
test "$(printf 'abc xyz' | ./sha3sum -a 384)" = "$(printf 'abc xyz' | ./sha3-384sum)"
test "$(printf 'abc xyz' | ./sha3sum -a 512)" = "$(printf 'abc xyz' | ./sha3-512sum)"

! printf '' | ./sha3sum -a 500 >/dev/null 2>/dev/null


printf 'alef'  > .testdir/a
printf 'bet'   > .testdir/b
printf 'gimel' > .testdir/c
printf 'dalet' > .testdir/d

./sha3-224sum -u .testdir/a .testdir/b .testdir/c .testdir/d > .testdir/sums-1
./sha3-224sum -l .testdir/b .testdir/a .testdir/d .testdir/c > .testdir/sums-2

./sha3-224sum -c .testdir/sums-1
./sha3-224sum -c .testdir/sums-2

./sha3-224sum -c < .testdir/sums-1
./sha3-224sum -c < .testdir/sums-2

rm .testdir/d
set +e
./sha3-224sum -c .testdir/sums-1
x=$?
set -e
test $x = 1
printf '' > .testdir/d
set +e
./sha3-224sum -c .testdir/sums-1
x=$?
set -e
test $x = 1


printf 'dalet' > .testdir/d

./sha3-224sum -zu .testdir/a .testdir/b .testdir/c .testdir/d > .testdir/sums-1z
./sha3-224sum -lz .testdir/b .testdir/a .testdir/d .testdir/c > .testdir/sums-2z

./sha3-224sum -cz .testdir/sums-1z
./sha3-224sum -zc .testdir/sums-2z

./sha3-224sum -cz < .testdir/sums-1z
./sha3-224sum -zc < .testdir/sums-2z

rm .testdir/d
set +e
./sha3-224sum -cz .testdir/sums-1z
x=$?
set -e
test $x = 1
printf '' > .testdir/d
set +e
./sha3-224sum -cz .testdir/sums-1z
x=$?
set -e
test $x = 1

! test "$(./sha3-224sum < .testdir/sums-1z)" = "$(./sha3-224sum < .testdir/sums-1)"
test "$(./sha3-224sum < .testdir/sums-1z)" = "$(tr '\n' '\0' < .testdir/sums-1 | ./sha3-224sum)"


rm -r .testdir