Results 1 to 7 of 7
- 06-26-2012, 08:37 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 21
- Rep Power
- 0
- 06-26-2012, 09:09 PM #2
Re: Base64 -> hexadecimal string decoder
Can you give a small example?
Are you asking how to convert and format the base64 String into a String of hexadecimal chatacters?
There would be two steps: convert the base64String to bytes
Then those bytes converted to a String of hexadecimal characters.If you don't understand my response, don't ignore it, ask a question.
- 06-26-2012, 09:19 PM #3
Member
- Join Date
- Mar 2011
- Posts
- 21
- Rep Power
- 0
Re: Base64 -> hexadecimal string decoder
Exactly..Thats is what I am looking for.
Please browse the following url
Tomasz Ostrowski - Base64 decoder
say base64 string is : Zb4+GmaF1jRbGdCxk7RxXjSzqpEvgU1i0eHI7er0HUk=
and hexadecimal string that I want is: 65BE3E1A6685D6345B19D0B193B4715E34B3AA912F814D62D1 E1C8EDEAF41D49
Can you please provide the coding too?
Thanks in advance
Naveen Paul
- 06-26-2012, 09:30 PM #4
Re: Base64 -> hexadecimal string decoder
There are packages that will do the base64 decoding. I think apache has one. Or if you have another use that.
When you get the bytes from the decoder(I think it should be a byte array) then you can use the Integer class's toHexString() method to convert each byte to a String of 2 hex digits. You will have to pad the values less than 16 with a leading "0"If you don't understand my response, don't ignore it, ask a question.
-
Re: Base64 -> hexadecimal string decoder
Duplicate thread has been closed. Original poster -- please follow the forum rules that you agreed to on signing up, including posting only one thread per question.
- 06-26-2012, 10:13 PM #6
Member
- Join Date
- Mar 2011
- Posts
- 21
- Rep Power
- 0
Re: Base64 -> hexadecimal string decoder
Hi
We tried the below code but we are not getting desired output.
import java.io.*;
import org.apache.commons.codec.binary.Base64;
import java.lang.Class;
public class Test {
public static void main(String[] args) throws IOException {
String s = "Zb4+GmaF1jRbGdCxk7RxXjSzqpEvgU1i0eHI7er0HUk=" ;
byte[] encodedBytes = Base64.encodeBase64(s.getBytes());
// System.out.println(encodedBytes);
for (int j = 0; j < encodedBytes.length; j++) {
String hex = Integer.toHexString(encodedBytes[j]);
System.out.print(hex);
}
}
}
Can you please check and help us if we are wrong on this.
Thanks,
Naveen
- 06-26-2012, 10:15 PM #7
Similar Threads
-
pc to xml to xml-decoder to mac
By rowruffdesign in forum XMLReplies: 0Last Post: 06-21-2011, 10:37 AM -
Decode base64 string to an image(pdf, png, ....)
By RohitBBorse in forum New To JavaReplies: 0Last Post: 05-25-2011, 01:07 PM -
image encoder decoder
By fayiza in forum Java 2DReplies: 1Last Post: 09-19-2010, 05:55 PM -
How to convert a String into an Hexadecimal ?
By ze snow in forum New To JavaReplies: 7Last Post: 02-16-2010, 10:31 PM -
PNG file format decoder in Java
By Java Tip in forum java.awtReplies: 0Last Post: 06-21-2008, 08:51 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks