hash_test.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000, 2001, 2004-2007, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: hash_test.c,v 1.19 2007/06/19 23:46:59 tbox Exp $ */
/*! \file */
#include <config.h>
#include <stdio.h>
#include <string.h>
static void
print_digest(const char *s, const char *hash, unsigned char *d,
unsigned int words)
{
unsigned int i, j;
for (i = 0; i < words; i++) {
printf(" ");
for (j = 0; j < 4; j++)
}
printf("\n");
}
int
unsigned char digest[ISC_SHA512_DIGESTLENGTH];
unsigned char buffer[1024];
const char *s;
unsigned char key[20];
s = "abc";
s = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
s = "abc";
s = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
s = "abc";
isc_md5_init(&md5);
/*
* The 3 HMAC-MD5 examples from RFC2104
*/
s = "Hi There";
s = "what do ya want for nothing?";
s = "\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335";
/*
* The 3 HMAC-SHA1 examples from RFC4634.
*/
s = "Hi There";
s = "what do ya want for nothing?";
s = "\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335";
/*
* The 3 HMAC-SHA224 examples from RFC4634.
*/
s = "Hi There";
s = "what do ya want for nothing?";
s = "\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335";
/*
* The 3 HMAC-SHA256 examples from RFC4634.
*/
s = "Hi There";
s = "what do ya want for nothing?";
s = "\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335";
/*
* The 3 HMAC-SHA384 examples from RFC4634.
*/
s = "Hi There";
s = "what do ya want for nothing?";
s = "\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335";
/*
* The 3 HMAC-SHA512 examples from RFC4634.
*/
s = "Hi There";
s = "what do ya want for nothing?";
s = "\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335"
"\335\335\335\335\335\335\335\335\335\335";
return (0);
}