Click here to Skip to main content
13,189,506 members (63,881 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Ive been searching through google but cant seem to figure out how its been decoded ?
 
Decode from base64 to ASCII Dec.
For example,
CS20UumGFaSm0QXZ54HADg => 9 45 180 82 233 134 21 164 166 209 5 217 231 129 192 14
 
I used all online converters, if possible i would like to get in in perl or c#.
 
All help would be greatfull.
 

thanks in advance
Posted 1-Aug-14 0:41am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Base64 is not an encryption algorithm - it is a translation algorithm. The difference being that encryption is secure, and translation isn't...

Base64 is simple, and converts binary 8 bit data into a form that is transmittable over a character based data link such as HTML which does not support binary. It in no way encrypts data, and it can be reversed with ease by even novice coders. There is a good explanation here: http://en.wikipedia.org/wiki/Base64[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

With Perl you can use the MIME::Base64[^] package. This is returned as first Google result when searching for 'base64 decoder perl'.
  Permalink  
Comments
dennis2704 1-Aug-14 8:09am
   
Yes i understand i allready tried the MIME::Base64 package but the outcome isnt what i get?

use MIME::Base64;

my $chars = "CS20UumGFaSm0QXZ54HADg";
my $encoded = encode_base64($chars);
print "Encode $encoded";

Regards
Jochen Arndt 1-Aug-14 8:22am
   
Your string is already encoded. So you must *decode* it:
my $decoded = decode_base64($chars);
print "Decoded $decoded";
dennis2704 2-Aug-14 10:25am
   
Ok so im testing the code you gave me but i thought i was supposed to be getting the numbers as output but instead of that im getting " -┤RÚå§ñªÐ♣┘þü└♫ " as output.

Maybe you could help me with it?

Thanks in advance
dennis
Jochen Arndt 4-Aug-14 3:29am
   
Base64 encoding is mainly used to encode binary data. And it seems that your data are binary. So it makes no sense to use the print() function. Treat the returned string as byte array instead. To print it as hex string you might use:
my $hex_str = unpack("H*",$decoded);
print $hex_str;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.171016.2 | Last Updated 1 Aug 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100