module Cipher

The server sends a random 16-byte challenge:

+--------------+--------------+-------------+
| No. of bytes | Type [Value] | Description |
+--------------+--------------+-------------+
| 16           | U8           | challenge   |
+--------------+--------------+-------------+

The client encrypts the challenge with DES (ECB), using a password supplied by the user as the key. To form the key, the password is truncated to eight characters, or padded with null bytes on the right. Actually, each byte is also reversed. Challenge string is split in two chunks of 8 bytes, which are encrypted separately and clashed together again. The client then sends the resulting 16-byte response:

+--------------+--------------+-------------+
| No. of bytes | Type [Value] | Description |
+--------------+--------------+-------------+
| 16           | U8           | response    |
+--------------+--------------+-------------+

The protocol continues with the SecurityResult message.