Formatting code for FreenetCHKPages
=====CHK: Content Hash Keys=====
All files within Freenet are identified and requested by a **key**, in a similar way that normal websites are identified by a domain name. You don't really need to know the technical details to use Freenet; tools such as [[FreenetJsite jSite]] will sort it all out for you.
**Content Hash Keys** are for files that aren't going to change. For example: mp3 files. They look something like this:
~**""CHK@SVbD9~HM5nzf3AX4yFCBc-A4dhNUF5DPJZLL5NX5Brs,bA7qLNJR7IXRKn6uS5PAySjIM6azPFvK~18kSi6bbNQ,AAEA--8""**
These are created by making a **hash** of the file. This is like a fingerprint of the file: it is generally a lot smaller than the file itself. It should not be possible for two different files to have the same CHK; a CHK uniquely identifies a file (assuming that SHA-256 is not broken!).
This hash is used as an index to the file, in a similar way to the address, or URL, or a standard website. The CHK key is generated automatically, so it won't look as user-friendly as a domain name. For user-friendly keys, have a look at [[FreenetSSKPages SSK pages]].
===Example===
This example will add a small text file to Freenet using the **Content Hash Key** to identify it. We will use the basic [[FreenetConsole telnet interface]] to Freenet for illustrative purposes but you can use a more featured site creator like [[FreenetJsite jSite]].
At the command line, type the following to access Freenet's command line interface:
%%
telnet localhost 2323
%%
You should be presented with a list of options. Type the following and then press #%Enter#%:
%%
put:this is a test
%%
after a short while (be patient, it could take a minute or two) it will return this:
%%
URI: freenet:CHK@SVbD9~HM5nzf3AX4yFCBc-A4dhNUF5DPJZLL5NX5Brs,bA7qLNJR7IXRKn6uS5PAySjIM6azPFvK~18kSi6bbNQ,AAEA--8
%%
This random-looking string is the Content Hash Key (CHK) of the line of text **##this is a test##**, and is telling you the address that other people can use to access this file in Freenet. You can see that it consists of three segments, separated by commas:
~1) The first part, **""SVbD9~HM5nzf3AX4yFCBc-A4dhNUF5DPJZLL5NX5Brs""**, is the actual hash of the file.
~1) The second part, **""bA7qLNJR7IXRKn6uS5PAySjIM6azPFvK~18kSi6bbNQ""**, is the decryption key that unlocks the file (which is stored encrypted).
~1) The third part, **""AAEA--8""**, is something to do with settings such as cryptographical algorithms used.
To exit from the telnet interface, press ##Ctrl-]## and press #%Enter#%, then type ##quit## and press #%Enter#%.
To verify your file exists in Freenet, open a web browser and go to:
http://localhost:8888/CHK@SVbD9~HM5nzf3AX4yFCBc-A4dhNUF5DPJZLL5NX5Brs,bA7qLNJR7IXRKn6uS5PAySjIM6azPFvK~18kSi6bbNQ,AAEA--8
You may get a warning come up at first, but just tell the browser to open it as a plain text page. If all goes well, you should see the text you have just inserted to Freenet.
All files within Freenet are identified and requested by a **key**, in a similar way that normal websites are identified by a domain name. You don't really need to know the technical details to use Freenet; tools such as [[FreenetJsite jSite]] will sort it all out for you.
**Content Hash Keys** are for files that aren't going to change. For example: mp3 files. They look something like this:
~**""CHK@SVbD9~HM5nzf3AX4yFCBc-A4dhNUF5DPJZLL5NX5Brs,bA7qLNJR7IXRKn6uS5PAySjIM6azPFvK~18kSi6bbNQ,AAEA--8""**
These are created by making a **hash** of the file. This is like a fingerprint of the file: it is generally a lot smaller than the file itself. It should not be possible for two different files to have the same CHK; a CHK uniquely identifies a file (assuming that SHA-256 is not broken!).
This hash is used as an index to the file, in a similar way to the address, or URL, or a standard website. The CHK key is generated automatically, so it won't look as user-friendly as a domain name. For user-friendly keys, have a look at [[FreenetSSKPages SSK pages]].
===Example===
This example will add a small text file to Freenet using the **Content Hash Key** to identify it. We will use the basic [[FreenetConsole telnet interface]] to Freenet for illustrative purposes but you can use a more featured site creator like [[FreenetJsite jSite]].
At the command line, type the following to access Freenet's command line interface:
%%
telnet localhost 2323
%%
You should be presented with a list of options. Type the following and then press #%Enter#%:
%%
put:this is a test
%%
after a short while (be patient, it could take a minute or two) it will return this:
%%
URI: freenet:CHK@SVbD9~HM5nzf3AX4yFCBc-A4dhNUF5DPJZLL5NX5Brs,bA7qLNJR7IXRKn6uS5PAySjIM6azPFvK~18kSi6bbNQ,AAEA--8
%%
This random-looking string is the Content Hash Key (CHK) of the line of text **##this is a test##**, and is telling you the address that other people can use to access this file in Freenet. You can see that it consists of three segments, separated by commas:
~1) The first part, **""SVbD9~HM5nzf3AX4yFCBc-A4dhNUF5DPJZLL5NX5Brs""**, is the actual hash of the file.
~1) The second part, **""bA7qLNJR7IXRKn6uS5PAySjIM6azPFvK~18kSi6bbNQ""**, is the decryption key that unlocks the file (which is stored encrypted).
~1) The third part, **""AAEA--8""**, is something to do with settings such as cryptographical algorithms used.
To exit from the telnet interface, press ##Ctrl-]## and press #%Enter#%, then type ##quit## and press #%Enter#%.
To verify your file exists in Freenet, open a web browser and go to:
http://localhost:8888/CHK@SVbD9~HM5nzf3AX4yFCBc-A4dhNUF5DPJZLL5NX5Brs,bA7qLNJR7IXRKn6uS5PAySjIM6azPFvK~18kSi6bbNQ,AAEA--8
You may get a warning come up at first, but just tell the browser to open it as a plain text page. If all goes well, you should see the text you have just inserted to Freenet.