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

[1231 byte] By [manubhavea] at [2007-11-27 7:49:18]
# 1
Why not use the Hex class in Jakarta Commons Codec?
sabre150a at 2007-7-12 19:30:16 > top of Java-index,Security,Cryptography...