TTH means Tiger Tree Hash. It is the Tiger-algorithm that is used as a tree.
The Tiger algoritm isn’t the same as the Tiger Tree algoritm and I’ll explain later what’s the difference.
‘Rövarspråket’ (RS) (”Pirate language”) is a known Swedish “encrypting algorithm”. The algotihm takes inputted data and adds to all consonants ‘o’ and then the same consonant. All vowels stay the same. Eg, if “Hello” was run through the RS algorithm, it would come out as “Hohelollolo”. If you know the RS algorithm, you can also decrypts messages. This is of course because the algorithm is very simple. (You may have heard of ‘piglatin’? It is also an “encrypting algorithm” that is very simple.)
The Tiger algorithm work basically the same. Data is run through the Tiger algorithm, and out comes a string, a ‘hash’, that is unique for the data. A huge difference between the Tiger and the RS algorithm is that you can’t reverse engineer the hash to see what the data is. (This is one of the points with hashes.)
(To) hash = the act of putting data through an encrypting algorithm.
(A) hash = encrypted data in the form of a string.
Hashes = encrypts = creates a hash. Alt: hashes = plural form of “a hash”.
What’s the difference between the Tiger and Tiger Tree algorithm then? The difference is that the Tiger algorithm takes the entire data and hashes it whereas the Tiger Tree algorithm breakes down the data into chunks or branches (you’ll soon understand why I use ‘branches’) and hashes every branch until a root hash been created.
Let me illustrate with an example.
Consider you have a file consisting of random data. The file size is 27 kB. We’ll call it FILE.
Consider now that you create a tree (you know, you’ll have to go outside to see one). At the bottom of this tree, there is what we call ‘root’ (in the real world, ‘root’ is the base of the tree…). From this base or root, three large branches has been grown. We call these branches LB1, LB2 and LB3. (”Large branch <number>”) From each of these LBs, three smaller branches grow. We call these MB1, MB2, … MB9. (”Medium branch <number>”) From each of these MBs, three even smaller branches grow. We call these SB1, SB2, … SB27. (”Small branch <number>”)
The Tiger algorithm now creates a hash from the first 1 kB of FILE and puts the hash inside SB1. Then the algoritm creates a hash for the next 1 kB of FILE and puts the hash inside SB2. And so on until all 27 SBs contain a hash.
The Tiger algorithm now takes the hashes on the SBs on MB1 and hashes them and puts the hash in MB1. That sounded confusing even to me. The hashes that is inside SB1, SB2 and SB3 is put together so it’s like one string. The hashes are just concatenated. So it’ll appear as “SB1SB2SB3″. This string is now hashed and put inside of MB1. The same happens for MB2 with “SB4SB5SB6″ etcetera.
So, we started with 27 branches. Then we hashed them together so we now got 9 hashes, MBs.
Next, since MB1, MB2 and MB3 is on the LB1 branch, they are hashed together. In the same way the SBs was hashed together to a MB. We do this of course with LB2 and LB3.
Now we have tree hashes, LBs. These hashes are now, like before, concatenated and hashed. This hash in then put in the root, or base.
This hash we have now at the root, is what you see in DC++ as ‘TTH root’.
The tiger algorithm doesn’t look at the size of the file. Nor at the fact that the file is called FILE. I just chose 27 kB because it was easy to count with it.
You can see also see information how DC++ stores the hashes.
More information about hashes here.