Tor Onion Routing vs I2P Garlic Routing Explained
While both Tor and the Invisible Internet Project (I2P) provide anonymous networking through layered encryption, Tor uses traditional onion routing, whereas I2P uses an evolved mechanism called garlic routing. The primary difference lies in how data is packaged and how network paths are established: Tor sends individual messages through bidirectional circuits primarily designed for accessing the open internet, while I2P bundles multiple messages into encrypted “cloves” and routes them through separate unidirectional tunnels optimized for an internal peer-to-peer network.
Tor and Onion Routing
Tor relies on onion routing, a technique where data is wrapped in multiple layers of encryption like the layers of an onion. A Tor client builds a circuit typically consisting of three nodes: an entry/guard node, a middle relay, and an exit node.
- Bidirectional Circuits: Tor uses the exact same path for both sending and receiving traffic. If you send a request through relays A, B, and C, the response travels back through C, B, and A.
- Single Message Streams: Each onion packet contains a single message or payload destined for a specific endpoint.
- Clearnet Focus: Tor is heavily optimized for “outproxying,” allowing users to browse the public World Wide Web anonymously via exit nodes.
I2P and Garlic Routing
Garlic routing is an extension of onion routing developed by I2P. Instead of treating each message individually, garlic routing bundles multiple discrete messages into a single encrypted container called a “garlic,” where individual messages are referred to as “cloves.”
- Unidirectional Tunnels: I2P separates outbound and inbound traffic. Data sent to a destination travels through an outbound tunnel, while incoming responses travel back through a completely different inbound tunnel.
- Message Bundling (Cloves): A single garlic packet can contain multiple encrypted cloves. These cloves can include data payloads, routing instructions, or network status requests, and they can be directed to different recipients along the path.
- Internal Network Focus: I2P is designed primarily as a closed, self-contained network for internal services (known as “eepsites”) rather than an outproxy tool for the public web.
Key Architectural Differences
- Traffic Analysis Defense: Because I2P bundles multiple cloves into one garlic packet and uses separate inbound and outbound paths, it makes timing attacks and traffic analysis significantly more difficult for an adversary compared to Tor’s bidirectional streams.
- Bandwidth and Performance: Tor operates with lower latency, making it better suited for interactive web browsing. I2P’s packet-switched architecture and tunnel construction introduce slightly higher latency but provide robust peer-to-peer file sharing and decentralized internal communication.
- Tunnel Management: Tor circuits are centralized around directory authorities that maintain the network state. I2P operates on a fully distributed network database (NetDB) using a modified Kademlia Distributed Hash Table (DHT) to build and maintain its garlic tunnels.