VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Base Conversion Pro

Vincent Bouret  (6 Submissions)   Graphics   Visual Basic 3.0   Beginner   Wed 3rd February 2021

The function BaseConv convert any base 10 numbers to any selected base (max 64) and the function ConvBase10 convert it back to base 10.
It can be useful for cryptography purpose example: convert the ASCII value of a char to a secret base...or it can be useful for any algorithm that returns numbers and that you want as a string. The maximum base could be extended by adding other characters to the constant DIGITS. With the original DIGITS this algorithm is compatible for conversion to common base: Binary (2), Hex (16), Octal (8).

Inputs
Use: BaseConv(base10_original_number, newbase) to convert in a particular base Or use: ConvBase10(otherbase_number, oldbase)

Assumes
Juste paste the code anywhere.

Returns
BaseConv returns a string and ConvBase10 return a long integer

Side Effects
If you add char to DIGITS (to extend the base maximum) be aware to avoid adding the same char twice or else you will get an error.

Rate Base Conversion Pro (10(10 Vote))
Base Conversion Pro.bas

Base Conversion Pro Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters