Changeset 151 for trunk/src/cutest_sh_tiger0.c
- Timestamp:
- Jan 9, 2008, 10:49:15 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cutest_sh_tiger0.c
r137 r151 135 135 char * expected; 136 136 char hashbuf[KEYBUF_SIZE]; 137 UINT64 length; 137 138 138 139 init(); … … 153 154 /* same result as GnuPG 1.0.6 (gpg --load-extension tiger --print-md TIGER192) 154 155 */ 155 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 156 length = TIGER_NOLIM; 157 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 156 158 expected = "0E9321614C966A33608C2A15F156E0435CACFD1213B9F095"; 157 159 CuAssertStrEquals(tc, expected, actual); … … 160 162 CuAssertTrue(tc, rval_open >= 0); 161 163 162 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 164 length = TIGER_NOLIM; 165 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 163 166 expected = "0E9321614C966A33608C2A15F156E0435CACFD1213B9F095"; 164 167 CuAssertStrEquals(tc, expected, actual); … … 175 178 /* same result as GNU md5sum 176 179 */ 177 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 180 length = TIGER_NOLIM; 181 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 178 182 expected = "AEEC4DDA496BCFBA691F4E8863BA84C00000000000000000"; 179 183 CuAssertStrEquals(tc, expected, actual); … … 190 194 /* same result as gpg --print-md SHA1 191 195 */ 192 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 196 length = TIGER_NOLIM; 197 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 193 198 expected = "2FE65D1D995B8F8BC8B13F798C07E7E935A787ED00000000"; 194 199 CuAssertStrEquals(tc, expected, actual); … … 216 221 /* same result as GnuPG 1.0.6 (gpg --load-extension tiger --print-md TIGER192) 217 222 */ 218 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 223 length = TIGER_NOLIM; 224 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 219 225 expected = "F987845A0EA784367BF9E4DB09014995810F27C99C891734"; 220 226 CuAssertStrEquals(tc, expected, actual); … … 239 245 /* same result as GnuPG 1.0.6 (gpg --load-extension tiger --print-md TIGER192) 240 246 */ 241 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 247 length = TIGER_NOLIM; 248 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 242 249 expected = "75B98A7AE257A230189828A40792E30B4038D286479CC7B8"; 243 250 CuAssertStrEquals(tc, expected, actual); … … 258 265 char * expected; 259 266 char hashbuf[KEYBUF_SIZE]; 267 UINT64 length; 260 268 261 269 char * teststring = "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996.\n"; 262 int testlen = strlen(teststring);270 size_t testlen = strlen(teststring); 263 271 264 272 init(); … … 280 288 /* same as GnuPG 1.0.6 (gpg --load-extension tiger --print-md TIGER192) 281 289 */ 282 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 0, 0, hashbuf, sizeof(hashbuf)); 290 length = 0; 291 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 283 292 expected = "24F0130C63AC933216166E76B1BB925FF373DE2D49584E7A"; 284 293 CuAssertStrEquals(tc, expected, actual); 285 286 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, testlen, 0, hashbuf, sizeof(hashbuf)); 294 CuAssertTrue(tc, 0 == length); 295 296 length = testlen; 297 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 287 298 expected = "75B98A7AE257A230189828A40792E30B4038D286479CC7B8"; 288 299 CuAssertStrEquals(tc, expected, actual); 289 290 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 2*testlen, 0, hashbuf, sizeof(hashbuf)); 300 CuAssertTrue(tc, testlen == length); 301 302 length = 2*testlen; 303 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 291 304 expected = "B5B4FB97B01ADB58794D87A6A01B2368852FA764BD93AB90"; 292 305 CuAssertStrEquals(tc, expected, actual); 293 294 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 306 CuAssertTrue(tc, 2*testlen == length); 307 308 length = TIGER_NOLIM; 309 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 295 310 expected = "B5B4FB97B01ADB58794D87A6A01B2368852FA764BD93AB90"; 296 311 CuAssertStrEquals(tc, expected, actual); 312 CuAssertTrue(tc, 2*testlen == length); 297 313 298 314 fp = fopen("cutest_foo", "a"); … … 303 319 CuAssertTrue(tc, result == 0); 304 320 305 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, testlen, 0, hashbuf, sizeof(hashbuf)); 321 length = testlen; 322 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 306 323 expected = "75B98A7AE257A230189828A40792E30B4038D286479CC7B8"; 307 324 CuAssertStrEquals(tc, expected, actual); 308 309 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 2*testlen, 0, hashbuf, sizeof(hashbuf)); 325 CuAssertTrue(tc, testlen == length); 326 327 length = 2*testlen; 328 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 310 329 expected = "B5B4FB97B01ADB58794D87A6A01B2368852FA764BD93AB90"; 311 330 CuAssertStrEquals(tc, expected, actual); 312 313 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 3*testlen, 0, hashbuf, sizeof(hashbuf)); 331 CuAssertTrue(tc, 2*testlen == length); 332 333 length = 3*testlen; 334 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 314 335 expected = "D0EE1A9956CAB22D84B51A5E0C093B724828C6A1F9CBDB7F"; 315 336 CuAssertStrEquals(tc, expected, actual); 316 317 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 337 CuAssertTrue(tc, 3*testlen == length); 338 339 length = TIGER_NOLIM; 340 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 318 341 expected = "D0EE1A9956CAB22D84B51A5E0C093B724828C6A1F9CBDB7F"; 319 342 CuAssertStrEquals(tc, expected, actual); 320 321 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 5, 0, hashbuf, sizeof(hashbuf)); 343 CuAssertTrue(tc, 3*testlen == length); 344 345 length = 5; 346 actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, &length, 0, hashbuf, sizeof(hashbuf)); 322 347 expected = "9F00F599072300DD276ABB38C8EB6DEC37790C116F9D2BDF"; 323 348 CuAssertStrEquals(tc, expected, actual); 349 CuAssertTrue(tc, 5 == length); 324 350 325 351 /* same results as GNU md5sum */ … … 331 357 CuAssertTrue(tc, rval_open >= 0); 332 358 333 actual = sh_tiger_generic_hash("cutest_foo", rval_open, testlen, 0, hashbuf, sizeof(hashbuf)); 359 length = testlen; 360 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 334 361 expected = "11E7E7EA486136273606BEE57C71F34B0000000000000000"; 335 362 CuAssertStrEquals(tc, expected, actual); 336 337 result = sl_rewind(rval_open); 338 CuAssertTrue(tc, rval_open >= 0); 339 340 actual = sh_tiger_generic_hash("cutest_foo", rval_open, 2*testlen, 0, hashbuf, sizeof(hashbuf)); 363 CuAssertTrue(tc, testlen == length); 364 365 result = sl_rewind(rval_open); 366 CuAssertTrue(tc, rval_open >= 0); 367 368 length = 2*testlen; 369 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 341 370 expected = "D49DAD474095D467E2E5EFCB2DC23A770000000000000000"; 342 371 CuAssertStrEquals(tc, expected, actual); 343 344 result = sl_rewind(rval_open); 345 CuAssertTrue(tc, rval_open >= 0); 346 347 actual = sh_tiger_generic_hash("cutest_foo", rval_open, 3*testlen, 0, hashbuf, sizeof(hashbuf)); 372 CuAssertTrue(tc, 2*testlen == length); 373 374 result = sl_rewind(rval_open); 375 CuAssertTrue(tc, rval_open >= 0); 376 377 length = 3*testlen; 378 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 348 379 expected = "00A1F1C5EDDCCFC430D3862FDA94593E0000000000000000"; 349 380 CuAssertStrEquals(tc, expected, actual); 350 351 result = sl_rewind(rval_open); 352 CuAssertTrue(tc, rval_open >= 0); 353 354 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 381 CuAssertTrue(tc, 3*testlen == length); 382 383 result = sl_rewind(rval_open); 384 CuAssertTrue(tc, rval_open >= 0); 385 386 length = TIGER_NOLIM; 387 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 355 388 expected = "00A1F1C5EDDCCFC430D3862FDA94593E0000000000000000"; 356 389 CuAssertStrEquals(tc, expected, actual); 390 CuAssertTrue(tc, 3*testlen == length); 357 391 358 392 /* same result as gpg --print-md SHA1 … … 365 399 CuAssertTrue(tc, rval_open >= 0); 366 400 367 actual = sh_tiger_generic_hash("cutest_foo", rval_open, testlen, 0, hashbuf, sizeof(hashbuf)); 401 length = testlen; 402 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 368 403 expected = "F37DB4344CCD140EE315179E9A27512FB4704F0F00000000"; 369 404 CuAssertStrEquals(tc, expected, actual); 370 371 result = sl_rewind(rval_open); 372 CuAssertTrue(tc, rval_open >= 0); 373 374 actual = sh_tiger_generic_hash("cutest_foo", rval_open, 2*testlen, 0, hashbuf, sizeof(hashbuf)); 405 CuAssertTrue(tc, testlen == length); 406 407 result = sl_rewind(rval_open); 408 CuAssertTrue(tc, rval_open >= 0); 409 410 length = 2*testlen; 411 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 375 412 expected = "D2AD5FC366452D81400BAC31F96269DEEF314BC200000000"; 376 413 CuAssertStrEquals(tc, expected, actual); 377 378 result = sl_rewind(rval_open); 379 CuAssertTrue(tc, rval_open >= 0); 380 381 actual = sh_tiger_generic_hash("cutest_foo", rval_open, 3*testlen, 0, hashbuf, sizeof(hashbuf)); 414 CuAssertTrue(tc, 2*testlen == length); 415 416 result = sl_rewind(rval_open); 417 CuAssertTrue(tc, rval_open >= 0); 418 419 length = 3*testlen; 420 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 382 421 expected = "FAA937EF3389C7E786EB0F1006D049D7AEA7B7B600000000"; 383 422 CuAssertStrEquals(tc, expected, actual); 384 385 result = sl_rewind(rval_open); 386 CuAssertTrue(tc, rval_open >= 0); 387 388 actual = sh_tiger_generic_hash("cutest_foo", rval_open, TIGER_NOLIM, 0, hashbuf, sizeof(hashbuf)); 423 CuAssertTrue(tc, 3*testlen == length); 424 425 result = sl_rewind(rval_open); 426 CuAssertTrue(tc, rval_open >= 0); 427 428 length = TIGER_NOLIM; 429 actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf)); 389 430 expected = "FAA937EF3389C7E786EB0F1006D049D7AEA7B7B600000000"; 390 431 CuAssertStrEquals(tc, expected, actual); 432 CuAssertTrue(tc, 3*testlen == length); 391 433 392 434 result = sl_close(rval_open);
Note:
See TracChangeset
for help on using the changeset viewer.