Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# convert Base64 Base36
Hi,
 
Does anyone have code for converting from base 64 to base 36 and back?
 
base 64 character set is 0123456789ABCDEF
base 36 character set is 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
 
This is needed as I can't represent the data I'm trying to display in the room I have to display it, it has to be displayed encrypted, but readable and using base 36 over base 64 dramatically reduces the length of the data.
Posted 26-Jun-12 4:13am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Base 64 is not restricted to the hex digits - it includes upper and lower case A-Z 0-9 and (normally) '+' and '/'
Base 64 is a superset of base 36, which includes only upper case A-Z 0-9
 
I think you are confused between Hexadecimal and base 64. Check your implementation.
 
Using Base 36 to represent Base 64 will not "reduce the length of the data" - if anything it will increase it, because many Base 64 characters will require two character spaces in Base 36
  Permalink  
Comments
Stephen Hewison at 26-Jun-12 11:11am
   
You're correct. The question should say Hex digits. I have an encrypted byte array which I need to be presentable as readable characters. The powers who be are not happy with the base 64 character set and want just numbers and upper case letters.
Stephen Hewison at 26-Jun-12 11:15am
   
The main issue I have is the integer representation of the byte data is too big for a long and I can't use the BigInteger in the later frameworks as target devices are restricted to .Net 2. I think I may just break the byte array down into chunks which fit into a long.

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



Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 26 Jun 2012
Copyright © CodeProject, 1999-2014
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