mirror of
https://github.com/moparisthebest/MoparClassic
synced 2024-12-21 23:18:52 -05:00
Removed Hex library dependancy
This commit is contained in:
parent
2a3bd3517e
commit
53ca73e8f9
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user