Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastbencode

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastbencode

Implementation of bencode with optional fast C extensions

  • 0.3.1
  • PyPI
  • Socket score

Maintainers
3

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.

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc