From 53ca73e8f90005c7af8a7797662970afceb02331 Mon Sep 17 00:00:00 2001 From: Joe Pritzel Date: Sat, 5 Nov 2011 12:22:06 -0500 Subject: [PATCH] Removed Hex library dependancy --- .../src/org/moparscape/msc/gs/tools/DataConversions.java | 5 ++--- GameServer/src/org/moparscape/msc/gs/util/HexString.scala | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 GameServer/src/org/moparscape/msc/gs/util/HexString.scala diff --git a/GameServer/src/org/moparscape/msc/gs/tools/DataConversions.java b/GameServer/src/org/moparscape/msc/gs/tools/DataConversions.java index 0e8a43a..1e8cffe 100644 --- a/GameServer/src/org/moparscape/msc/gs/tools/DataConversions.java +++ b/GameServer/src/org/moparscape/msc/gs/tools/DataConversions.java @@ -12,10 +12,9 @@ import java.util.Random; import org.moparscape.msc.gs.connection.RSCPacket; import org.moparscape.msc.gs.core.GameEngine; import org.moparscape.msc.gs.model.Point; +import org.moparscape.msc.gs.util.HexString; import org.moparscape.msc.gs.util.Logger; -import com.bombaydigital.vault.HexString; - public final class DataConversions { private static char characters[] = { ' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r', 'd', 'l', 'u', 'm', 'w', 'c', 'y', 'f', 'g', 'p', @@ -261,7 +260,7 @@ public final class DataConversions { public static String md5(String s) { md.reset(); md.update(s.getBytes()); - return HexString.bufferToHex(md.digest()); + return new HexString(md.digest()).toString(); } /** diff --git a/GameServer/src/org/moparscape/msc/gs/util/HexString.scala b/GameServer/src/org/moparscape/msc/gs/util/HexString.scala new file mode 100644 index 0000000..6b73e25 --- /dev/null +++ b/GameServer/src/org/moparscape/msc/gs/util/HexString.scala @@ -0,0 +1,7 @@ +package org.moparscape.msc.gs.util + +class HexString(bytes: Array[Byte]) { + lazy val string = bytes.map(0xFF & _).map { "%02x".format(_) }.foldLeft("") { _ + _ } + + override def toString = string +} \ No newline at end of file