1.3.1.2 PNRP IDs

PNRP defines a numerical namespace for PNRP IDs. Each Peer Name is converted to a number, and the numbers are compared to determine proximity within the namespace.

Peer Names are first converted to 128-bit numbers called Peer-To-Peer IDs (P2P IDs) by means of the following hashing function:

 P2P ID = first 128 bits of SHA-1(SHA-1(Classifier) | AuthorityHash | SHA-1(Classifier) | Goo)

Where:

  • Classifier is the Classifier element of the Peer Name.

  • AuthorityHash is the hash calculated in step 2 of section 1.3.1.1 for Secure Peer Names, or 160 zero bits if the originating Peer Name is an Unsecured Peer Name.

  • Goo is a 32-bit number with value: 0x504e5250 (ASCII encoding of "PNRP").

A specific instance of a Peer Name registration also has a 128-bit number called a Service Location, which makes the specific instance of the Peer Name registration unique in the network.

PNRP uses a service location suffix to ensure that each registered instance has a unique PNRP ID. A service location is a 128-bit number that is derived from an IP endpoint of the PNRP node. When two service locations are compared, the length of the common prefix for each can be used as a (very) rough measure of network proximity.

 Service Location = (SL Upper << 64) | (SL Lower)

Where:

  • SL Upper = Upper 64 bits of the IPv6 address used by the service, OR a 64-bit hint provided by the application.

  • SL Lower = First 64 bits of SHA-1(Public Key of the CPA | list of application service addresses contained in the CPA | 8-bit random number)

Together, the numbers make up a 256-bit number called the PNRP ID:

 PNRP ID = (P2P ID << 128) | (Service Location)
Show: