Pybencoding Documentation

What

pybencoding is a pure python 3 implementation of the bittorrent bencoding serialization scheme. The goal of this library is to encode and decode small pieces of data, so performance is not specifically considered.

Why

The library was created because the author had issues getting several of the ‘bencoding’ results in pip to work and if XKCD 927 has taught us anything it’s that we should create another implementation.

Quickstart

import pybencoding

obj = ['hello bencoding', 42, {'key': 'value'}]
enc = pybencoding.encode(obj)
print('encoded the object to:', enc)
dec = pybencoding.decode(enc)
print('decoded the object to:', dec)