Beispiel #1
0
 public Reputation(Bot bot)
     : base(bot)
 {
     BOT_CONTROL_SEQ = Bot.Configuration["Config"].Attributes["ControlSeq"].Value;
     enc=new RijndaelEnhanced(K3Y, IV, 256, 512, 256, "SHA-1", S4LT, 5);
     //Hook Up the Bot event Handlers
     Bot.OnChannelMessage += new IrcEventHandler(Bot_OnChannelMessage);
     Bot.OnQueryMessage += new IrcEventHandler(Bot_OnPrivateMessage);
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            string plainText = "Hello, World!";    // original plaintext
            string cipherText = "";                 // encrypted text
            string passPhrase = "Pas5pr@se";        // can be any string
            string initVector = "@1B2c3D4e5F6g7H8"; // must be 16 bytes

            // Before encrypting data, we will append plain text to a random
            // salt value, which will be between 4 and 8 bytes long (implicitly
            // used defaults).
            RijndaelEnhanced rijndaelKey =
                new RijndaelEnhanced(passPhrase, initVector);

            Console.WriteLine(String.Format("Plaintext   : {0}\n", plainText));

            // Encrypt the same plain text data 10 time (using the same key,
            // initialization vector, etc) and see the resulting cipher text;
            // encrypted values will be different.
            for (int i = 0; i < 10; i++)
            {
                cipherText = rijndaelKey.Encrypt(plainText);
                Console.WriteLine(
                    String.Format("Encrypted #{0}: {1}", i, cipherText));
                plainText = rijndaelKey.Decrypt(cipherText);
            }

            // Make sure we got decryption working correctly.
            Console.WriteLine(String.Format("\nDecrypted   :{0}", plainText));
        }