Esempio n. 1
0
 protected void Initialize(string key, int n)
 {
     RandomNumberGenerator.Create().GetBytes(iv);
     generator = new Arcfour(Encoding.ASCII.GetBytes(key).Concat(iv).ToArray(), n);
 }
Esempio n. 2
0
        public void Initialize(string key, int n)
        {
            byte[] iv = new byte[10];

            int pos = 0;
            while (pos != 10)
            {
                int len = baseStream.Read(iv, pos, 10 - pos);
                if (len == 0)
                    throw new IOException("Stream closed during initalization");

                pos += len;
            }

            generator = new Arcfour(Encoding.ASCII.GetBytes(key).Concat(iv).ToArray(), n);
        }