From 20a66a892a3f0704ef37f1eebb681edfee6fc165 Mon Sep 17 00:00:00 2001 From: Holger Zickner Date: Fri, 9 Jul 2004 06:50:52 +0000 Subject: import of Jake2 --- src/jake2/qcommon/MD4.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/jake2/qcommon/MD4.java') diff --git a/src/jake2/qcommon/MD4.java b/src/jake2/qcommon/MD4.java index 45fdf7c..2c01f08 100644 --- a/src/jake2/qcommon/MD4.java +++ b/src/jake2/qcommon/MD4.java @@ -19,11 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 02.02.2004 by RST. -// $Id: MD4.java,v 1.1 2004-07-07 19:59:31 hzi Exp $ +// $Id: MD4.java,v 1.2 2004-07-09 06:50:49 hzi Exp $ package jake2.qcommon; import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.security.MessageDigest; import jake2.*; @@ -295,17 +296,18 @@ public class MD4 extends MessageDigest implements Cloneable { return t << s | t >>> (32 - s); } + /** + * Bugfixed, now works prima (RST). + */ public static int Com_BlockChecksum(byte[] buffer, int length) { - byte digest[] = new byte[16]; + int val; MD4 md4 = new MD4(); md4.engineUpdate(buffer, 0, length); - byte data[] = md4.engineDigest(); - Com.Printf("md4: " + Lib.hexDump(data, 16, false)); - + byte data[] = md4.engineDigest(); ByteBuffer bb = ByteBuffer.wrap(data); - //val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3]; + bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getInt() ^ bb.getInt() ^ bb.getInt() ^ bb.getInt(); return val; } -- cgit v1.2.3