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); }
/** Creates a new instance of StandardDecryption */ public StandardDecryption(byte[] key, int off, int len, int revision) { aes = (revision == AES_128 || revision == AES_256); if (aes) { this.key = new byte[len]; System.Array.Copy(key, off, this.key, 0, len); } else { arcfour = new ARCFOUREncryption(); arcfour.PrepareARCFOURKey(key, off, len); } }
/** 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]; System.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]; System.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); } }