Skip to content

Decode bencoded strings #9

Description

@CapSmoIIett

Bencode (pronounced Bee-encode) is a serialization format used in the BitTorrent protocol. It is used in torrent files and in communication between trackers and peers.

Bencode supports four data types:

strings
integers
arrays
dictionaries
In this stage, we'll focus on decoding strings.

Strings are encoded as :. For example, the string "hello" is encoded as "5:hello".

You'll implement a decode command which takes a bencoded value as input and prints the decoded value as JSON.

Here’s how the tester will execute your program:

$ ./your_bittorrent.sh decode 5:hello
"hello"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions