Onion Routing

Layered Encryption for Anonymous Communication

Definition

Onion routing is a technique for anonymous communication over a computer network. Messages are encapsulated in layers of encryption, analogous to the layers of an onion. Each node along the path removes one layer, revealing the next destination, until the message reaches its final recipient.

History

Onion routing was developed in the mid-1990s at the U.S. Naval Research Laboratory by Michael Reed, Paul Syverson, and David Goldschlag. The goal was to protect U.S. intelligence communications online.

1995

Concept Development

Initial research at Naval Research Laboratory

1996

First Paper Published

"Hiding Routing Information" published at IEEE S&P

2002

Tor Development Begins

Second-generation onion routing (Tor) started

2004

Tor Released

Tor becomes open source and publicly available

How It Works

Layered Encryption

When sending a message through an onion network:

1

Path Selection

The sender's software selects a random path through the network, typically 3 nodes (relays).

2

Key Negotiation

The sender negotiates ephemeral keys with each relay using public key cryptography.

3

Layer Wrapping

The message is encrypted in layers, one for each relay, starting from the last.

4

Progressive Decryption

Each relay decrypts its layer, learns only the next hop, and forwards the message.

onion-encryption
# Original Message: "Hello"
# Encrypted in layers (innermost first)
Layer 1: Encrypt("Hello", Key_Exit) → E1
Layer 2: Encrypt(E1, Key_Middle) → E2
Layer 3: Encrypt(E2, Key_Guard) → E3 (Sent)
 
# Each relay peels one layer
Guard: Decrypt(E3) → E2 + "forward to Middle"
Middle: Decrypt(E2) → E1 + "forward to Exit"
Exit: Decrypt(E1) → "Hello" → Destination

Security Properties

What Onion Routing Protects

  • Sender Anonymity: Destination doesn't know who sent the message
  • Receiver Anonymity: With hidden services, servers stay anonymous
  • Relationship Anonymity: Observers can't link senders and receivers
  • Content Privacy: Encrypted traffic (with HTTPS)

Limitations

Timing Attacks Adversaries controlling entry and exit may correlate traffic
Global Adversary Entity monitoring entire network can perform traffic analysis
Website Fingerprinting Patterns in encrypted traffic can reveal visited sites

Implementations

Tor

Most widely used implementation

Network

Lokinet

Blockchain-incentivized variant

Network

Sphinx

Compact packet format for mixnets

Protocol

Lightning Network

Uses onion routing for payments

Payments
Related

Learn More