Click here to Skip to main content
13,090,178 members (61,772 online)
Rate this:
Please Sign up or sign in to vote.

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
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
Stephen Hewison 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 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 26 Jun 2012
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