Encode and decode data with bencode rules