Ignore:
Timestamp:
Oct 31, 2013, 11:31:47 PM (8 years ago)
Author:
katerina
Message:

Support for sha2-256 checksum (ticket #348).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/cutest_sh_tiger0.c

    r248 r444  
    88
    99#include "sh_tiger.h"
     10#include "sh_checksum.h"
    1011
    1112#if defined(HAVE_PTHREAD) && defined(SH_STEALTH)
     
    135136  char * expected;
    136137  char hashbuf[KEYBUF_SIZE];
     138  char hexdigest[SHA256_DIGEST_STRING_LENGTH];
    137139  UINT64  length;
    138140
     
    197199  actual = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf));
    198200  expected = "2FE65D1D995B8F8BC8B13F798C07E7E935A787ED00000000";
     201  CuAssertStrEquals(tc, expected, actual);
     202
     203  result = sl_close(rval_open);
     204  CuAssertTrue(tc, result == 0);
     205
     206  result = sh_tiger_hashtype("SHA256");
     207  CuAssertTrue(tc, result == 0);
     208
     209  rval_open = sl_open_fastread (__FILE__, __LINE__, "cutest_foo", SL_YESPRIV);
     210  CuAssertTrue(tc, rval_open >= 0);
     211
     212  /* same result as gpg --print-md SHA256
     213   */
     214  length = TIGER_NOLIM;
     215  {
     216    char * tmp = sh_tiger_generic_hash("cutest_foo", rval_open, &length, 0, hashbuf, sizeof(hashbuf));
     217    actual = SHA256_Base2Hex(tmp, hexdigest);
     218  }
     219  expected = "235790848f95e96b2c627f1bf58a2b8c05c535ada8c0a3326aac34ce1391ad40";
    199220  CuAssertStrEquals(tc, expected, actual);
    200221
Note: See TracChangeset for help on using the changeset viewer.