Python

Bencoding (encoding of a .torrent file)

in tech     7 min. read

December 21, 2010

The Bencode format is an interesting design. It is byte based, which makes it safe from big-endian and little-endian translations. Somewhere when reading about how torrents worked, I got looking at their file format. As far as I know, the Bencode format isn’t used on anything but torrent files. The format is pretty simple, with only 4 different data structures: Byte String, Integer, List, and Dictionary. Bencode Basics Byte String This is formatted as [integer length]:[byte string].

Continue reading