Expand description
This module contains functions for percent decoding infohashes and peer IDs.
Percent encoding is an encoding format used to encode arbitrary data in a format that is safe to use in URLs. It is used by the HTTP tracker protocol to encode infohashes and peer ids in the URLs of requests.
BitTorrent infohashes and peer ids are percent encoded like any other
arbitrary URL parameter. But they are encoded from binary data (byte arrays)
which may not be valid UTF-8. That makes hard to use the percent_encoding
crate to decode them because all of them expect a well-formed UTF-8 string.
However, percent encoding is not limited to UTF-8 strings.
More information about “Percent Encoding” can be found here:
Functions§
- percent_
decode_ info_ hash - Percent decodes a percent encoded infohash. Internally an
InfoHashis a 20-byte array. - percent_
decode_ peer_ id - Percent decodes a percent encoded peer id. Internally a peer
Idis a 20-byte array.