Example #1
0
        private byte[] _keyBuffer;  // The key buffer, used in encryption and decryption.

        /// <summary>
        /// This cipher is used in the Account Server to decrypt the output of the decryption method for Rivest
        /// Cipher 5. The algorithm uses the account name for the player as a key for generating the key vector.
        /// This is the last cipher required for decrypting the player's password. The cipher algorithm does not
        /// work with num keys. Do not attempt to fix unless your players cannot have special symbols in their
        /// passwords.
        /// </summary>
        /// <param name="account">The player's account name.</param>
        public NetDragonPasswordCipher(string account)
        {
            // Generate the seed for the key generator:
            int seed = 0;

            foreach (byte character in account)
            {
                seed += character;
            }
            GenerateKeys(SeedGenerator.Generate(seed));
        }
 /// <summary>
 /// RC5 is a block cipher notable for its simplicity. Designed by Ronald Rivest in 1994, RC stands for "Rivest
 /// Cipher". A key feature of RC5 is the use of data-dependent rotations; one of the goals of RC5 was to prompt
 /// the study and evaluation of such operations as a cryptographic primitive. 12-round RC5 (with 64-bit blocks)
 /// is susceptible to a differential attack using 2^44 chosen plaintexts. NetDragon Websoft uses 12-round RC5
 /// for their password cipher.
 /// </summary>
 /// <param name="seed">The seed sent to the client in packet 1060 (if patch 5174 and above).</param>
 public RivestCipher5(int seed)
 {
     GenerateKeys(SeedGenerator.Generate(seed));
 }