$Id$
*/
-#include "quakedef.h"
+#include "darkplaces.h"
-#include <string.h> /* XoXus: needed for memset call */
#include "mdfour.h"
/* NOTE: This code makes no attempt to be fast!
#define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + 0x6ED9EBA1,s)
/* this applies md4 to 64 byte chunks */
-static void mdfour64(struct mdfour *md, uint32 *M)
+static void mdfour64(struct mdfour_s *md, uint32 *M)
{
int j;
uint32 AA, BB, CC, DD;
out[3] = (x>>24)&0xFF;
}
-void mdfour_begin(struct mdfour *md)
+void mdfour_begin(struct mdfour_s *md)
{
md->A = 0x67452301;
md->B = 0xefcdab89;
}
-static void mdfour_tail(struct mdfour *md, const unsigned char *in, int n)
+static void mdfour_tail(struct mdfour_s *md, const unsigned char *in, int n)
{
unsigned char buf[128];
uint32 M[16];
if (n <= 55) {
copy4(buf+56, b);
copy64(M, buf);
- mdfour64(M);
+ mdfour64(md, M);
} else {
copy4(buf+120, b);
copy64(M, buf);
- mdfour64(M);
+ mdfour64(md, M);
copy64(M, buf+64);
- mdfour64(M);
+ mdfour64(md, M);
}
}
-void mdfour_update(struct mdfour *md, const unsigned char *in, int n)
+void mdfour_update(struct mdfour_s *md, const unsigned char *in, int n)
{
uint32 M[16];
-// start of edit by Forest 'LordHavoc' Hale
+// start of edit by Ashley Rose Hale (LadyHavoc)
// commented out to prevent crashing when length is 0
// if (n == 0) mdfour_tail(in, n);
-// end of edit by Forest 'LordHavoc' Hale
+// end of edit by Ashley Rose Hale (LadyHavoc)
while (n >= 64) {
copy64(M, in);
}
-void mdfour_result(struct mdfour *md, unsigned char *out)
+void mdfour_result(struct mdfour_s *md, unsigned char *out)
{
copy4(out, md->A);
copy4(out+4, md->B);
void mdfour(unsigned char *out, const unsigned char *in, int n)
{
- struct mdfour md;
+ struct mdfour_s md;
mdfour_begin(&md);
mdfour_update(&md, in, n);
mdfour_result(&md, out);