Removed Hex library dependancy

This commit is contained in:
Joe Pritzel 2011-11-05 12:22:06 -05:00
parent 2a3bd3517e
commit 53ca73e8f9
2 changed files with 9 additions and 3 deletions

View File

@ -12,10 +12,9 @@ import java.util.Random;
import org.moparscape.msc.gs.connection.RSCPacket; import org.moparscape.msc.gs.connection.RSCPacket;
import org.moparscape.msc.gs.core.GameEngine; import org.moparscape.msc.gs.core.GameEngine;
import org.moparscape.msc.gs.model.Point; import org.moparscape.msc.gs.model.Point;
import org.moparscape.msc.gs.util.HexString;
import org.moparscape.msc.gs.util.Logger; import org.moparscape.msc.gs.util.Logger;
import com.bombaydigital.vault.HexString;
public final class DataConversions { public final class DataConversions {
private static char characters[] = { ' ', 'e', 't', 'a', 'o', 'i', 'h', private static char characters[] = { ' ', 'e', 't', 'a', 'o', 'i', 'h',
'n', 's', 'r', 'd', 'l', 'u', 'm', 'w', 'c', 'y', 'f', 'g', 'p', '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) { public static String md5(String s) {
md.reset(); md.reset();
md.update(s.getBytes()); md.update(s.getBytes());
return HexString.bufferToHex(md.digest()); return new HexString(md.digest()).toString();
} }
/** /**

View File

@ -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
}