Skip to main content

Fast Base64 encoding/decoding

Project description

Fast Base64 implementation

license-status pypi-status Documentation Status travis-status appveyor-status codecov-status

This project is a wrapper on libbase64.

It aims to provide a fast base64 implementation for 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

print(pybase64.b64encode(b'>>>foo???', altchars='_:'))
# b'Pj4_Zm9vPz8:'
print(pybase64.b64decode(b'Pj4_Zm9vPz8:', altchars='_:', validate=True))
# b'>>>foo???'

# Standard encoding helpers
print(pybase64.standard_b64encode(b'>>>foo???'))
# b'Pj4+Zm9vPz8/'
print(pybase64.standard_b64decode(b'Pj4+Zm9vPz8/'))
# b'>>>foo???'

# URL safe encoding helpers
print(pybase64.urlsafe_b64encode(b'>>>foo???'))
# b'Pj4-Zm9vPz8_'
print(pybase64.urlsafe_b64decode(b'Pj4-Zm9vPz8_'))
# 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

Full documentation on Read the Docs.

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

pybase64 0.2.0 (C extension active - AVX2)
bench: altchars=None, validate=False
pybase64._pybase64.b64encode:     2941.397 MB/s (13,271,472 bytes -> 17,695,296 bytes)
pybase64._pybase64.b64decode:      328.250 MB/s (17,695,296 bytes -> 13,271,472 bytes)
base64.b64encode:                  565.744 MB/s (13,271,472 bytes -> 17,695,296 bytes)
base64.b64decode:                  327.075 MB/s (17,695,296 bytes -> 13,271,472 bytes)
bench: altchars=None, validate=True
pybase64._pybase64.b64encode:     2995.909 MB/s (13,271,472 bytes -> 17,695,296 bytes)
pybase64._pybase64.b64decode:     3996.267 MB/s (17,695,296 bytes -> 13,271,472 bytes)
base64.b64encode:                  577.565 MB/s (13,271,472 bytes -> 17,695,296 bytes)
base64.b64decode:                  104.835 MB/s (17,695,296 bytes -> 13,271,472 bytes)
bench: altchars=b'-_', validate=False
pybase64._pybase64.b64encode:     2237.740 MB/s (13,271,472 bytes -> 17,695,296 bytes)
pybase64._pybase64.b64decode:      262.021 MB/s (17,695,296 bytes -> 13,271,472 bytes)
base64.b64encode:                  313.977 MB/s (13,271,472 bytes -> 17,695,296 bytes)
base64.b64decode:                  219.487 MB/s (17,695,296 bytes -> 13,271,472 bytes)
bench: altchars=b'-_', validate=True
pybase64._pybase64.b64encode:     2349.481 MB/s (13,271,472 bytes -> 17,695,296 bytes)
pybase64._pybase64.b64decode:     2790.047 MB/s (17,695,296 bytes -> 13,271,472 bytes)
base64.b64encode:                  314.182 MB/s (13,271,472 bytes -> 17,695,296 bytes)
base64.b64decode:                   89.855 MB/s (17,695,296 bytes -> 13,271,472 bytes)

