Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3331636
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:36:16+00:00 2026-05-17T23:36:16+00:00

I’m trying to come up with the correct url-encoded info hash to send to

  • 0

I’m trying to come up with the correct url-encoded info hash to send to the tracker in order to get the peers list.

For testing, I tried parsing the torrent in this url.

After opening the file, manually cut the info dictionary piece and SHA1-hash it’s value I get this binary value:

<<84,124,15,255,155,171,156,168,91,46,204,24,249,116,110,
139,202,167,163,54>>

The ASCII string retrieved from the latter binary value is 788f590f28a799cc1009a9b780b649fd6f0a2e91, and it’s the same value mentioned in the site.

So let’s assume everything is correct until now (isn’t it?).

After encoding the binary value using the url-encoding function below I get
T%7c%0f%ff%9b%ab%9c%a8%5b.%cc%18%f9tn%8b%ca%a7%a36 , which is not even close to the correct urlencoded value that I should send to the tracker. (I get a not-found error message when I send this to the tracker, plus, it’s not matched to the value I see using wireshark which is x%8fY%0f%28%a7%99%cc%10%09%a9%b7%80%b6I%fdo%0a.%91 ).

The URL Encoding function I’m using:

encode(<<Bin:20/binary-unit:8>>)->
    %io:format("~p~n", [binary_to_list(Bin)]),
    encode(binary_to_list(Bin));
encode(List) -> do_encode(List).

do_encode([])-> [];
do_encode([H|T]) when H>=$a, H=<$z ->
    [H| encode(T)];
do_encode([H|T]) when H>=$A, H=<$Z ->
    [H| encode(T)];
do_encode([H|T]) when H>=$0, H=<$9 ->
    [H| encode(T)];
do_encode([H|T]) when H==$- ->
    [H| encode(T)];
do_encode([H|T]) when H==$. ->
    [H|do_encode(T)];
do_encode([H|T]) when H==$* ->
    [H|do_encode(T)];
do_encode([H|T]) ->
     to_hex(H) ++ encode(T).

hex(N) when N < 10 ->
    $0+N;
hex(N) when N >= 10, N < 16 ->
    $a+(N-10).
to_hex(N) when N < 256 ->
    [$%, hex(N div 16), hex(N rem 16)].

Is the function above wrong? I’m a kind of a newbie when it comes to raw-data handling. so help/ideas are much appreciated! Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:36:17+00:00Added an answer on May 17, 2026 at 11:36 pm

    Note that URL-encoding is already available in erlang (albeit well hidden).

    1> B = <<84,124,15,255,155,171,156,168,91,46,204,24,249,116,110, 139,202,167,163,54>>.
    <<84,124,15,255,155,171,156,168,91,46,204,24,249,116,110,
    2> L = erlang:binary_to_list(B).
    [84,124,15,255,155,171,156,168,91,46,204,24,249,116,110,139,
     202,167,163,54]
    3> edoc_lib:escape_uri(L).
    "T%7c%f%c3%bf%c2%9b%c2%ab%c2%9c%c2%a8%5b.%c3%8c%18%c3%b9tn%c2%8b%c3%8a%c2%a7%c2%a36"
    

    It yields the same result as yours.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.