Skip to main content

Implementation of bencode with optional fast C extensions

Project description

fastbencode

fastbencode is an implementation of the bencode serialization format originally used by BitTorrent.

The package includes both a pure-Python version and an optional C extension based on Cython. Both provide the same functionality, but the C extension provides significantly better performance.

Example:

>>> from fastbencode import bencode, bdecode
>>> bencode([1, 2, b'a', {b'd': 3}])
b'li1ei2e1:ad1:di3eee'
>>> bdecode(bencode([1, 2, b'a', {b'd': 3}]))
[1, 2, b'a', {b'd': 3}]

The default bencode/bdecode functions just operate on bytestrings. Use bencode_utf8 / bdecode_utf8 to serialize/deserialize all plain strings as UTF-8 bytestrings. Note that for performance reasons, all dictionary keys still have to be bytestrings.

License

fastbencode is available under the GNU GPL, version 2 or later.

Copyright

  • Original Pure-Python bencoder (c) Petru Paler
  • Cython version and modifications (c) Canonical Ltd
  • Split out from Bazaar/Breezy by Jelmer Vernooij

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

fastbencode-0.3.1.tar.gz (20.9 kB view hashes)

Uploaded Source

Built Distributions

fastbencode-0.3.1-pp310-pypy310_pp73-win_amd64.whl (53.3 kB view hashes)

Uploaded PyPy Windows x86-64

fastbencode-0.3.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (63.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

fastbencode-0.3.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (64.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fastbencode-0.3.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl (51.5 kB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

fastbencode-0.3.1-pp39-pypy39_pp73-win_amd64.whl (53.2 kB view hashes)

Uploaded PyPy Windows x86-64

fastbencode-0.3.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (63.3 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

fastbencode-0.3.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (64.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fastbencode-0.3.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl (51.4 kB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

fastbencode-0.3.1-pp38-pypy38_pp73-win_amd64.whl (53.2 kB view hashes)

Uploaded PyPy Windows x86-64

fastbencode-0.3.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (63.1 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

fastbencode-0.3.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (61.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fastbencode-0.3.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl (51.0 kB view hashes)

Uploaded PyPy macOS 11.0+ ARM64

fastbencode-0.3.1-cp312-cp312-win_amd64.whl (57.8 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

fastbencode-0.3.1-cp312-cp312-win32.whl (52.0 kB view hashes)

Uploaded CPython 3.12 Windows x86

fastbencode-0.3.1-cp312-cp312-musllinux_1_1_x86_64.whl (310.6 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

fastbencode-0.3.1-cp312-cp312-musllinux_1_1_i686.whl (292.9 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

fastbencode-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (307.2 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

fastbencode-0.3.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (292.6 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fastbencode-0.3.1-cp312-cp312-macosx_11_0_arm64.whl (60.8 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

fastbencode-0.3.1-cp311-cp311-win_amd64.whl (57.7 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

fastbencode-0.3.1-cp311-cp311-win32.whl (52.0 kB view hashes)

Uploaded CPython 3.11 Windows x86

fastbencode-0.3.1-cp311-cp311-musllinux_1_1_x86_64.whl (313.5 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

fastbencode-0.3.1-cp311-cp311-musllinux_1_1_i686.whl (300.9 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

fastbencode-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (316.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

fastbencode-0.3.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (299.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fastbencode-0.3.1-cp311-cp311-macosx_11_0_arm64.whl (60.6 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

fastbencode-0.3.1-cp310-cp310-win_amd64.whl (57.6 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

fastbencode-0.3.1-cp310-cp310-win32.whl (52.2 kB view hashes)

Uploaded CPython 3.10 Windows x86

fastbencode-0.3.1-cp310-cp310-musllinux_1_1_x86_64.whl (291.3 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

fastbencode-0.3.1-cp310-cp310-musllinux_1_1_i686.whl (281.7 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

fastbencode-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (291.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

fastbencode-0.3.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (276.6 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fastbencode-0.3.1-cp310-cp310-macosx_11_0_arm64.whl (60.2 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

fastbencode-0.3.1-cp39-cp39-win_amd64.whl (58.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

fastbencode-0.3.1-cp39-cp39-win32.whl (52.8 kB view hashes)

Uploaded CPython 3.9 Windows x86

fastbencode-0.3.1-cp39-cp39-musllinux_1_1_x86_64.whl (295.0 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

fastbencode-0.3.1-cp39-cp39-musllinux_1_1_i686.whl (283.2 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

fastbencode-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (294.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

fastbencode-0.3.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (278.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fastbencode-0.3.1-cp39-cp39-macosx_11_0_arm64.whl (60.9 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

fastbencode-0.3.1-cp38-cp38-win_amd64.whl (58.5 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

fastbencode-0.3.1-cp38-cp38-win32.whl (52.9 kB view hashes)

Uploaded CPython 3.8 Windows x86

fastbencode-0.3.1-cp38-cp38-musllinux_1_1_x86_64.whl (304.2 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

fastbencode-0.3.1-cp38-cp38-musllinux_1_1_i686.whl (294.7 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

fastbencode-0.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (298.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

fastbencode-0.3.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (282.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

fastbencode-0.3.1-cp38-cp38-macosx_11_0_arm64.whl (61.1 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

Supported by

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