public static String convertHexString(String hex){
byte[] bytes = new byte[hex.length() / 2];
for (int i = 0; i < bytes.length; i++) {
bytes[i] = (byte) Integer.parseInt(hex.substring(2 * i,2 * i + 2), 16);
}
sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
System.out.println(encoder.encode(bytes));
return encoder.encode(bytes);
}
above is the function written in java, i want to convert it into the php function.
This function accepts the HEX string as a parameter.
basically i want to convert a string from hex to string.
the string should be binary.
Please can anybody help me.
Thanks in advance :)