Onion Routing
From Pfyshnet
You should understand Asymmetric Encryption before attempting to understand Onion Routing.
We use the term Onion Routing for Pfyshnet, but we do not exactly use the same mechanisms as Mix nets, TOR, or I2P. However, all of these networks, and Pfyshnet, use the same tried and true principles that we'll refer to as Onion Routing.
We'll use an analogy to describe one type of Onion Routing used by Pfyshnet. Let's assume we have 4 people in our network, Alice, Bob, Cindy, and Dan. Each of them has a Key Pair, and they all know each others public keys. Alice wants to send a message to Dan, but she doesn't want Dan to know she sent it. Alice first encrypts her message using Dan's public key. Then she attaches the encrypted data to a message to Cindy telling her to forward the encrypted data to Dan. Then she encrypts the message to Cindy (along with the already encrypted data) using Cindy's public key. She then takes the new encrypted data and attaches it to a note to Bob, telling him to forward it to Cindy. Then she encrypts the new message and data using Bob's public key. Alice then sends the encrypted data to Bob. Bob uses his Private Key to decrypt the data. He sees the note telling him to forward the attached data to Cindy, but he cannot read the data because it has been encrypted for Cindy. When Cindy gets the data she decodes it using her Private Key. She sees the note telling her to forward the attached data to Dan, but she cannot read the attached data either. Dan gets the data and decodes Alice's original note using his private key. Dan knows that the data was sent to him from Cindy, but he does not know who sent it to her.
Using the above analogy we see some issues with Onion Routing. Lets assume they can see the messages being passed between each other. Dan would have seen a message go from Alice to Bob to Cindy and then to him, and he would have a good idea that the message was from Alice. (Even though it is possible that Alice sent a different message to Bob, and then Bob sent another message to Dan through Cindy). Onion Routing networks require “cover” activity. The idea is that if enough messages are moving around then it's harder to follow their paths. Another defense is Mixing, where a participant pools messages for a time until a batch can be sent out at once. However, Mixing can greatly increase the time it takes for messages to reach their destination.
Another issue with Onion Routing is the size of the messages. Lets assume there is a lot of messages moving around, but that they are all very large in size. Now lets assume Alice sends a small message to Dan. Then the small message would be easy to follow among the larger messages. To fix this problem Alice adds random data to the end of her message until it is the same size as the rest of the messages. This is called padding.

