O'Reilly logo

Peer-to-Peer by Andy Oram

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Keys

As has already been noted, every document is indexed by a key. But Freenet has more than one type of key—each with certain advantages and disadvantages.

Since individual nodes on Freenet are inherently untrusted, nodes must not be allowed to return false documents. Otherwise, those false documents will be cached and the false data will spread like a cancer. The main job of the key types is to prevent this cancer. Each node in a chain checks that the document is valid before forwarding it back toward the requester. If it finds that the document is invalid, it stops accepting traffic from the bad node and restarts the request.

Every key can be treated as an array of bytes, no matter which type it is. This is important because the closeness function, and thus the routing, treats them as equivalent. These functions are thus independent of key type.

Key types

Freenet defines a general Uniform Resource Indicator (URI) in the form:

freenet:keytype@data

where binary data is encoded using a slightly changed Base64 scheme. Each key type has its own interpretation of the data part of the URI, which is explained with the key type.

Documents can contain metadata that redirects clients to another key. In this way, keys can be chained to provide the advantages of more than one key type. The rest of this section describes the various types of keys.

Content Hash Keys (CHKs)

A CHK is formed from a hash of the data. A hash function takes any input and produces a fixed-length output, where finding ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required