From 497f7cd518933d855e9c5723d818b7942d5dd1e7 Mon Sep 17 00:00:00 2001 From: Ryley Kimmel Date: Tue, 27 May 2014 02:40:15 +0000 Subject: [PATCH] Update MediaWiki page '317 Protocol' --- 317-Protocol.mediawiki | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/317-Protocol.mediawiki b/317-Protocol.mediawiki index a8d4a69..ac88af0 100644 --- a/317-Protocol.mediawiki +++ b/317-Protocol.mediawiki @@ -13,13 +13,13 @@ Every connection to the main 'gateway' server sends a single byte of data, mostl * New connection login - connection type 16 * Reconnecting login - connection type 18 -The connection type we will cover in the following paragraphs is the login connection type, 14. After the login handshake initiating connection type, the client writes a small bit of data derived from the logging in player's username. This is believed to help select the appropriate login server. On successful handshake, the server sends back 8 ignored bytes. +The connection type we will cover in the following paragraphs is the login connection type, 14. After the login handshake initiating connection type, the client writes hash derived from the logging in player's username. This is believed to help select the appropriate login server. On successful handshake, the server sends back 8 ignored bytes. -
long l = TextUtils.encodeAsBase37Integer(username);
-int i = (int) (l >> 16 & 31L);
+
long encodedUsername = TextUtils.encodeAsBase37Integer(username);
+int usernameHash = (int) (encodedUsername >> 16 & 31L);
 out.offset = 0;
 out.writeByte(14); // Initiate connection type
-out.writeByte(i); // "small bit of data derived from... player's username"
+out.writeByte(usernameHash);
 in.queueBytes(2, out.payload);
 for (int j = 0; j < 8; j++) in.read();