Bittorrent encoding in ruby