From d3187d77683cc7c81be53c12386630debeccb20b Mon Sep 17 00:00:00 2001 From: mdw Date: Wed, 21 Feb 2001 20:04:36 +0000 Subject: [PATCH] Added support for MD2 hash function. --- .cvsignore | 4 ++ Makefile.m4 | 7 +- hashsum.c | 8 ++- md2-tab.h | 88 +++++++++++++++++++++++ md2.c | 231 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ md2.h | 166 +++++++++++++++++++++++++++++++++++++++++++ rspit.c | 7 +- tests/md2 | 79 +++++++++++++++++++++ 8 files changed, 585 insertions(+), 5 deletions(-) create mode 100644 md2-tab.h create mode 100644 md2.c create mode 100644 md2.h create mode 100644 tests/md2 diff --git a/.cvsignore b/.cvsignore index 334af62..0c19f76 100644 --- a/.cvsignore +++ b/.cvsignore @@ -70,6 +70,10 @@ idea-ecb.c idea-ecb.h idea-ofb.c idea-ofb.h +md2-hmac.c +md2-hmac.h +md2-mgf.c +md2-mgf.h md4-hmac.c md4-hmac.h md4-mgf.c diff --git a/Makefile.m4 b/Makefile.m4 index a6fe15d..120dbb5 100644 --- a/Makefile.m4 +++ b/Makefile.m4 @@ -1,6 +1,6 @@ ## -*-makefile-*- ## -## $Id: Makefile.m4,v 1.45 2001/02/03 16:09:41 mdw Exp $ +## $Id: Makefile.m4,v 1.46 2001/02/21 20:03:22 mdw Exp $ ## ## Makefile for Catacomb ## @@ -29,6 +29,9 @@ ##----- Revision history ---------------------------------------------------- ## ## $Log: Makefile.m4,v $ +## Revision 1.46 2001/02/21 20:03:22 mdw +## Added support for MD2 hash function. +## ## Revision 1.45 2001/02/03 16:09:41 mdw ## New files added. ## @@ -208,7 +211,7 @@ _(serpent)') define(`cipher_modes', `_(ecb) _(cbc) _(cfb) _(ofb) _(counter)') define(`hashes', `dnl -_(md5) _(md4) _(tiger) dnl +_(md5) _(md4) _(md2) _(tiger) dnl _(sha) _(sha256) _(sha384) _(sha512) dnl _(rmd128) _(rmd160) _(rmd256) _(rmd320)') define(`hash_modes', `_(mgf) _(hmac)') diff --git a/hashsum.c b/hashsum.c index 35e35fb..0776ee8 100644 --- a/hashsum.c +++ b/hashsum.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: hashsum.c,v 1.6 2001/01/25 21:40:14 mdw Exp $ + * $Id: hashsum.c,v 1.7 2001/02/21 20:03:22 mdw Exp $ * * Hash files using some secure hash function * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: hashsum.c,v $ + * Revision 1.7 2001/02/21 20:03:22 mdw + * Added support for MD2 hash function. + * * Revision 1.6 2001/01/25 21:40:14 mdw * Support for new SHA variants added. * @@ -73,6 +76,7 @@ #include "ghash.h" +#include "md2.h" #include "md4.h" #include "md5.h" #include "rmd128.h" @@ -88,7 +92,7 @@ /*----- Static variables --------------------------------------------------*/ static const gchash *hashtab[] = { - &md5, &md4, + &md5, &md4, &md2, &sha, &sha256, &sha384, &sha512, &rmd128, &rmd160, &rmd256, &rmd320, &tiger, diff --git a/md2-tab.h b/md2-tab.h new file mode 100644 index 0000000..5bdc4a9 --- /dev/null +++ b/md2-tab.h @@ -0,0 +1,88 @@ +/* -*-c-*- + * + * $Id: md2-tab.h,v 1.1 2001/02/21 20:03:22 mdw Exp $ + * + * Tables for MD2 + * + * (c) 2001 Straylight/Edgeware + */ + +/*----- Licensing notice --------------------------------------------------* + * + * This file is part of Catacomb. + * + * Catacomb is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * Catacomb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with Catacomb; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +/*----- Revision history --------------------------------------------------* + * + * $Log: md2-tab.h,v $ + * Revision 1.1 2001/02/21 20:03:22 mdw + * Added support for MD2 hash function. + * + */ + +#ifndef CATACOMB_MD2_TAB_H +#define CATACOMB_MD2_TAB_H + +#ifdef __cplusplus + extern "C" { +#endif + +/*----- S-box table -------------------------------------------------------*/ + +#define MD2_S { \ + 0x29, 0x2e, 0x43, 0xc9, 0xa2, 0xd8, 0x7c, 0x01, \ + 0x3d, 0x36, 0x54, 0xa1, 0xec, 0xf0, 0x06, 0x13, \ + 0x62, 0xa7, 0x05, 0xf3, 0xc0, 0xc7, 0x73, 0x8c, \ + 0x98, 0x93, 0x2b, 0xd9, 0xbc, 0x4c, 0x82, 0xca, \ + 0x1e, 0x9b, 0x57, 0x3c, 0xfd, 0xd4, 0xe0, 0x16, \ + 0x67, 0x42, 0x6f, 0x18, 0x8a, 0x17, 0xe5, 0x12, \ + 0xbe, 0x4e, 0xc4, 0xd6, 0xda, 0x9e, 0xde, 0x49, \ + 0xa0, 0xfb, 0xf5, 0x8e, 0xbb, 0x2f, 0xee, 0x7a, \ + 0xa9, 0x68, 0x79, 0x91, 0x15, 0xb2, 0x07, 0x3f, \ + 0x94, 0xc2, 0x10, 0x89, 0x0b, 0x22, 0x5f, 0x21, \ + 0x80, 0x7f, 0x5d, 0x9a, 0x5a, 0x90, 0x32, 0x27, \ + 0x35, 0x3e, 0xcc, 0xe7, 0xbf, 0xf7, 0x97, 0x03, \ + 0xff, 0x19, 0x30, 0xb3, 0x48, 0xa5, 0xb5, 0xd1, \ + 0xd7, 0x5e, 0x92, 0x2a, 0xac, 0x56, 0xaa, 0xc6, \ + 0x4f, 0xb8, 0x38, 0xd2, 0x96, 0xa4, 0x7d, 0xb6, \ + 0x76, 0xfc, 0x6b, 0xe2, 0x9c, 0x74, 0x04, 0xf1, \ + 0x45, 0x9d, 0x70, 0x59, 0x64, 0x71, 0x87, 0x20, \ + 0x86, 0x5b, 0xcf, 0x65, 0xe6, 0x2d, 0xa8, 0x02, \ + 0x1b, 0x60, 0x25, 0xad, 0xae, 0xb0, 0xb9, 0xf6, \ + 0x1c, 0x46, 0x61, 0x69, 0x34, 0x40, 0x7e, 0x0f, \ + 0x55, 0x47, 0xa3, 0x23, 0xdd, 0x51, 0xaf, 0x3a, \ + 0xc3, 0x5c, 0xf9, 0xce, 0xba, 0xc5, 0xea, 0x26, \ + 0x2c, 0x53, 0x0d, 0x6e, 0x85, 0x28, 0x84, 0x09, \ + 0xd3, 0xdf, 0xcd, 0xf4, 0x41, 0x81, 0x4d, 0x52, \ + 0x6a, 0xdc, 0x37, 0xc8, 0x6c, 0xc1, 0xab, 0xfa, \ + 0x24, 0xe1, 0x7b, 0x08, 0x0c, 0xbd, 0xb1, 0x4a, \ + 0x78, 0x88, 0x95, 0x8b, 0xe3, 0x63, 0xe8, 0x6d, \ + 0xe9, 0xcb, 0xd5, 0xfe, 0x3b, 0x00, 0x1d, 0x39, \ + 0xf2, 0xef, 0xb7, 0x0e, 0x66, 0x58, 0xd0, 0xe4, \ + 0xa6, 0x77, 0x72, 0xf8, 0xeb, 0x75, 0x4b, 0x0a, \ + 0x31, 0x44, 0x50, 0xb4, 0x8f, 0xed, 0x1f, 0x1a, \ + 0xdb, 0x99, 0x8d, 0x33, 0x9f, 0x11, 0x83, 0x14 \ +} + +/*----- That's all, folks -------------------------------------------------*/ + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/md2.c b/md2.c new file mode 100644 index 0000000..b93a1b2 --- /dev/null +++ b/md2.c @@ -0,0 +1,231 @@ +/* -*-c-*- + * + * $Id: md2.c,v 1.1 2001/02/21 20:03:22 mdw Exp $ + * + * The MD2 message digest function + * + * (c) 2001 Straylight/Edgeware + */ + +/*----- Licensing notice --------------------------------------------------* + * + * This file is part of Catacomb. + * + * Catacomb is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * Catacomb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with Catacomb; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +/*----- Revision history --------------------------------------------------* + * + * $Log: md2.c,v $ + * Revision 1.1 2001/02/21 20:03:22 mdw + * Added support for MD2 hash function. + * + */ + +/*----- Header files ------------------------------------------------------*/ + +#include + +#include "ghash.h" +#include "ghash-def.h" +#include "hash.h" +#include "md2.h" +#include "md2-tab.h" + +/*----- Tables ------------------------------------------------------------*/ + +static octet s[256] = MD2_S; + +/*----- Main code ---------------------------------------------------------*/ + +/* --- @md2_compress@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block + * @const void *sbuf@ = pointer to buffer of appropriate size + * + * Returns: --- + * + * Use: MD2 compression and checksum function. + */ + +void md2_compress(md2_ctx *ctx, const void *sbuf) +{ + unsigned i; + unsigned t; + octet x[MD2_BUFSZ]; + octet y[MD2_BUFSZ]; + + /* --- Handy macro for doing something lots of times --- */ + +#define DO(what, where) do { \ + what(where, 0); what(where, 1); what(where, 2); what(where, 3); \ + what(where, 4); what(where, 5); what(where, 6); what(where, 7); \ + what(where, 8); what(where, 9); what(where, 10); what(where, 11); \ + what(where, 12); what(where, 13); what(where, 14); what(where, 15); \ +} while (0) + + /* --- Do the hashing first to avoid corrupting the checksum --- */ + + memcpy(x, sbuf, sizeof(x)); +#define X(z, i) y[i] = z[i] ^ ctx->h[i] + DO(X, x); +#undef X + + t = 0; + for (i = 0; i < 18; i++) { +#define X(z, i) t = z[i] ^= s[t]; + DO(X, ctx->h); + DO(X, x); + DO(X, y); +#undef X + t = U8(t + i); + } + + /* --- Now compute the checksum --- */ + + t = ctx->c[MD2_BUFSZ - 1]; +#define X(z, i) t = ctx->c[i] ^= s[z[i] ^ t] + DO(X, ((const octet *)sbuf)); +#undef X + +#undef DO +} + +/* --- @md2_init@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block to initialize + * + * Returns: --- + * + * Use: Initializes a context block ready for hashing. + */ + +void md2_init(md2_ctx *ctx) +{ + memset(ctx->c, 0, sizeof(ctx->c)); + memset(ctx->h, 0, sizeof(ctx->h)); + ctx->off = 0; +} + +/* --- @md2_set@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block + * @const void *buf@ = pointer to state buffer + * @unsigned long count@ = current count of bytes processed + * + * Returns: --- + * + * Use: Initializes a context block from a given state. This is + * useful in cases where the initial hash state is meant to be + * secret, e.g., for NMAC and HMAC support. + */ + +void md2_set(md2_ctx *ctx, const void *buf, unsigned long count) +{ + const octet *p = buf; + memcpy(ctx->h, p, MD2_BUFSZ); + memcpy(ctx->c, p + MD2_BUFSZ, MD2_BUFSZ); + ctx->off = 0; +} + +/* --- @md2_hash@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block + * @const void *buf@ = buffer of data to hash + * @size_t sz@ = size of buffer to hash + * + * Returns: --- + * + * Use: Hashes a buffer of data. The buffer may be of any size and + * alignment. + */ + +void md2_hash(md2_ctx *ctx, const void *buf, size_t sz) +{ + const octet *bbuf = (octet *)buf; + + /* --- Code automatically expanded from @HASH_BUFFER@ and tidied --- */ + + if (ctx->off + sz < MD2_BUFSZ) { + memcpy(ctx->buf + ctx->off, bbuf, sz); + ctx->off += sz; + } else { + if (ctx->off) { + size_t s = MD2_BUFSZ - ctx->off; + memcpy(ctx->buf + ctx->off, bbuf, s); + md2_compress(ctx, ctx->buf); + sz -= s; + bbuf += s; + } + while (sz >= MD2_BUFSZ) { + md2_compress(ctx, bbuf); + sz -= MD2_BUFSZ; bbuf += MD2_BUFSZ; + } + if (sz) + memcpy(ctx->buf, bbuf, sz); + ctx->off = sz; + } +} + +/* --- @md2_done@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block + * @void *hash@ = pointer to output buffer + * + * Returns: --- + * + * Use: Returns the hash of the data read so far. + */ + +void md2_done(md2_ctx *ctx, void *hash) +{ + unsigned pad = MD2_BUFSZ - ctx->off; + unsigned i; + for (i = ctx->off; i < MD2_BUFSZ; i++) + ctx->buf[i] = pad; + md2_compress(ctx, ctx->buf); + md2_compress(ctx, ctx->c); + memcpy(hash, ctx->h, MD2_BUFSZ); +} + +/* --- @md2_state@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context + * @void *state@ = pointer to buffer for current state + * + * Returns: Number of bytes written to the hash function so far. + * + * Use: Returns the current state of the hash function such that + * it can be passed to @md2_set@. + */ + +unsigned long md2_state(md2_ctx *ctx, void *state) +{ + octet *p = state; + memcpy(p, ctx->h, MD2_BUFSZ); + memcpy(p + MD2_BUFSZ, ctx->c, MD2_BUFSZ); + return (0); +} + +/* --- Generic interface --- */ + +GHASH_DEF(MD2, md2) + +/* --- Test code --- */ + +HASH_TEST(MD2, md2) + +/*----- That's all, folks -------------------------------------------------*/ diff --git a/md2.h b/md2.h new file mode 100644 index 0000000..02c4a75 --- /dev/null +++ b/md2.h @@ -0,0 +1,166 @@ +/* -*-c-*- + * + * $Id: md2.h,v 1.1 2001/02/21 20:03:22 mdw Exp $ + * + * The MD2 message digest function + * + * (c) 2001 Straylight/Edgeware + */ + +/*----- Licensing notice --------------------------------------------------* + * + * This file is part of Catacomb. + * + * Catacomb is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * Catacomb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with Catacomb; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +/*----- Revision history --------------------------------------------------* + * + * $Log: md2.h,v $ + * Revision 1.1 2001/02/21 20:03:22 mdw + * Added support for MD2 hash function. + * + */ + +/*----- Notes on the MD2 hash function ------------------------------------* + * + * MD2 was designed by Ron Rivest. It's not recommended for new applications + * because only the `checksum' part of the function resists collision-finding + * attacks. It's not very fast either. However, it's still used in + * standards, and having it available can be useful. + */ + +#ifndef CATACOMB_MD2_H +#define CATACOMB_MD2_H + +#ifdef __cplusplus + extern "C" { +#endif + +/*----- Header files ------------------------------------------------------*/ + +#include + +#ifndef CATACOMB_GHASH_H +# include "ghash.h" +#endif + +/*----- Magic numbers -----------------------------------------------------*/ + +#define MD2_BUFSZ 16 +#define MD2_HASHSZ 16 +#define MD2_STATESZ 32 + +/*----- Data structures ---------------------------------------------------*/ + +typedef struct md2_ctx { + octet c[MD2_BUFSZ]; /* Checksum buffer */ + octet h[MD2_BUFSZ]; /* Hash result buffer */ + octet buf[MD2_BUFSZ]; /* Input buffer */ + unsigned off; /* Offset into buffer */ +} md2_ctx; + +/*----- Functions provided ------------------------------------------------*/ + +/* --- @md2_compress@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block + * @const void *sbuf@ = pointer to buffer of appropriate size + * + * Returns: --- + * + * Use: MD2 compression function. + */ + +extern void md2_compress(md2_ctx */*ctx*/, const void */*sbuf*/); + +/* --- @md2_init@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block to initialize + * + * Returns: --- + * + * Use: Initializes a context block ready for hashing. + */ + +extern void md2_init(md2_ctx */*ctx*/); + +/* --- @md2_set@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block + * @const void *buf@ = pointer to state buffer + * @unsigned long count@ = current count of bytes processed + * + * Returns: --- + * + * Use: Initializes a context block from a given state. This is + * useful in cases where the initial hash state is meant to be + * secret, e.g., for NMAC and HMAC support. + */ + +extern void md2_set(md2_ctx */*ctx*/, const void */*buf*/, + unsigned long /*count*/); + +/* --- @md2_hash@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block + * @const void *buf@ = buffer of data to hash + * @size_t sz@ = size of buffer to hash + * + * Returns: --- + * + * Use: Hashes a buffer of data. The buffer may be of any size and + * alignment. + */ + +extern void md2_hash(md2_ctx */*ctx*/, const void */*buf*/, size_t /*sz*/); + +/* --- @md2_done@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context block + * @void *hash@ = pointer to output buffer + * + * Returns: --- + * + * Use: Returns the hash of the data read so far. + */ + +extern void md2_done(md2_ctx */*ctx*/, void */*hash*/); + +/* --- @md2_state@ --- * + * + * Arguments: @md2_ctx *ctx@ = pointer to context + * @void *state@ = pointer to buffer for current state + * + * Returns: Number of bytes written to the hash function so far. + * + * Use: Returns the current state of the hash function such that + * it can be passed to @md2_set@. + */ + +extern unsigned long md2_state(md2_ctx */*ctx*/, void */*state*/); + +/*----- Generic hash interface --------------------------------------------*/ + +extern const gchash md2; + +/*----- That's all, folks -------------------------------------------------*/ + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/rspit.c b/rspit.c index b9c8e72..26fd888 100644 --- a/rspit.c +++ b/rspit.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: rspit.c,v 1.13 2000/12/06 20:33:27 mdw Exp $ + * $Id: rspit.c,v 1.14 2001/02/21 20:03:22 mdw Exp $ * * Spit out random numbers * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: rspit.c,v $ + * Revision 1.14 2001/02/21 20:03:22 mdw + * Added support for MD2 hash function. + * * Revision 1.13 2000/12/06 20:33:27 mdw * Make flags be macros rather than enumerations, to ensure that they're * unsigned. @@ -150,6 +153,7 @@ #include "square-counter.h" #include "serpent-counter.h" +#include "md2-mgf.h" #include "md4-mgf.h" #include "md5-mgf.h" #include "sha-mgf.h" @@ -190,6 +194,7 @@ extern gen generators[]; E(SERPENT, serpent) #define HASHES \ + E(MD2, md2) \ E(MD4, md4) \ E(MD5, md5) \ E(SHA, sha) \ diff --git a/tests/md2 b/tests/md2 new file mode 100644 index 0000000..8930253 --- /dev/null +++ b/tests/md2 @@ -0,0 +1,79 @@ +# Test vectors for MD2 hash function +# +# $Id: md2,v 1.1 2001/02/21 20:03:23 mdw Exp $ + +# --- Basic hash function --- +# +# Test vectors from RFC1319. The last was generated using OpenSSL. + +md2 { + "" 8350e5a3e24c153df2275c9f80692773; + "a" 32ec01ec4a6dac72c0ab96fb34c0b5d1; + "abc" da853b0d3f88d99b30283a69e6ded6bb; + "message digest" ab4f496bfb2a530b219ff33031fe06b0; + "abcdefghijklmnopqrstuvwxyz" + 4e8ddff3650292ab5a4108c3aa47940b; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + da33def2a42df13975352846c30338cd; + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" + d5976f79d83d3a0dc9806c3c66f3efd8; + + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 +" 9bc05c2f44930f59882bb885a75b4c95; +} + +# --- HMAC mode --- +# +# These are just regression tests, generated internally. + +md2-hmac { + "Hi There" + 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b + b524be0196e491ed44823746cd8923af; + + "what do ya want for nothing?" + 4a656665 + 292f9d34f9e311846de86c495d7adfa2; + + "ÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝ" + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + ff09238e4bded84b5490bc42cfd5c265; + + "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" + 0102030405060708090a0b0c0d0e0f10111213141516171819 + ea3181bf1cc387f12ed0637105fb219d; + + "Test With Truncation" + 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c + 7177f2b3e5583078ee122f94fe3c784a; + + "Test Using Larger Than Block-Size Key - Hash Key First" + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + 615b1c392f5aaeeeab7e82572e6395d5; + + "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + df0b12810892f0c7559802d5c0ce1157; +} -- 2.11.0