Question

I have been trying to parse a torrent file in Erlang, So far I was able to extract all the general info like torrent name, files(length, path, name), tracker link...

The only thing that is bothering me is the sha1 hash value. I checked many websites online and according to the specification the "info" dictionary is what needs to be hashed. However, I'm still confused by the delimiters. Should d and e be included or not?

Finally, I think that it matters how the data is read in from the file, right now I read the file as a binary then convert it to a list before parsing the data. Does this change/corrupt the hash if generated? Is there a suitable data type (Binary / List) to be able to correctly extract the info dictionary.

Thanks in advance.

Was it helpful?

Solution

Everything from the info dictionary should be hashed including the first and last characters; the d and e.

OTHER TIPS

I´m not sure I understood exactly what you want, but i´m not an torrent file expert. For getting the SHA1 from a binary: http://www.erlang.org/doc/man/crypto.html

if you need SHA2: http://steve.vinoski.net/code/sha2.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top