Changeset 133 for trunk/src/cutest_sh_tiger0.c
- Timestamp:
- Oct 25, 2007, 12:19:05 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cutest_sh_tiger0.c
r107 r133 67 67 char * actual; 68 68 char * expected; 69 char hashbuf[KEYBUF_SIZE]; 69 70 70 71 input = ""; 71 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input) );72 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input), hashbuf, sizeof(hashbuf)); 72 73 expected = "24F0130C63AC933216166E76B1BB925FF373DE2D49584E7A"; 73 74 CuAssertStrEquals(tc, expected, actual); 74 75 75 76 input = "abc"; 76 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input) );77 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input), hashbuf, sizeof(hashbuf)); 77 78 expected = "F258C1E88414AB2A527AB541FFC5B8BF935F7B951C132951"; 78 79 CuAssertStrEquals(tc, expected, actual); 79 80 80 81 input = "Tiger"; 81 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input) );82 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input), hashbuf, sizeof(hashbuf)); 82 83 expected = "9F00F599072300DD276ABB38C8EB6DEC37790C116F9D2BDF"; 83 84 CuAssertStrEquals(tc, expected, actual); 84 85 85 86 input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-"; 86 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input) );87 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input), hashbuf, sizeof(hashbuf)); 87 88 expected = "87FB2A9083851CF7470D2CF810E6DF9EB586445034A5A386"; 88 89 CuAssertStrEquals(tc, expected, actual); 89 90 90 91 input = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789"; 91 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input) );92 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input), hashbuf, sizeof(hashbuf)); 92 93 expected = "467DB80863EBCE488DF1CD1261655DE957896565975F9197"; 93 94 CuAssertStrEquals(tc, expected, actual); 94 95 95 96 input = "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham"; 96 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input) );97 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input), hashbuf, sizeof(hashbuf)); 97 98 expected = "0C410A042968868A1671DA5A3FD29A725EC1E457D3CDB303"; 98 99 CuAssertStrEquals(tc, expected, actual); 99 100 100 101 input = "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge."; 101 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input) );102 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input), hashbuf, sizeof(hashbuf)); 102 103 expected = "EBF591D5AFA655CE7F22894FF87F54AC89C811B6B0DA3193"; 103 104 CuAssertStrEquals(tc, expected, actual); 104 105 105 106 input = "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996."; 106 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input) );107 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input), hashbuf, sizeof(hashbuf)); 107 108 expected = "3D9AEB03D1BD1A6357B2774DFD6D5B24DD68151D503974FC"; 108 109 CuAssertStrEquals(tc, expected, actual); 109 110 110 111 input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-"; 111 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input) );112 actual = sh_tiger_hash(input, TIGER_DATA, strlen(input), hashbuf, sizeof(hashbuf)); 112 113 expected = "00B83EB4E53440C576AC6AAEE0A7485825FD15E70A59FFE4"; 113 114 CuAssertStrEquals(tc, expected, actual); … … 121 122 char * actual; 122 123 char * expected; 124 char hashbuf[KEYBUF_SIZE]; 123 125 124 126 init(); … … 139 141 /* same result as GnuPG 1.0.6 (gpg --load-extension tiger --print-md TIGER192) 140 142 */ 141 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0 );143 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 142 144 expected = "0E9321614C966A33608C2A15F156E0435CACFD1213B9F095"; 143 145 CuAssertStrEquals(tc, expected, actual); … … 145 147 rval_open = sl_open_fastread ("cutest_foo", SL_YESPRIV); 146 148 CuAssertTrue(tc, rval_open >= 0); 147 tiger_fd = rval_open; 148 149 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, TIGER_NOLIM, 0); 149 150 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 150 151 expected = "0E9321614C966A33608C2A15F156E0435CACFD1213B9F095"; 151 152 CuAssertStrEquals(tc, expected, actual); … … 159 160 rval_open = sl_open_fastread ("cutest_foo", SL_YESPRIV); 160 161 CuAssertTrue(tc, rval_open >= 0); 161 tiger_fd = rval_open;162 162 163 163 /* same result as GNU md5sum 164 164 */ 165 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, TIGER_NOLIM, 0);165 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 166 166 expected = "AEEC4DDA496BCFBA691F4E8863BA84C00000000000000000"; 167 167 CuAssertStrEquals(tc, expected, actual); … … 175 175 rval_open = sl_open_fastread ("cutest_foo", SL_YESPRIV); 176 176 CuAssertTrue(tc, rval_open >= 0); 177 tiger_fd = rval_open;178 177 179 178 /* same result as gpg --print-md SHA1 180 179 */ 181 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, TIGER_NOLIM, 0);180 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 182 181 expected = "2FE65D1D995B8F8BC8B13F798C07E7E935A787ED00000000"; 183 182 CuAssertStrEquals(tc, expected, actual); … … 205 204 /* same result as GnuPG 1.0.6 (gpg --load-extension tiger --print-md TIGER192) 206 205 */ 207 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0 );206 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 208 207 expected = "F987845A0EA784367BF9E4DB09014995810F27C99C891734"; 209 208 CuAssertStrEquals(tc, expected, actual); … … 228 227 /* same result as GnuPG 1.0.6 (gpg --load-extension tiger --print-md TIGER192) 229 228 */ 230 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0 );229 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 231 230 expected = "75B98A7AE257A230189828A40792E30B4038D286479CC7B8"; 232 231 CuAssertStrEquals(tc, expected, actual); … … 246 245 char * actual; 247 246 char * expected; 247 char hashbuf[KEYBUF_SIZE]; 248 248 249 249 char * teststring = "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996.\n"; … … 268 268 /* same as GnuPG 1.0.6 (gpg --load-extension tiger --print-md TIGER192) 269 269 */ 270 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 0, 0 );270 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 0, 0, hashbuf, sizeof(hashbuf)); 271 271 expected = "24F0130C63AC933216166E76B1BB925FF373DE2D49584E7A"; 272 272 CuAssertStrEquals(tc, expected, actual); 273 273 274 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, testlen, 0 );274 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, testlen, 0, hashbuf, sizeof(hashbuf)); 275 275 expected = "75B98A7AE257A230189828A40792E30B4038D286479CC7B8"; 276 276 CuAssertStrEquals(tc, expected, actual); 277 277 278 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 2*testlen, 0 );278 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 2*testlen, 0, hashbuf, sizeof(hashbuf)); 279 279 expected = "B5B4FB97B01ADB58794D87A6A01B2368852FA764BD93AB90"; 280 280 CuAssertStrEquals(tc, expected, actual); 281 281 282 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0 );282 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 283 283 expected = "B5B4FB97B01ADB58794D87A6A01B2368852FA764BD93AB90"; 284 284 CuAssertStrEquals(tc, expected, actual); … … 291 291 CuAssertTrue(tc, result == 0); 292 292 293 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, testlen, 0 );293 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, testlen, 0, hashbuf, sizeof(hashbuf)); 294 294 expected = "75B98A7AE257A230189828A40792E30B4038D286479CC7B8"; 295 295 CuAssertStrEquals(tc, expected, actual); 296 296 297 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 2*testlen, 0 );297 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 2*testlen, 0, hashbuf, sizeof(hashbuf)); 298 298 expected = "B5B4FB97B01ADB58794D87A6A01B2368852FA764BD93AB90"; 299 299 CuAssertStrEquals(tc, expected, actual); 300 300 301 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 3*testlen, 0 );301 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 3*testlen, 0, hashbuf, sizeof(hashbuf)); 302 302 expected = "D0EE1A9956CAB22D84B51A5E0C093B724828C6A1F9CBDB7F"; 303 303 CuAssertStrEquals(tc, expected, actual); 304 304 305 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0 );305 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 306 306 expected = "D0EE1A9956CAB22D84B51A5E0C093B724828C6A1F9CBDB7F"; 307 307 CuAssertStrEquals(tc, expected, actual); 308 308 309 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 5, 0 );309 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 5, 0, hashbuf, sizeof(hashbuf)); 310 310 expected = "9F00F599072300DD276ABB38C8EB6DEC37790C116F9D2BDF"; 311 311 CuAssertStrEquals(tc, expected, actual); … … 318 318 rval_open = sl_open_fastread ("cutest_foo", SL_YESPRIV); 319 319 CuAssertTrue(tc, rval_open >= 0); 320 tiger_fd = rval_open; 321 322 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, testlen, 0); 320 321 actual = sh_tiger_generic_hash("cutest_foo", rval_open, testlen, 0, hashbuf, sizeof(hashbuf)); 323 322 expected = "11E7E7EA486136273606BEE57C71F34B0000000000000000"; 324 323 CuAssertStrEquals(tc, expected, actual); … … 327 326 CuAssertTrue(tc, rval_open >= 0); 328 327 329 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 2*testlen, 0);328 actual = sh_tiger_generic_hash("cutest_foo", rval_open, 2*testlen, 0, hashbuf, sizeof(hashbuf)); 330 329 expected = "D49DAD474095D467E2E5EFCB2DC23A770000000000000000"; 331 330 CuAssertStrEquals(tc, expected, actual); … … 334 333 CuAssertTrue(tc, rval_open >= 0); 335 334 336 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 3*testlen, 0);335 actual = sh_tiger_generic_hash("cutest_foo", rval_open, 3*testlen, 0, hashbuf, sizeof(hashbuf)); 337 336 expected = "00A1F1C5EDDCCFC430D3862FDA94593E0000000000000000"; 338 337 CuAssertStrEquals(tc, expected, actual); … … 341 340 CuAssertTrue(tc, rval_open >= 0); 342 341 343 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, TIGER_NOLIM, 0);342 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 344 343 expected = "00A1F1C5EDDCCFC430D3862FDA94593E0000000000000000"; 345 344 CuAssertStrEquals(tc, expected, actual); … … 354 353 CuAssertTrue(tc, rval_open >= 0); 355 354 356 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, testlen, 0);355 actual = sh_tiger_generic_hash("cutest_foo", rval_open, testlen, 0, hashbuf, sizeof(hashbuf)); 357 356 expected = "F37DB4344CCD140EE315179E9A27512FB4704F0F00000000"; 358 357 CuAssertStrEquals(tc, expected, actual); … … 361 360 CuAssertTrue(tc, rval_open >= 0); 362 361 363 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 2*testlen, 0);362 actual = sh_tiger_generic_hash("cutest_foo", rval_open, 2*testlen, 0, hashbuf, sizeof(hashbuf)); 364 363 expected = "D2AD5FC366452D81400BAC31F96269DEEF314BC200000000"; 365 364 CuAssertStrEquals(tc, expected, actual); … … 368 367 CuAssertTrue(tc, rval_open >= 0); 369 368 370 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 3*testlen, 0);369 actual = sh_tiger_generic_hash("cutest_foo", rval_open, 3*testlen, 0, hashbuf, sizeof(hashbuf)); 371 370 expected = "FAA937EF3389C7E786EB0F1006D049D7AEA7B7B600000000"; 372 371 CuAssertStrEquals(tc, expected, actual); … … 375 374 CuAssertTrue(tc, rval_open >= 0); 376 375 377 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, TIGER_NOLIM, 0);376 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 378 377 expected = "FAA937EF3389C7E786EB0F1006D049D7AEA7B7B600000000"; 379 378 CuAssertStrEquals(tc, expected, actual);
Note:
See TracChangeset
for help on using the changeset viewer.