Пример #1
0
void test_SHA256_HMAC(void)
{
   uint8 buf[131];
   int buflen;
   unsigned char Digest[32];
   sha256_context ctx;

   sha256_hmac_starts( &ctx, sha256_hmac_test_key[6], sha256_hmac_test_keylen[6], 0 );

   //memset( buf, '\xAA', buflen = 131 );
   //sha256_hmac_starts( &ctx, buf, buflen, 0 );

   sha256_hmac_update( &ctx, sha256_hmac_test_buf[6], sha256_hmac_test_buflen[6] );
   sha256_hmac_finish( &ctx, Digest );

   print_buffer(Digest, sizeof(Digest));
}
Пример #2
0
static void sha256_hmac_update_wrap( void *ctx, const unsigned char *input,
                                     size_t ilen )
{
    sha256_hmac_update( (sha256_context *) ctx, input, ilen );
}