问题
I have String which contain the next hex presentation: "5f e8 d0 7b c0 f7 54 07 fb e4 20 f5 b8 10 67 a9"
You understand that this is just hex and I need to get this hex presentation from String. String looks like: "ED>@@2.W.W'KJ%z_{T g"
So, how to get from "ED>@@2.W.W'KJ%z_{T g" hex presentation "5f e8 d0 7b c0 f7 54 07 fb e4 20 f5 b8 10 67 a9"? This is unprintable characters so I can't use this:
result: -10404282104042104042104042104042104042c7eea21040428189104042104042f5.
And also this returns me something strange:
public static String stringToHex(String arg) {
return String.format("%x", new BigInteger(arg.getBytes()));
}
result: 6d1.
System.out.println(String.format("%h", Integer.toHexString(buff.charAt(0))));
And this code sometimes works. The data comes from socket (as String because I need to get many answers as String and only this Auth Challenge as hex).