<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Project><name>HunnyB</name>
<shortdesc>implements "bencode" encoding/decoding</shortdesc>
<description>===================
        HunnyB (de|en)coder
        ===================
        
        Something like "Bencode remixed"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        
        HunnyB implements the `bencode`_ encoding/decoding originally
        created by `Petru Paler`_ for use in the guts of `BitTorrent`_,
        brainchild of `Bram Cohen`_.
        
        &gt;&gt;&gt; import hunnyb
        
        Import of the hunnyb module will register the encode/decode functions
        with the standard library `codecs`_ module, meaning strings may be
        encoded in one of the following ways:
        
        &gt;&gt;&gt; "foobaz hambones".encode('hunnyb')
        '15:foobaz hambones'
        
        &gt;&gt;&gt; "foobaz hambones".encode('hb')
        '15:foobaz hambones'
        
        &gt;&gt;&gt; "foobaz hambones".encode('bencode')
        '15:foobaz hambones'
        
        &gt;&gt;&gt; "foobaz hambones".encode('b')
        '15:foobaz hambones'
        
        
        Likewise, bencoded strings may be decoded, although the result will always
        be a string (a requirement of `codecs`_), meaning one will have to
        ``eval()`` said result if not of string type.
        
        &gt;&gt;&gt; enc_str = "ForkingHam BIZZYBONE RazzMATAZZ".encode('hb')
        
        &gt;&gt;&gt; print enc_str
        31:ForkingHam BIZZYBONE RazzMATAZZ
        
        &gt;&gt;&gt; enc_str.decode('hb')
        'ForkingHam BIZZYBONE RazzMATAZZ'
        
        &gt;&gt;&gt; enc_dict = hunnyb.encode({'foo': 99000, 0: [99, 8, 'bobob']})
        
        &gt;&gt;&gt; print enc_dict
        d1:0li99ei8e5:bobobe3:fooi99000ee
        
        &gt;&gt;&gt; enc_dict.decode('bencode')
        "{'0': [99, 8, 'bobob'], 'foo': 99000}"
        
        
        Alternatively, the ``encode`` and ``decode`` functions available in
        ``hunnyb`` may be used directly, with decoding always returning a
        given object's Python equivalent.
        
        &gt;&gt;&gt; hunnyb.decode(enc_dict)
        {'0': [99, 8, 'bobob'], 'foo': 99000}
        
        
        .. _bencode: http://en.wikipedia.org/wiki/Bencode
        .. _Petru Paler: http://petru.paler.net/
        .. _BitTorrent: http://www.bittorrent.com/what-is-bittorrent
        .. _Bram Cohen: http://en.wikipedia.org/wiki/Bram_Cohen
        .. _codecs: http://docs.python.org/lib/module-codecs.html
        .. vim:filetype=rst</description>
<homepage rdf:resource="http://meatballhat.com/projects/HunnyB" />
<maintainer><foaf:Person><foaf:name>Dan Buch</foaf:name>
<foaf:mbox_sha1sum>eae17c6dcb563592f1613bea8164a3ef088db845</foaf:mbox_sha1sum></foaf:Person></maintainer>
<release><Version><revision>0.1.0</revision></Version></release>
</Project></rdf:RDF>