Package: pybased
pybasedLibrary for creating arbitrary binary encodings.  Includes variations on base32, base64, base85, and more.WARNING:Although these encodingsdowork end-to-end, they are not compatible with traditional implementations!I am working on finding out why.EncodingsTypesSliding:Random-access bitwise implementation, theoretically compatible with bytestrings of arbitrary size.BigInt:Converts bytes into large integers, then incrementally divides by the radix. Incompatible with large files. Suitable for hashes and shorter bytestrings.Biterator:Iterates through each byte from the input stream and adds it to a buffer, then extracts the required number of bits to convert to the other radix. Based roughly off of CPython's base64 encoder, but heavily modified to enable arbitrary conversions.WIP.Available EncodingsSupported EncodingsIDTypeBits/CharChars/ByteAlphabetbase32Biterator55ABCDEFGHIJKLMNOPQRSTUVWXYZ234567base32hexBiterator550123456789ABCDEFGHIJKLMNOPQRSTUVbase46BigIntN/AN/AABCDEFGHJKMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyzbase62BigIntN/AN/A0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzbase64Biterator63ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/base64b64Biterator63./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzbase64bashBiterator630123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@_base64bcryptBiterator63./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789base64hqxBiterator63!"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqrbase64urlBiterator63ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_base64uuBiterator63!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_base64xxBiterator63+-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzbase85Biterator77ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+-;<=>?@^_`{|}~base94BigIntN/AN/A!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~crockford32Biterator550123456789ABCDEFGHJKMNPQRSTVWXYZgeohash32Biterator550123456789bcdefghjkmnpqrstuvwxyznintendo32Biterator550123456789BCDFGHJKLMNPQRSTVWXYZ?wordsafe32Biterator5523456789CFGHJMPQRVWXcfghjmpqrvwxzbase32Biterator55ybndrfg8ejkmcpqxot1uwisza345h769StatusSupported EncodingsStandardEncodedDecodedPassed Testbase32JBSWY3DPFQQHO33SNRSCC===b'Hello, world!'✔base32hex91IMOR3F5GG7ERRIDHI22===b'Hello, world!'✔base46GnNaagudEKYvFzFrZSSb'Hello, world!'✔base621wJfrzvdbthTq5ANZBb'Hello, world!'✔base64SGVsbG8sIHdvcmxkIQ==b'Hello, world!'✔base64b64G4JgP4wg65RjQalY6E==b'Hello, world!'✔base64bashi6lIr6YI87tLsCNA8g==b'Hello, world!'✔base64bcryptQETqZE6qGFbtakviGO==b'Hello, world!'✔base64hqx5'9XE'mX)(G[FQaN)3==b'Hello, world!'✔base64urlSGVsbG8sIHdvcmxkIQ==b'Hello, world!'✔base64uu2&5L;&\\L('=O<FQD(0b'Hello, world!'✔base64xxG4JgP4wg65RjQalY6E==b'Hello, world!'✔base85ERRERR❌base94/P\|?l:+>Nq\\sr<+rb'Hello, world!'✔crockford3291JPRV3F5GG7EVVJDHJ22b'Hello, world!'✔geohash3291kqsv3g5hh7fvvkejk22b'Hello, world!'✔nintendo3291LQSW3H5JJ7GWWLFKL22b'Hello, world!'✔wordsafe32F3Wgjq5Q7RR9PqqWMVW44b'Hello, world!'✔zbase32jb1sa5dxfoo8q551pt1nnb'Hello, world!'✔Errors:base85: c = 99, len = 85, bpc = 7Getting started$pipinstallpybasedDoing stuff# Lets's assume we want to use the Crockford32 encoding scheme.frombased.standards.base32importcrockford32# And let's assume the variable data has what we want to encode.data:bytes=...# Encode to string.encoded:str=crockford32.encode_bytes(data)# ...# Decode the string back to bytes.data:bytes=crockford32.decode_bytes(encoded)basedCommand-Line Tool$based--helpusage: based [-h] {dump,encode,decode} ...

positional arguments:
  {dump,encode,decode}

optional arguments:
  -h, --help            show this help message and exitNOTE:ThebasedCLI tool is currently only useful for testing, and is underveryactive development.Encode string to Base94$basedencode--standard=base94--input-string'Hello, world!'/P|?l:+>Nq\sr<+rEncode string to Base94 and output JSON$basedencode--standard=base94--input-string'Hello, world!'--output-formatjson{"encoded": "/P|?l:+>Nq\\sr<+r"}Decode data from Base94$baseddecode--standard=base94--input-string'/P|?l:+>Nq\sr<+r'>>> input chars: 16B
Bytes representation: b'Hello, world!'
Hex representation: 48656c6c6f2c20776f726c6421Various Output Encoding Formats$baseddecode--standard=base94--input-string'/P|?l:+>Nq\sr<+r'--output-formatjson>>> input chars: 16B
{"b64": "SGVsbG8sIHdvcmxkIQ==", "utf-8": "Hello, world!"}$baseddecode--standard=base94--input-string'/P|?l:+>Nq\sr<+r'--output-formatyaml>>> input chars: 16B
encoded: !!binary |
  SGVsbG8sIHdvcmxkIQ==