bencoding: A library for encoding and decoding of BEncode data.

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]

A library for fast and easy encoding and decoding of BEncode data.


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.3.0.0, 0.4.0.0, 0.4.0.1, 0.4.0.2, 0.4.1.0, 0.4.2.0, 0.4.2.1, 0.4.3.0, 0.4.4.0, 0.4.5.0, 0.4.5.1, 0.4.5.2, 0.4.5.3, 0.4.5.4, 0.4.5.5 (info)
Change log changelog
Dependencies attoparsec (>=0.10), base (>=4 && <5), bytestring (>=0.10.0.2), deepseq (>=1.3 && <1.4), ghc-prim, mtl, pretty, text (>=0.11) [details]
Tested with ghc ==7.4.1, ghc ==7.6.3
License BSD-3-Clause
Copyright (c) 2013, Sam Truzjan
Author Sam Truzjan
Maintainer Sam Truzjan <pxqr.sta@gmail.com>
Revised Revision 1 made by HerbertValerioRiedel at 2019-01-06T17:43:25Z
Category Data
Home page https://github.com/cobit/bencoding
Bug tracker https://github.com/cobit/bencoding/issues
Source repo head: git clone git://github.com/cobit/bencoding.git -b master
this: git clone git://github.com/cobit/bencoding.git -b master(tag v0.4.0.2)
Uploaded by SamTruzjan at 2013-10-01T03:43:15Z
Distributions NixOS:0.4.5.5, Stackage:0.4.5.5
Reverse Dependencies 5 direct, 0 indirect [details]
Downloads 14701 total (62 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Successful builds reported [all 1 reports]

Readme for bencoding-0.4.0.2

[back to package description]

Synopsis

BEncode is JSON-like format used in bittorrent protocol but might be used anywhere else.

Description

This package implements fast seamless encoding/decoding to/from bencode format for many native datatypes. To achive more performance we use bytestring builders and hand optimized attoparsec parser so this library is considered as replacement for BEncode and AttoBencode packages.

Format

Bencode is pretty similar to JSON: it has dictionaries(JSON objects), lists(JSON arrays), strings and integers. However bencode has a few advantages:

  • Compactness: no spaces in between any values — nor lists nor dicts nor anywhere else.
  • Dictionaries always sorted lexicographically by the keys. This allow us to test data on equality without decoding from raw bytestring. Moreover this allow to hash encoded data (this property is heavily used by core bittorrent protocol).
  • All strings prefixed with its length. This simplifies and speed up string parsing.

Hovewer there are some disadvantages comparing with JSON:

  • Bencode is certainly less human readable.
  • Bencode is rarely used, except bittorrent protocol of course.

Documentation

For documentation see package hackage page.

Build Status

Build Status

Maintainer pxqr.sta@gmail.com

Feel free to report bugs and suggestions via issue tracker or the mail.