Reputation: 14226
Maybe I'm doing a terrible job of using the Google, but these specifications for Bencoding keep referring to something known as "base ten ASCII", which makes me think it's different than regular ASCII. Could someone explain?
Upvotes: 4
Views: 5237
Reputation: 61885
The base is explicitly stated to avoid confusion (although one might argue that base-10 is generally assumed by default).
Consider this: given the text representation of "12" (in ASCII), what is the numeric value?
However, in Bencode it's always base 10, so 42 (the integer) is encoded as "i42e".
A use of base-16 over base-10 might be to save a byte in longer ASCII-encoded numbers or to ensure a consistent pad size .. but base-10 fits in better with how numbers are commonly written and makes a Bencoded file more accessible. (That said, Bencoded files are generally not "human editted".)
Upvotes: 7
Reputation: 18560
integer encoded in base ten ASCII
that means numbers like you count with eg 1, 9, 11, 123. ASCII is http://en.wikipedia.org/wiki/ASCII#ASCII_control_code_chart
Your looking in the Dec Column
encoded in base 10 means the number, and ASCII meaning the letter representation of the numbers, for easier reading in a text editor
Upvotes: 0
Reputation: 649
Base 10 ASCII means, you write out the ASCII code of the character in base 10, instead of base 16.
A would thus be written as 65. The space character would be written as 32. m would be written as 109.
This contrasts with (for example) URL-encoded ASCII, which is base 16. In URL encoding, %41 is A, %20 is space, and %6D is m.
Upvotes: 0
Reputation: 33954
As opposed to binary? Looks like the number 5 is shown in its base-10 form 5
instead of the binary version 101
.
Upvotes: 1
Reputation: 3674
"Base 10 ASCII," as used in this context, is not one thing. It just means that a base 10 number is represented using ASCII characters.
Upvotes: 1