aboutsummaryrefslogtreecommitdiffstats
path: root/test
blob: 91d782e072cc9b4a113cddfbaebbb0c437993bce (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
#!/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 -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 '' | ./rawshake256sum -N 128)" = '3A1108D4A90A31B85A10BDCE77F4BFBD  -'
test "$(printf '' | ./rawshake256sum -N 8)" = '3A  -'
test "$(printf '' | ./rawshake512sum -N 128)" = '0AE7DAC687C3525D5C2A6C4119EA3968  -'


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