http://www.iris2.de/index.php?title=Encryption&feed=atom&action=historyEncryption - Revision history2024-03-29T11:43:48ZRevision history for this page on the wikiMediaWiki 1.15.1http://www.iris2.de/index.php?title=Encryption&diff=346&oldid=prevSiENcE: /* Ultima Online Protocol */2009-12-09T10:03:51Z<p><span class="autocomment">Ultima Online Protocol</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 10:03, 9 December 2009</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>= Ultima Online Protocol=</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>= Ultima Online Protocol=</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Backup from: <del class="diffchange diffchange-inline">Keirs packet guide (</del>[www.kairtech.com/uo/info/encryption.htm]<del class="diffchange diffchange-inline">)</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Backup from: [<ins class="diffchange diffchange-inline">http://</ins>www.kairtech.com/uo/info/encryption.htm <ins class="diffchange diffchange-inline">Keirs packet guide</ins>]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Loginserver Packet Encryption ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Loginserver Packet Encryption ==</div></td></tr>
<!-- diff generator: internal 2024-03-29 11:43:48 -->
</table>SiENcEhttp://www.iris2.de/index.php?title=Encryption&diff=345&oldid=prevSiENcE: /* Ultima Online Protocol */2009-12-09T10:03:09Z<p><span class="autocomment">Ultima Online Protocol</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 10:03, 9 December 2009</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>= Ultima Online Protocol=</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>= Ultima Online Protocol=</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Backup from: Keirs packet guide (www.kairtech.com/uo/info/encryption.htm)</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Backup from: Keirs packet guide (<ins class="diffchange diffchange-inline">[</ins>www.kairtech.com/uo/info/encryption.htm<ins class="diffchange diffchange-inline">]</ins>)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Loginserver Packet Encryption ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Loginserver Packet Encryption ==</div></td></tr>
<!-- diff generator: internal 2024-03-29 11:43:48 -->
</table>SiENcEhttp://www.iris2.de/index.php?title=Encryption&diff=344&oldid=prevSiENcE at 10:02, 9 December 20092009-12-09T10:02:59Z<p></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 10:02, 9 December 2009</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>= Ultima Online Protocol=</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>= Ultima Online Protocol=</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Backup from: Keirs packet guide (www.kairtech.com/uo/info/encryption.htm)</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Loginserver Packet Encryption ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Loginserver Packet Encryption ==</div></td></tr>
<!-- diff generator: internal 2024-03-29 11:43:48 -->
</table>SiENcEhttp://www.iris2.de/index.php?title=Encryption&diff=343&oldid=prevSiENcE: Created page with '= Ultima Online Protocol= == Loginserver Packet Encryption == Ultima Online packets are encrypted in two ways: the first, during the login process; the second, during regular …'2009-12-09T10:02:21Z<p>Created page with '= Ultima Online Protocol= == Loginserver Packet Encryption == Ultima Online packets are encrypted in two ways: the first, during the login process; the second, during regular …'</p>
<p><b>New page</b></p><div>= Ultima Online Protocol=<br />
<br />
== Loginserver Packet Encryption ==<br />
<br />
<br />
Ultima Online packets are encrypted in two ways: the first, during the login process; the second, during regular gameplay.<br />
<br />
<br />
The first encryption method is a simple algorithm which (I assume) was developed by Origin. The login encryption requires an encryption seed and two keys which can be found in the client and change now and then with client patches. Each client also needs a pair of keys which are initialized using the formula below:<br />
<br />
<pre><br />
uint CurrentKey0;<br />
uint CurrentKey1;<br />
uint EncryptionSeed;<br />
<br />
// Set EncryptionSeed<br />
<br />
CurrentKey0 = (uint)((((~EncryptionSeed) ^ 0x00001357) << 16) | ((EncryptionSeed ^ 0xFFFFAAAA) & 0x0000FFFF));<br />
CurrentKey1 = (uint)(((EncryptionSeed ^ 0x43210000) >> 16) | (((~EncryptionSeed) ^ 0xABCDFFFF) & 0xFFFF0000));<br />
</pre> <br />
<br />
After receiving data from a client, you can decrypt or encrypt it using the following method:<br />
<pre><br />
static uint FirstClientKey; // Set this to the first client key (not CurrentKey0).<br />
static uint SecondClientKey; // Set this to the second client key (not CurrentKey1).<br />
<br />
void Crypt(ref byte[] data)<br />
{<br />
int len = data.Length;<br />
for(int i = 0; i < len; i++)<br />
{<br />
// Decrypt the byte:<br />
data[i] = (byte)(CurrentKey0 ^ data[i]);<br />
<br />
// Reset the keys:<br />
uint oldkey0 = CurrentKey0;<br />
uint oldkey1 = CurrentKey1;<br />
CurrentKey0 = (uint)(((oldkey0 >> 1) | (oldkey1 << 31)) ^ SecondClientKey);<br />
CurrentKey1 = (uint)(((((oldkey1 >> 1) | (oldkey0 << 31)) ^ (FirstClientKey - 1)) >> 1) | (oldkey0 << 31)) ^ FirstClientKey);<br />
}<br />
}<br />
</pre> <br />
<br />
FirstClientKey and SecondClientKey refer to the two encryption keys found within the client. The location and values of these keys change from time to time. In Athena, known client keys are kept in the key configuration file. The 4.0.2a client keys are 0x2E63ADDD and 0xA225227F.<br />
<br />
<br />
== Gameserver Packet Encryption ==<br />
<br />
The second encryption method is used after the client is redirected to a game server via the 0x8C packet and is usually used first with the game server login packet, 0x91. The second encryption is a bit more complex and uses the TwoFish encryption method in modern clients, and the BlowFish encryption method in old clients. Since most emulators require modern clients, the BlowFish method will not be discussed here.<br />
<br />
<br />
The second method of encryption is not currently supported by Athena. Supporting gameplay encryption is one of the long-term goals of Athena, and when a method is created for decrypting this encryption it will hopefully be detailed here.</div>SiENcE