/* -*-c-*-
*
- * $Id: rmd160.c,v 1.1 1999/09/03 08:41:12 mdw Exp $
+ * $Id: rmd160.c,v 1.4 2004/04/08 01:36:15 mdw Exp $
*
* The RIPEMD-160 message digest function
*
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: rmd160.c,v $
- * Revision 1.1 1999/09/03 08:41:12 mdw
- * Initial import.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include <mLib/bits.h>
+#include "ghash.h"
+#include "ghash-def.h"
#include "hash.h"
#include "rmd160.h"
ctx->d = 0x10325476;
ctx->e = 0xc3d2e1f0;
ctx->off = 0;
- ctx->count = 0;
+ ctx->nl = ctx->nh = 0;
}
/* --- @rmd160_set@ --- *
ctx->d = LOAD32_L(p + 12);
ctx->e = LOAD32_L(p + 16);
ctx->off = 0;
- ctx->count = count;
+ ctx->nl = U32(count);
+ ctx->nh = U32(((count & ~MASK32) >> 16) >> 16);
}
/* --- @rmd160_hash@ --- *
STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
STORE32_L(p + 16, ctx->e);
- return (ctx->count);
+ return (ctx->nl | ((ctx->nh << 16) << 16));
}
+/* --- Generic interface --- */
+
+GHASH_DEF(RMD160, rmd160)
+
/* --- Test code --- */
HASH_TEST(RMD160, rmd160)