aboutsummaryrefslogtreecommitdiff

Base65K

Characteristics

  • Encode from Decimal (Base 10) to Unicode (Base 65536)
  • Decode from Unicode (Base 65536) to Decimal (Base 10)

Support

  • Script-Interface (Python required)
  • Tested: Python: 2.7.11, 3.2.5
  • Tested O.S: Windows 10

History

The module was created some moths ago, but at that time the website did not exist. I created a description with it at the time, I included it a continuation.

This project is inspired by the numbering systems; binary with only 2 characters, decimal with 10 and hexadecimal with 16. This module add another numbering system but with a base of 65536, giving the possibility to write enormous numbers in just a single character. This is accomplished by using all single character unicode symbols. Theoretically you could make the base a lot larger, but because some Python limitations, you will not be able to convert it back to decimal.

At the time of this project I was starting learning hexadecimal and binary in Computer Science class. Personally I found it interesting, as the previous week in Maths we did the history of numbering systems. Trying to get our head around over base 3, 4, 5 and 12 makes it easier learning them. In my opinion it was strange how people used different bases, but I think it makes sense if you grow up with it. The idea of the many possibilities of them, and the easy that I had understanding them, made me think why the hexadecimal stop at F. Why not all of the alphabet, then I did it but the question raised again, why stop there. The project finally ended with what is now, base 65536. That is not as easy to do by hand but Python doesn’t have a problem with it so there you go.

Utilization

Set Module Base

import base65k

#Normal Base
base65k.module_base = 65536

#Compatibility Base
base65k.module_base = 8483

Encode and Decode

import base65k
normal_number = 1985224

#Encode with set Base
strange_number = base65k.encode(normal_number)

#Encode with custom base
strange_number = base65k.encode(normal_number, 365)

#Decode with set Base
normal_number = base65k.decode(strange_number)

#Decode with custom Base
normal_number = base65k.decode(strange_number, 365)

Test and Information

  1. Run the main script, don’t import it.
  2. Once it ask you for the speed select your desired one. ‘1’ will be a complete test to ensure all the encoding and decoding is accurate, but most probably it will be slow. If you prefer a faster test select a larger number for speed.
  3. If the test ended successfully it will show you, with the currently selected base, the largest number you can represent in nth characters.

Documentation

Name

base65k.py

Language

Python: 2.X - 3.X

Information

variable base65k.module_base

  • The default base to use if not specify in the function of encode() or decode() and for the tests.

function base65k.encode(number, base)

  • This function will convert a base 10 number to the one selected in the module_base.
  • A base attribute can be passed to convert to a custom base without changing the module_base.

function base65k.decode(number, base)

  • This function will convert a integer with the base selected in the module_base to a base 10 number.
  • A base attribute can be passed to convert from a custom base without changing the module_base.