Onion routing (Syverson) is an anonymous communication technique used to anonymize network traffic. Messages are encrypted recursively and sent to multiple network nodes or onion routers; each router decrypts one layer of the message and passes it on to the next router. This prevents the transport medium to find out who you are; the network does know that onion communication is taking place.
Figure 1: An example "Onion", http://en.wikipedia.org/wiki/File:Onion_diagram.svg
An onion is a data structure that is formed by wrapping a plaintext message with successive layers of encryption, such that each layer can be unwrapped or decrypted like the layers of an onion. The plaintext message is only viewable by the sender, exit node, recipient. This can be extended to end to end encryption so that the last intermediary cannot also view the message.
TOR (Roger Dingledine) is a circuit based low-latency anonymous communication service. TOR is now in its second generation and was developed from the Onion routing program. The routing system can run on several operating systems and protect the anonymity of the user. The latest TOR version supports perfect forward secrecy, congestion control, directory servers, integrity checking and configurable exit policies. Tor is essentially a distributed overlay network which works on the application layer of the TCP protocol. It essentially anonymizes all TCP-based applications like web-browsing, SSH, instant messaging. Using TOR can protect against common form of Internet surveillance known as “traffic analysis” (Electronic Frontier Foundation). Knowing the source and destination of your internet traffic allows others to track your behavior and interests. An IP packet has a header and a data payload, even if one encrypts the data part of the packet; the header can still be used to track the source, destination, timing etc., this can essentially pinpoint the exact location and origin of the packet. Powerful statistical traffic analysis done by large organizations such as the NSA can track communication patterns of various organizations and individuals even though their communications are encrypted. Encryption only hides the content of traffic and not the headers. Tor was developed to reduce the risks such attacks by distributing the internet traffic over several places on the Internet. Instead of taking a direct route (Figure 1), TOR takes a random pathway through several relays that cover your tracks so that no observer at any single point can tell where the data is originating for where is It going.
Figure 2: TOR, step 1; http://www.torproject.org/images/htw1.png
Figure 3: TOR, step 2; http://www.torproject.org/images/htw2.png
Figure 4: TOR, step 3; http://www.torproject.org/images/htw2.png
Each onion router on the tor overlay network runs a normal user-level process without any special privileges, each router mains a TLS connection to every other onion router. Each user runs local a local software...