Bencode

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
m
 
Line 3: Line 3:
 
|subcat=Serialization
 
|subcat=Serialization
 
}}
 
}}
 +
:''For another "Bencode" format, see [[Bencode (Quinton/Lalonde)]].''
  
 
'''Bencode''' (pronounced B-Encode, not Ben Code) is a serialization encoding format used in [[torrent file]]s for the BitTorrent protocol. It consists of a series of strings, integers, lists, and dictionaries; since lists and dictionaries contain multiple elements of the Bencode types, they can be nested hierarchically, encapsulating complex data structures.
 
'''Bencode''' (pronounced B-Encode, not Ben Code) is a serialization encoding format used in [[torrent file]]s for the BitTorrent protocol. It consists of a series of strings, integers, lists, and dictionaries; since lists and dictionaries contain multiple elements of the Bencode types, they can be nested hierarchically, encapsulating complex data structures.

Latest revision as of 15:46, 18 September 2022

File Format
Name Bencode
Ontology
For another "Bencode" format, see Bencode (Quinton/Lalonde).

Bencode (pronounced B-Encode, not Ben Code) is a serialization encoding format used in torrent files for the BitTorrent protocol. It consists of a series of strings, integers, lists, and dictionaries; since lists and dictionaries contain multiple elements of the Bencode types, they can be nested hierarchically, encapsulating complex data structures.

The elements are:

  • Strings: coded as a decimal number giving the length of the string, then a colon, then the string itself; e.g., 5:stuff
  • Integers: coded as the letter "i", then the integer (as a series of decimal digits), then the letter "e"' e.g., i42e
  • Lists: coded as the letter "l", then the list elements (each encoded as one of the Bencode types, which can include other lists), then the letter "e"; e.g., li42e5:stuffi666ee (which contains 42, 'stuff', and 666 as its elements)
  • Dictionaries: pairs of keys and values, where the key is a string and the value can be any Bencode type; surrounded by an opening letter 'd' and closing letter 'e'; keys must appear in alphabetic order; e.g., d4:testi42e3:zzz4:junke is a dictionary where key 'test' has value 42 and key 'zzz' has value 'junk'.

[edit] References

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox