HEX back to byte array while using AES encryption
Hello,
I have downloaded the following code for encryption with AES standards.
I noticed that the byte array is getting converted to hexa. Can anyone please guide me how to get a bye array back of the hexa value.
Also, didn't understand why is the zero getting appended while converting to a string of hexa value.
publicstatic String asHex (byte buf[]){
StringBuffer strbuf =new StringBuffer(buf.length * 2);
int i;
for (i = 0; i < buf.length; i++){
if (((int) buf[i] & 0xff) < 0x10)
strbuf.append("0");
strbuf.append(Long.toString((int) buf[i] & 0xff, 16));
}
return strbuf.toString();
}
Thanks in advance,
Regards,
Manisha

