Exemplo n.º 1
0
        private static void AssertWikipediaVector(string key, string plainText, params byte[] expected)
        {
            byte[] keyBytes        = Encoding.ASCII.GetBytes(key);
            byte[] result          = Encoding.ASCII.GetBytes(plainText);
            var    arc4            = new Arc4(keyBytes);
            var    encryptedResult = arc4.Encrypt(result);

            CollectionAssert.AreEqual(expected, encryptedResult);
        }
Exemplo n.º 2
0
        private static void AssertWikipediaVector(string key, string plainText, params byte[] expected)
        {
            byte[] keyBytes = Encoding.ASCII.GetBytes(key);
            byte[] result = Encoding.ASCII.GetBytes(plainText);
            var arc4 = new Arc4(keyBytes);
            var encryptedResult = arc4.Encrypt(result);

            CollectionAssert.AreEqual(expected, encryptedResult);
        }
Exemplo n.º 3
0
 public void Dispose()
 {
     if (GetHabbo() != null)
     {
         GetHabbo().OnDisconnect();
     }
     MachineId     = string.Empty;
     _disconnected = true;
     _habbo        = null;
     _connection   = null;
     Rc4Client     = null;
     _packetParser = null;
 }
Exemplo n.º 4
0
        public SeedRandom(string seed)
        {
            var key  = new byte[seed.Length];
            var pool = new byte[Width];

            MixKey(seed, ref key);

            var arc4 = new Arc4(key);

            _prng = new Prng(arc4);

            MixKey(System.Text.Encoding.Default.GetString(arc4.GetSeed()), ref pool);
        }
Exemplo n.º 5
0
 public Prng(Arc4 arc4)
 {
     _arc4 = arc4;
 }