Fast Base64 encoding/decoding
Project description
Fast Base64 implementation
This project is a wrapper on libbase64.
It aims to provide a fast base64 implementation for standard base64 encoding/decoding.
Installation
pip install pybase64
Usage
pybase64 uses the same API as Python base64 “modern interface” (introduced in Python 2.4) for an easy integration.
To get the fastest decoding, it is recommended to use the pybase64.b64decode and validate=True when possible.
import pybase64
# Standard encoding
print(pybase64.standard_b64encode(b'>>>foo???')) # b'Pj4+Zm9vPz8/'
print(pybase64.standard_b64decode(b'Pj4+Zm9vPz8/')) # b'>>>foo???'
print(pybase64.urlsafe_b64encode(b'>>>foo???')) # b'Pj4-Zm9vPz8_'
print(pybase64.urlsafe_b64decode(b'Pj4-Zm9vPz8_')) # b'>>>foo???'
print(pybase64.b64encode(b'>>>foo???', altchars='_:')) # b'Pj4_Zm9vPz8:'
print(pybase64.b64decode(b'Pj4_Zm9vPz8:', altchars='_:', validate=True)) # b'>>>foo???'
A command-line tool is also provided. It has encode, decode and benchmark subcommands.
usage: pybase64 [-h] [-v] {benchmark,encode,decode} ...
pybase64 command-line tool.
positional arguments:
{benchmark,encode,decode}
tool help
benchmark -h for usage
encode -h for usage
decode -h for usage
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
Benchmark
Running Python 3.6.0, Apple LLVM version 8.1.0 (clang-802.0.42), Mac OS X 10.12.6 on an Intel Core i7-4870HQ @ 2.50GHz
0.1.2 (C extension active)
bench: altchars=None, validate=False
pybase64._pybase64.b64encode: 3203.816 MB/s (13,271,472 bytes)
pybase64._pybase64.b64decode: 322.261 MB/s (13,271,472 bytes)
base64.b64encode: 539.713 MB/s (13,271,472 bytes)
base64.b64decode: 321.367 MB/s (13,271,472 bytes)
bench: altchars=None, validate=True
pybase64._pybase64.b64encode: 3119.150 MB/s (13,271,472 bytes)
pybase64._pybase64.b64decode: 4389.709 MB/s (13,271,472 bytes)
base64.b64encode: 585.207 MB/s (13,271,472 bytes)
base64.b64decode: 101.803 MB/s (13,271,472 bytes)
bench: altchars=b'-_', validate=False
pybase64._pybase64.b64encode: 2298.564 MB/s (13,271,472 bytes)
pybase64._pybase64.b64decode: 276.244 MB/s (13,271,472 bytes)
base64.b64encode: 313.476 MB/s (13,271,472 bytes)
base64.b64decode: 229.085 MB/s (13,271,472 bytes)
bench: altchars=b'-_', validate=True
pybase64._pybase64.b64encode: 2379.698 MB/s (13,271,472 bytes)
pybase64._pybase64.b64decode: 2862.796 MB/s (13,271,472 bytes)
base64.b64encode: 315.344 MB/s (13,271,472 bytes)
base64.b64decode: 91.621 MB/s (13,271,472 bytes)
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
pybase64-0.2.0.tar.gz
(74.3 kB
view hashes)
Built Distributions
Close
Hashes for pybase64-0.2.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb3e06c5ba4428a0c8fc9915327dae738997777bc00c58f753d1c38bb3634477 |
|
MD5 | fb9a3d209ae7536545e861fceaca0085 |
|
BLAKE2b-256 | 6007d2a0186a89532aeff390a43b416c6c5debebb02c841723af066d2e9574c4 |
Close
Hashes for pybase64-0.2.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1443eff316dde380f4db2aceea29e7301c9cb5bad726b8108d340f5b7e4c9e90 |
|
MD5 | d3ef3e729fa35f908684801dbd93209e |
|
BLAKE2b-256 | 9adaa1325d394e02e73057568b52e00674d0d24e66d9383187b5c5bf29e101e0 |
Close
Hashes for pybase64-0.2.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd827c653f558a6b40cadac8e223d1b4c6502b378c49eb78837eb2c7d8fd6157 |
|
MD5 | 8cd7351c099d84cb1699de545ea47b8a |
|
BLAKE2b-256 | 31c2ee72e494fb13365cffa4637b8c133608f04a710253789efe39f1aa93c84c |
Close
Hashes for pybase64-0.2.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fca720da8c53098306bc264b3a7269ce85eeac7cc4f0a79fddf831fee71c43e2 |
|
MD5 | 311aef6ed5b8e611bb69f4bc258dbece |
|
BLAKE2b-256 | 85926ca13da58ff97185b31b8c51d1121896fccc176fcbc0e632181cc641fae3 |
Close
Hashes for pybase64-0.2.0-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28fc82a3fb2f5dbc65e27f8ada7ab1693a8d392ffe2c5123a6c65546f67f495c |
|
MD5 | b79c47d884f7734a598ba2b5477e870c |
|
BLAKE2b-256 | 28d90c05ffdf3109d37d397c7b97afe50d8f8b368ccbc2c27f690d3b01a5e7be |
Close
Hashes for pybase64-0.2.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65fd79f5c8115147e02e3b35eef57362a16e384d19ee85be8ba7e8318d196e59 |
|
MD5 | 5d13ec4d8a012ef9b209242016a6f408 |
|
BLAKE2b-256 | 8f4774cb7dfd8843fbe983193450136d872faed43f9b11aa8f24481c176cd870 |
Close
Hashes for pybase64-0.2.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c15e079a7d7048602b7584eb98fdb83897e54382b2d376678878b775dd096f1c |
|
MD5 | 9b9e45ee36efd7b7dabcd6ca0c246085 |
|
BLAKE2b-256 | a74677954c9793abfc5d6d83fa4571614b67ef47e5c2e79c21aab79844d48d2e |
Close
Hashes for pybase64-0.2.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 254bab780202b02f5fce8005fdba4d0011f58f9414dc07a7c18e7f2d411f0bfc |
|
MD5 | 930e79166c78191493976c75803c34b2 |
|
BLAKE2b-256 | 09b80be40eef42ad438399e598c3d096e401beec0ca23d77761cf745da0b77c8 |
Close
Hashes for pybase64-0.2.0-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0402ee81876069f15361e769d2bc579f11a92f74b3e5952002b7fd45d06a2281 |
|
MD5 | fd63b187b2c56b2401e543bf64f4299b |
|
BLAKE2b-256 | 71272ea9d114f49b5b5e25f5f7a069dd706f120c948792f765179aef1415322c |
Close
Hashes for pybase64-0.2.0-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87da36908db3c7285befce664fdd2393d18bc32569a54a0fa01542a207ec4d34 |
|
MD5 | 09c184b3375771d42a7c06215757427d |
|
BLAKE2b-256 | 666425e8cfbfe7aa007ca61f1ab158ffd453db1fbd57852cb6260cb756e7a1b1 |
Close
Hashes for pybase64-0.2.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 168946bbd55cbc955dc32cd74399d536d78bf3dcb74b2dbb14d4816398885820 |
|
MD5 | 64b871f68e2837ecaa54c7f67131b68d |
|
BLAKE2b-256 | 31405997178be56ef5c59ee15c523a15560d048d37da501ca22d206924a2c252 |
Close
Hashes for pybase64-0.2.0-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 437d475cd4298a49cb68024f96dfe51742b0b44f5c3beb8a26eb7bfa9e54bd66 |
|
MD5 | a952840cfcac6595c5f92dffc2c4accb |
|
BLAKE2b-256 | 24f1dfe4ff9ed2caa84e913ba54aa29b6ca76ba0447156ce69f6c6b92e2facc1 |
Close
Hashes for pybase64-0.2.0-cp34-cp34m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 741417de1e9a6e104fb96bdba07636a1c70e0baa24479b428aa826746d51e3be |
|
MD5 | a4cdac2d5295c898e2d3a216971ae6cd |
|
BLAKE2b-256 | 2721b7c1ebf4bb70cd69f798c6d1f0dc370a166b900f7bd02bfaf4cb0430d37f |
Close
Hashes for pybase64-0.2.0-cp33-cp33m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6a7dbce95280ee36a09664dcd295c13d579e4ff7fb2295a8596230331a73128 |
|
MD5 | 72de9dc1b3ff11e089fa0ed014174272 |
|
BLAKE2b-256 | 3f7e12ebaec5044613d52804e4a2e9e4e411b7af0e050f0b576ec393e2d01b34 |
Close
Hashes for pybase64-0.2.0-cp33-cp33m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54483f9d67bf6f5d13066a84d46a3e7e7ab49b5341b119b1cfb584cca8ee10be |
|
MD5 | 251e7a99cca0ce1324bef5bf6363ab4b |
|
BLAKE2b-256 | dfa1e4a7168f7a38d342080b6d020dd258b7a7c90c1e37508f52f82a065cf6ad |
Close
Hashes for pybase64-0.2.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b92df1a0478b9346e43a2667cd9dfc16505c71f051dbd5977640a6909766a21 |
|
MD5 | 4e2d9ccd5748fbefb6e129569360a944 |
|
BLAKE2b-256 | a5ba31b0f47dbaa5ed6df8bb36c2e30a2344a2f305f5a631b8cab9c253daf0a9 |
Close
Hashes for pybase64-0.2.0-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 504fbcff024e8c43782f71932b114dfc90f6c834c1939c1bff5516d11868fef9 |
|
MD5 | 928072ff58bb75cbbd781d98b8925f11 |
|
BLAKE2b-256 | fea194f5c3e4cc8a799d08985891d65f4f3eee66a7bc5ccd360f4e9f63682a3d |
Close
Hashes for pybase64-0.2.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 159cdb042b7945bb3c1d5d3acae6abf6a8dd99acc0f0b101c055d93cb28f5e06 |
|
MD5 | 6ac38315fe47c410679bd9c70858983b |
|
BLAKE2b-256 | 80f093e77b3524792f759562c48b23fba05be5c7315dce028ddc254220a7e2fc |
Close
Hashes for pybase64-0.2.0-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8b1a7d15d09c20d0f649aecdbdabc256100fabbcf37038723ac873ac7269d81 |
|
MD5 | c6d0db65c730f59dc4ba6bd44aafdbfe |
|
BLAKE2b-256 | 6706e2e2cefb75bd9950fb6b2edbf7caf05c57bf8e22c93d915d9e4511a391cd |
Close
Hashes for pybase64-0.2.0-cp27-cp27m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f8cf3b4e52f19e969c13e46de015ccbe169df483cd5a895859412393e17a8d4 |
|
MD5 | e42130410abbc196b1f02ffbf346abbb |
|
BLAKE2b-256 | 50f1f0709991f698de12898aff0ab933d2d0bbe5af6d4a5af836edd884a4dbf9 |