UO Handshake: Your Career Launchpad at University of Oregon
The term UO handshake refers to the opening negotiation that happens whenever an Ultima Online client connects to a server. Before a character ever appears on screen, the client and server must agree on encryption keys, protocol version, and which shard the player wants to join. That exchange takes only a handful of packets, but nothing else in the session works until it succeeds.
For most players, the handshake is completely invisible. For shard administrators, emulator developers, and anyone poking at decades-old game networking, it is one of the most interesting and most misunderstood parts of the entire protocol. Whether you are running a small private shard, writing a custom client, or just curious about how a 1997 MMO still functions today, understanding the handshake is the entry point to everything else.
Understanding the UO Handshake
Ultima Online does not use a single connection for the whole session. At a minimum there are two: the login server, which traditionally listens on port 2593 and handles authentication and shard selection, and the game server on port 2592, which handles the actual world. Each of those connections begins with its own handshake, and each one can fail independently.
The purpose of the handshake is straightforward. It establishes a shared secret so that both sides can encrypt traffic, it confirms that the client is a version the server is willing to talk to, and it gives the server a chance to redirect the client to the correct shard before any gameplay data is exchanged. Without this step, a rogue client could simply skip authentication, and packet injection would be trivial.
The Seed and Key Exchange
In classic implementations, the handshake begins with a four-byte random seed. One side generates it, the other replies with a four-byte key, and both values are then run through an MD5 hash. The resulting bytes are used to build the substitution tables and key material that the connection will use for the rest of its life. Every emulator project that supports the original protocol — RunUO, ServUO, and their descendants — implements this same basic exchange.
The seed is what makes each session unique. A client that sends the same seed twice, or a server that hardcodes its key, produces predictable encryption and effectively hands an attacker the session key. This is why real clients pull the seed from a strong random source, and why debugging a handshake with a fixed seed value is a quick way to create bugs that only appear on one machine.
The Encryption Layers That Follow
Once the seed and key are hashed, the client and server derive a 256-byte substitution table used by the older UO cipher. This cipher is symmetric and stateless from the application's point of view, which makes it fast but also means that any desynchronization between the two sides turns every subsequent packet into garbage. Newer client versions moved to a Twofish-based scheme using the same hash output as key material, and later builds also negotiate packet compression.
This layering is where most handshake problems actually surface. A client and server can complete the seed exchange perfectly, then immediately disconnect because one of them expected the legacy cipher and the other switched to Twofish. If you see a session that authenticates and then dies before the character list appears, the encryption negotiation is usually the culprit rather than the credentials.
How the UO Handshake Plays Out in Practice
A normal session starts when the client connects to the login server and the handshake is completed. The client then sends an account login packet, the server validates the credentials, and the client receives a list of available shards along with their addresses. Selecting one of those shards triggers a redirect, and the whole process begins again against a different port.
This two-stage design is a legacy of an era when login servers and world servers were physically separate machines behind different addresses. It survives today in modern emulators because the client still expects it. Any replacement server has to reproduce the redirect or the client will simply sit on the shard list waiting for something that never arrives.
A Typical Login Sequence
Step by step, the flow looks like this: the client opens a connection and the seed exchange completes. The client sends an unencrypted account name and the server responds with the shard list. The client chooses a shard, the server sends a redirect packet containing an address and a new session identifier, and the client drops the login connection in favor of the game connection.
On the game connection, a second handshake runs with fresh seed material, followed by a character list request, character selection, and finally the world login sequence that loads terrain and entities. If you are capturing traffic, the clean split between the login port and the game port is the easiest way to tell which half of the handshake failed.
Common Failure Points and How to Debug Them
The most frequent symptoms are a client that hangs on "connecting," a client that authenticates and then freezes on the shard list, and a client that connects but shows an empty character screen. The first usually means the handshake never completed, often because of a firewall, a mismatched port, or a server that closed the socket before sending its key. The second points at a redirect problem. The third usually means the game-server handshake used different encryption than the login server.
Debugging is best done from both ends. Capture packets on the client side to confirm the seed and key are actually being sent and received, then compare the captured bytes against your server's parser. Check your client version against the encryption mode your server is configured for, and verify that the shard redirect address is reachable from the player's machine rather than from the server's own localhost. Nine times out of ten, the bug is a version mismatch or a hardcoded address.
There is something satisfying about watching a handshake succeed after hours of staring at hex dumps, and that tiny exchange of eight bytes is the reason twenty-five-year-old clients can still walk into a world running on brand-new hardware. If you run a shard, take a few minutes to log a clean handshake from a known-good client and keep those bytes as a reference. The next time a player reports that they cannot connect, that capture will save you far more time than guessing.