Пример #1
0
 static IVGenerator()
 {
     rc4 = new ARCFOUREncryption();
     byte[] longBytes = new byte[8];
     long val = DateTime.Now.Ticks;
     for (int i = 0; i != 8; i++) {
         longBytes[i] = (byte)val;
         val = (long)((ulong)val >> 8);
     }
     rc4.PrepareARCFOURKey(longBytes);
 }
Пример #2
0
        static IVGenerator()
        {
            rc4 = new ARCFOUREncryption();
            byte[] longBytes = new byte[8];
            long   val       = DateTime.Now.Ticks;

            for (int i = 0; i != 8; i++)
            {
                longBytes[i] = (byte)val;
                val          = (long)((ulong)val >> 8);
            }
            rc4.PrepareARCFOURKey(longBytes);
        }
Пример #3
0
 /** Creates a new instance of StandardDecryption */
 public StandardDecryption(byte[] key, int off, int len, int revision)
 {
     aes = revision == AES_128;
     if (aes)
     {
         this.key = new byte[len];
         Array.Copy(key, off, this.key, 0, len);
     }
     else
     {
         arcfour = new ARCFOUREncryption();
         arcfour.PrepareARCFOURKey(key, off, len);
     }
 }
 public OutputStreamEncryption(Stream outc, byte[] key, int off, int len, int revision)
 {
     this.outc = outc;
     aes = revision == AES_128;
     if (aes) {
         byte[] iv = IVGenerator.GetIV();
         byte[] nkey = new byte[len];
         Array.Copy(key, off, nkey, 0, len);
         cipher = new AESCipher(true, nkey, iv);
         Write(iv, 0, iv.Length);
     }
     else {
         arcfour = new ARCFOUREncryption();
         arcfour.PrepareARCFOURKey(key, off, len);
     }
 }