forked from premiere/premiere-libtorrent
fixed dht node-id unit test and update documentation
This commit is contained in:
parent
d6a53200a2
commit
c71c2ee3a5
|
@ -105,7 +105,7 @@ Example code code for calculating a valid node ID::
|
||||||
uint8_t r = rand & 0x7;
|
uint8_t r = rand & 0x7;
|
||||||
SHA1_Update(&ctx, (unsigned char*)&r, 1);
|
SHA1_Update(&ctx, (unsigned char*)&r, 1);
|
||||||
SHA1_Final(&ctx, node_id);
|
SHA1_Final(&ctx, node_id);
|
||||||
for (int i = 4; i < 19; ++i) node_id[i] = rand();
|
for (int i = 4; i < 19; ++i) node_id[i] = std::rand();
|
||||||
node_id[19] = rand;
|
node_id[19] = rand;
|
||||||
|
|
||||||
test vectors:
|
test vectors:
|
||||||
|
@ -115,10 +115,10 @@ test vectors:
|
||||||
IP rand example node ID
|
IP rand example node ID
|
||||||
============ ===== ==========================================
|
============ ===== ==========================================
|
||||||
124.31.75.21 1 **8a84ac4d** 0c5d6a4ec8a88e4c6ab4c28b95eee4 **01**
|
124.31.75.21 1 **8a84ac4d** 0c5d6a4ec8a88e4c6ab4c28b95eee4 **01**
|
||||||
21.75.31.124 86 **b25a51b1** 4e7a08645677bbd1cfe7d8f956d532 **56**
|
21.75.31.124 86 **1167d8b9** 4e7a08645677bbd1cfe7d8f956d532 **56**
|
||||||
65.23.51.170 22 **dc35968d** bc8f112a3d426c84764f8c2a1150e6 **16**
|
65.23.51.170 22 **508e075d** bc8f112a3d426c84764f8c2a1150e6 **16**
|
||||||
84.124.73.14 65 **98f44bb1** 1bb1fe518101ceef99462b947a01ff **41**
|
84.124.73.14 65 **095d76cb** 1bb1fe518101ceef99462b947a01ff **41**
|
||||||
43.213.53.83 90 **5978e1c4** 5b7c4be0237986d5243b87aa6d5130 **5a**
|
43.213.53.83 90 **f62b5a2f** 5b7c4be0237986d5243b87aa6d5130 **5a**
|
||||||
|
|
||||||
The bold parts of the node ID are the important parts. The rest are
|
The bold parts of the node ID are the important parts. The rest are
|
||||||
random numbers.
|
random numbers.
|
||||||
|
|
|
@ -1734,10 +1734,10 @@ int test_main()
|
||||||
boost::uint8_t prefixes[][4] =
|
boost::uint8_t prefixes[][4] =
|
||||||
{
|
{
|
||||||
{0x8a, 0x84, 0xac, 0x4d},
|
{0x8a, 0x84, 0xac, 0x4d},
|
||||||
{0xb2, 0x5a, 0x51, 0xb1 },
|
{0x11, 0x67, 0xd8, 0xb9 },
|
||||||
{0xdc, 0x35, 0x96, 0x8d },
|
{0x50, 0x8e, 0x07, 0x5d },
|
||||||
{0x98, 0xf4, 0x4b, 0xb1 },
|
{0x09, 0x5d, 0x76, 0xcb },
|
||||||
{0x59, 0x78, 0xe1, 0xc4 },
|
{0xf6, 0x2b, 0x5a, 0x2f },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i)
|
for (int i = 0; i < 5; ++i)
|
||||||
|
|
Loading…
Reference in New Issue