Bencoding is an native Erlang application for parsing and encoding the bittorrent’s data representation.
It’s available via Hex.pm. Source code is on github.