Index: trunk/src/cutest_sh_tiger0.c
===================================================================
--- trunk/src/cutest_sh_tiger0.c	(revision 17)
+++ trunk/src/cutest_sh_tiger0.c	(revision 19)
@@ -233,4 +233,148 @@
   CuAssertTrue(tc, result == 0);
 
-
 }  
+
+/* test checksum of file upto some given length
+ */
+void Test_tiger_file_with_length(CuTest *tc) {
+
+  SL_TICKET     rval_open;
+  FILE * fp;
+  int result;
+  char * actual;
+  char * expected;
+
+  char * teststring = "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996.\n";
+  int    testlen = strlen(teststring);
+
+  init();
+
+  fp = fopen("cutest_foo", "w");
+  CuAssertPtrNotNull(tc, fp);
+
+  result = fprintf(fp, "%s", teststring);
+  CuAssertTrue(tc, result >= 0);
+  result = fprintf(fp, "%s", teststring);
+  CuAssertTrue(tc, result >= 0);
+
+  result = fclose(fp);
+  CuAssertTrue(tc, result == 0);
+  
+  result = sh_tiger_hashtype("TIGER192");
+  CuAssertTrue(tc, result == 0);
+
+  /* same as GnuPG 1.0.6 (gpg --load-extension tiger --print-md TIGER192) 
+   */
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, testlen, 0);
+  expected = "75B98A7AE257A230189828A40792E30B4038D286479CC7B8";
+  CuAssertStrEquals(tc, expected, actual);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 2*testlen, 0);
+  expected = "B5B4FB97B01ADB58794D87A6A01B2368852FA764BD93AB90";
+  CuAssertStrEquals(tc, expected, actual);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 0, 0);
+  expected = "B5B4FB97B01ADB58794D87A6A01B2368852FA764BD93AB90";
+  CuAssertStrEquals(tc, expected, actual);
+
+  fp = fopen("cutest_foo", "a");
+  CuAssertPtrNotNull(tc, fp);
+  result = fprintf(fp, "%s", teststring);
+  CuAssertTrue(tc, result >= 0);
+  result = fclose(fp);
+  CuAssertTrue(tc, result == 0);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, testlen, 0);
+  expected = "75B98A7AE257A230189828A40792E30B4038D286479CC7B8";
+  CuAssertStrEquals(tc, expected, actual);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 2*testlen, 0);
+  expected = "B5B4FB97B01ADB58794D87A6A01B2368852FA764BD93AB90";
+  CuAssertStrEquals(tc, expected, actual);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 3*testlen, 0);
+  expected = "D0EE1A9956CAB22D84B51A5E0C093B724828C6A1F9CBDB7F";
+  CuAssertStrEquals(tc, expected, actual);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 0, 0);
+  expected = "D0EE1A9956CAB22D84B51A5E0C093B724828C6A1F9CBDB7F";
+  CuAssertStrEquals(tc, expected, actual);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FILE, 5, 0);
+  expected = "9F00F599072300DD276ABB38C8EB6DEC37790C116F9D2BDF";
+  CuAssertStrEquals(tc, expected, actual);
+
+  /* same results as GNU md5sum */
+
+  result = sh_tiger_hashtype("MD5");
+  CuAssertTrue(tc, result == 0);
+
+  rval_open = sl_open_fastread ("cutest_foo", SL_YESPRIV);
+  CuAssertTrue(tc, rval_open >= 0);
+  tiger_fd  = rval_open;
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, testlen, 0);
+  expected = "11E7E7EA486136273606BEE57C71F34B0000000000000000";
+  CuAssertStrEquals(tc, expected, actual);
+
+  result = sl_rewind(rval_open);
+  CuAssertTrue(tc, rval_open >= 0);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 2*testlen, 0);
+  expected = "D49DAD474095D467E2E5EFCB2DC23A770000000000000000";
+  CuAssertStrEquals(tc, expected, actual);
+
+  result = sl_rewind(rval_open);
+  CuAssertTrue(tc, rval_open >= 0);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 3*testlen, 0);
+  expected = "00A1F1C5EDDCCFC430D3862FDA94593E0000000000000000";
+  CuAssertStrEquals(tc, expected, actual);
+
+  result = sl_rewind(rval_open);
+  CuAssertTrue(tc, rval_open >= 0);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 0, 0);
+  expected = "00A1F1C5EDDCCFC430D3862FDA94593E0000000000000000";
+  CuAssertStrEquals(tc, expected, actual);
+
+  /* same result as gpg --print-md SHA1 
+   */
+
+  result = sh_tiger_hashtype("SHA1");
+  CuAssertTrue(tc, result == 0);
+
+  result = sl_rewind(rval_open);
+  CuAssertTrue(tc, rval_open >= 0);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, testlen, 0);
+  expected = "F37DB4344CCD140EE315179E9A27512FB4704F0F00000000";
+  CuAssertStrEquals(tc, expected, actual);
+
+  result = sl_rewind(rval_open);
+  CuAssertTrue(tc, rval_open >= 0);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 2*testlen, 0);
+  expected = "D2AD5FC366452D81400BAC31F96269DEEF314BC200000000";
+  CuAssertStrEquals(tc, expected, actual);
+
+  result = sl_rewind(rval_open);
+  CuAssertTrue(tc, rval_open >= 0);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 3*testlen, 0);
+  expected = "FAA937EF3389C7E786EB0F1006D049D7AEA7B7B600000000";
+  CuAssertStrEquals(tc, expected, actual);
+
+  result = sl_rewind(rval_open);
+  CuAssertTrue(tc, rval_open >= 0);
+
+  actual = sh_tiger_generic_hash("cutest_foo", TIGER_FD, 0, 0);
+  expected = "FAA937EF3389C7E786EB0F1006D049D7AEA7B7B600000000";
+  CuAssertStrEquals(tc, expected, actual);
+
+  result = sl_close(rval_open);
+  CuAssertTrue(tc, result == 0);
+
+  result = remove("cutest_foo");
+  CuAssertTrue(tc, result == 0);
+}
