Convert between bases, initailly intended for RFC4648 base32
Project description
Universal base converter
Use either with predefined converters:
- integer to base32(RFC4648)
- integer to hex
- base32(RFC4648) to integer
Or use with custom settings:
- set base
- set charset
Examples:
if __name__ == "__main__":
# example:
num = 15851
# using instance of converter, using custom settings
converter = Convertbase()
converter.set_base(32)
converter.set_charset('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567')
print(converter.convert(num))
# or using static methods:
print(Convertbase.to_b32(num))
# hex, compare to built-in
print(Convertbase.to_hex(num))
print(hex(num))
#convert back:
print(Convertbase.from_b32_to_dec('PPL'))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
convertbase-0.1.2.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for convertbase-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31aa50802de57cd3988409a2f2f9f7787eb98297f853a4051f02d94537e2f83c |
|
MD5 | bbb415c6f5b0f8cb011e15a70c40835e |
|
BLAKE2b-256 | 4163e759a1e8f2c2fa64222f70a221726a23781e2bcf808936e322a435976604 |