Project details


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.1.tar.gz (79.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pybase64-0.2.1-cp36-cp36m-win_amd64.whl (30.1 kB view details)

Uploaded CPython 3.6mWindows x86-64

pybase64-0.2.1-cp36-cp36m-win32.whl (28.3 kB view details)

Uploaded CPython 3.6mWindows x86

pybase64-0.2.1-cp36-cp36m-manylinux1_x86_64.whl (62.5 kB view details)

Uploaded CPython 3.6m

pybase64-0.2.1-cp36-cp36m-manylinux1_i686.whl (58.4 kB view details)

Uploaded CPython 3.6m

pybase64-0.2.1-cp36-cp36m-macosx_10_6_intel.whl (40.6 kB view details)

Uploaded CPython 3.6mmacOS 10.6+ Intel (x86-64, i386)

pybase64-0.2.1-cp35-cp35m-win_amd64.whl (30.1 kB view details)

Uploaded CPython 3.5mWindows x86-64

pybase64-0.2.1-cp35-cp35m-win32.whl (28.2 kB view details)

Uploaded CPython 3.5mWindows x86

pybase64-0.2.1-cp35-cp35m-manylinux1_x86_64.whl (62.5 kB view details)

Uploaded CPython 3.5m

pybase64-0.2.1-cp35-cp35m-manylinux1_i686.whl (58.4 kB view details)

Uploaded CPython 3.5m

pybase64-0.2.1-cp35-cp35m-macosx_10_6_intel.whl (40.6 kB view details)

Uploaded CPython 3.5mmacOS 10.6+ Intel (x86-64, i386)

pybase64-0.2.1-cp34-cp34m-manylinux1_x86_64.whl (62.3 kB view details)

Uploaded CPython 3.4m

pybase64-0.2.1-cp34-cp34m-manylinux1_i686.whl (58.3 kB view details)

Uploaded CPython 3.4m

pybase64-0.2.1-cp34-cp34m-macosx_10_6_intel.whl (40.5 kB view details)

Uploaded CPython 3.4mmacOS 10.6+ Intel (x86-64, i386)

pybase64-0.2.1-cp33-cp33m-manylinux1_x86_64.whl (61.8 kB view details)

Uploaded CPython 3.3m

pybase64-0.2.1-cp33-cp33m-manylinux1_i686.whl (57.8 kB view details)

Uploaded CPython 3.3m

pybase64-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl (61.8 kB view details)

Uploaded CPython 2.7mu

pybase64-0.2.1-cp27-cp27mu-manylinux1_i686.whl (57.6 kB view details)

Uploaded CPython 2.7mu

pybase64-0.2.1-cp27-cp27m-manylinux1_x86_64.whl (61.7 kB view details)

Uploaded CPython 2.7m

pybase64-0.2.1-cp27-cp27m-manylinux1_i686.whl (57.6 kB view details)

Uploaded CPython 2.7m

pybase64-0.2.1-cp27-cp27m-macosx_10_6_intel.whl (40.5 kB view details)

Uploaded CPython 2.7mmacOS 10.6+ Intel (x86-64, i386)

File details

Details for the file pybase64-0.2.1.tar.gz.

File metadata

  • Download URL: pybase64-0.2.1.tar.gz
  • Upload date:
  • Size: 79.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pybase64-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4c7e33d7b9ee7d0c5495503a40bd3a370537ac2e317fcf1bf612e5a29379efc1
MD5 28c1d2125500ba95c492db9a157d76e8
BLAKE2b-256 bcdafa5a9dea87b0c10f6bef7f14bb2528200a9fe8de3c8535c38cb5a6348797

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 08137d6154d4f6ffec57d976f05d350c1db3927b3a865b2995e50646f41df56f
MD5 7719af0f33305b8d521893ce061e693f
BLAKE2b-256 b0498ac52a732d16682273df7dc5af5aaa81bbf8a12a56d8a78b108079e971d0

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 616f39de0c6b8a632db02bcd8d31f6ef1a1c9693a666828deb26dd24a2c52527
MD5 fc76819c23e7bbfefc841273f91b63e5
BLAKE2b-256 d75213b374ceedce51cda94ed20adc7b39fd3e160d55e0321133ee2c54fa8192

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a1def09ceedafa018b5f82a58394a768b43fbc7bc7f60fa7a472dceb7fdc4e91
MD5 1f09f236b516a267b6b664a66c22c031
BLAKE2b-256 f18345f8da69cb2b1e4178b45a746657e4b788308af0a808327fcd6b78d6ebb7

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp36-cp36m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 9fc42bdb471bf2fc06d9e69b164bbeb1051f92bfa3d4ad24e9b3d1dc918e5f2a
MD5 6265d0b1a0551194c533073c50bcc9d2
BLAKE2b-256 33a778de60b40058f57a2b45ee58f7bb5adb352fc88692b505f03c0b2f66e874

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp36-cp36m-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 b52b1815b8ee0846bfec8464317f25168f8a00b57b3f72c981da27c6e4307f04
MD5 e07c8eb9ba5ce235e4ec3ddef914532e
BLAKE2b-256 77d362293119be292cda2eb20fe1ca0ce07735296cfaa218f623a5885f0ac486

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 bc30e36a3150631395133f7653de8414bcf446a5819d83b850dd113ecce22f7a
MD5 05fa838e87c4b92d44d881a6f5fe6e3e
BLAKE2b-256 5b2358794b04c2673cefbc7a2480cd0a9c670f86cf4ba418cdd9b2c5051c34db

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 ab6c8a5b432992f0cb5f86cfc9857778dd450f1ea86869de4d384c3a375d139b
MD5 22968cc31f9a6957923dfaa117d60517
BLAKE2b-256 58a330bc4483e4451f6db06bf744b74e1bbbaac89792c33e06a4942c42f92cb9

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 01eb4c7737bdd071f851e9d668c636aa67f0509412446af2139fef201d00d5d4
MD5 d357ba0a9d82e868cc2027c83470dbca
BLAKE2b-256 50ee5a3c18db2b1dec4c786da9dcbe4149c0ab9430bab5369f6cc66097b7e59a

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp35-cp35m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 8c0c5715c97a9265e87e67cca9a296f3d91af7b20b611d2a7dabc932145f81cf
MD5 b7b4e89357c7e938f7eee1334fd285b9
BLAKE2b-256 cbcaaed6ae6529a2166d88b89c80dcb2d32624d92b5f28cffbc8ade259984310

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 9527b3a8e77bd67bd8026481305308d3cb529955ea3bbc2c44f80aaddeaeaa0e
MD5 cd85a8364f1b1d08b092618704d470b8
BLAKE2b-256 6e2b179253bb76553f2fec784fe960a14aab68f4e344f87cf4c81a36674717c7

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 405a38b417fb5c5e0396cfface145149da8a6f7ad1f5ca297116587d6191d8ec
MD5 e8f93b162fa69382ee10bcb980b6d0cc
BLAKE2b-256 f1295d85748b15e58ee33d5350ea836a36e14ad60695f06b6a577b994434ae6a

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp34-cp34m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp34-cp34m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 888e2ee6356dbccd5dd62e448d38d10b59244662e79aea6cc91715c274b3629f
MD5 a873314adf280ce82d0263f9a944f756
BLAKE2b-256 769854ebf569603f289ba77a4ec565de0d0453a48c50deb1c7a480971ee7b05f

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp34-cp34m-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp34-cp34m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 94a624e0f1fd37394abdae9bfe96889195121c113f819ff136ec38896a2ed0d8
MD5 ec8af7ed034995f5f5daef6f715ea639
BLAKE2b-256 f91987a44c5a6c148eb59a19860a430a549e25e11aabf6655987ae862b715077

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp33-cp33m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp33-cp33m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 613ec6b19bdad4fc253e80b14abf45ba1f997d0753b84e73ec503fe3a600f105
MD5 8f8e872d4c442c3f46fb8828ae8f4be6
BLAKE2b-256 f9162b89de08af815a3e58469b428e2ab4357f3278a03059df0a0c8beec178b1

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp33-cp33m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp33-cp33m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 fe3401aec66c490b7e7e1b2dd47467a518de33728e22c9adf6410d0fee282d7e
MD5 d4883c3db65121fe9f22055dab1d1db4
BLAKE2b-256 b4763b34fb405c5cf92d1492f9271b9cd85ee790c4bd9813ffb104074ad68ef5

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cae44e1ec649f46e5968439fb0246f9672f12505d5e35977e62c0ea637b851bc
MD5 73e0776fda4a111525f2a31a7d5db31d
BLAKE2b-256 88252481e98b7e38cf05de38d89395c87cde2416e1727890cad0bfaf3065fc6f

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp27-cp27mu-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp27-cp27mu-manylinux1_i686.whl
Algorithm Hash digest
SHA256 3f17a820822df1a1f8b77dd3f17cf337707cd6ae9d9ac46ee0475bad682c0096
MD5 f17345a82966d52014bacc3bd954ce1f
BLAKE2b-256 d9202dae729a6310160062be4ec200925b2e04da8af29026cf9d1440a73cf3ee

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5c121749576ffbab51e6ed26b0f1f40975b8a251671491e6146d0dbe2c090b2a
MD5 099c92c650ce1488280f79da6aacf53f
BLAKE2b-256 46241eb03393c41ec15f105650f3fc236d19b1c4da3fe4b4ae81cc44061d33ae

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp27-cp27m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp27-cp27m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 0ef1553331dca495aa5622ac0c1fd7cad32cf95744667d974808cd59c901ec9c
MD5 dadab60f5b97a689251af9fa759f32fe
BLAKE2b-256 da8231a8fb3696b97f25f2c13453b1b9634b4d118af9572824957581760c2564

See more details on using hashes here.

File details

Details for the file pybase64-0.2.1-cp27-cp27m-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for pybase64-0.2.1-cp27-cp27m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 6130a7bbd605c42b2a41e6af1e847bc6f9bce7bccbddba5d101595d2307639cf
MD5 2e2b24af2560280bc7505984fec16245
BLAKE2b-256 84c43c94b9cf606f9c17829a8883636e95ebcf8fdd44aa188dbec62758cf4eaa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page