aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/qcommon/MD4.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/qcommon/MD4.java')
-rw-r--r--src/jake2/qcommon/MD4.java14
1 files changed, 8 insertions, 6 deletions
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;
}