Yeap. Here is an excerpt from include/libtorrent/fingerprint.hpp (libtorrent 1.0.3):
Code: Select all
char version_to_char(int v) const
if (v >= 0 && v < 10) return '0' + v;
else if (v >= 10) return 'A' + (v - 10);
Libtorrent allows to construct the peer id by providing the fingerprint class a 2 character string, and 4 integers for major,minor,revision,tag versions. Each interger is converted to ascii using the above function.
Numbers 0-9 are converted to their equivalent ascii code(aka number).
All others are converted to the ascii code of 'A' plus their number.(minus 10).
Note: In C/C++ when you enclose something in single quotes it is treated as a character not as a number. So in this case '0' converted to number means 48 (the ascii code for zero).
EDIT: variables of type char can be treated in 2 ways: represent an actual character or represent a number(255 possible values).