Ejemplo n.º 1
0
        public OriginalVsAdjusted()
        {
            // Arrays for outputs
            this.outputForOriginal1 = new byte[dataLength1];
            this.outputForOriginal2 = new byte[dataLength2];
            this.outputForOriginal3 = new byte[dataLength3];

            this.outputForAdjusted1 = new byte[dataLength1];
            this.outputForAdjusted2 = new byte[dataLength2];
            this.outputForAdjusted3 = new byte[dataLength3];

            // Generate inputs
            Random rng = new Random(Seed: 1337);

            this.data1 = new byte[dataLength1];
            rng.NextBytes(this.data1);

            this.data2 = new byte[dataLength2];
            rng.NextBytes(this.data2);

            this.data3 = new byte[dataLength3];
            rng.NextBytes(this.data3);

            // Set encrypters
            this.original1 = new ChaCha20Cipher.ChaCha20Cipher(key, nonce, counter);
            this.original2 = new ChaCha20Cipher.ChaCha20Cipher(key, nonce, counter);
            this.original3 = new ChaCha20Cipher.ChaCha20Cipher(key, nonce, counter);

            this.adjusted1 = new CSChaCha20.ChaCha20(key, nonce, counter);
            this.adjusted2 = new CSChaCha20.ChaCha20(key, nonce, counter);
            this.adjusted3 = new CSChaCha20.ChaCha20(key, nonce, counter);
        }
        public Original_Vs_NS20_Vs_NS21()
        {
            // Arrays for outputs
            this.outputForOriginal1 = new byte[dataLength1];
            this.outputForOriginal2 = new byte[dataLength2];
            this.outputForOriginal3 = new byte[dataLength3];

            this.outputForNS_20_1 = new byte[dataLength1];
            this.outputForNS_20_2 = new byte[dataLength2];
            this.outputForNS_20_3 = new byte[dataLength3];

            this.outputForNS_21_1 = new byte[dataLength1];
            this.outputForNS_21_2 = new byte[dataLength2];
            this.outputForNS_21_3 = new byte[dataLength3];

            // Generate inputs
            Random rng = new Random(Seed: 1337);

            this.data1 = new byte[dataLength1];
            rng.NextBytes(this.data1);

            this.data2 = new byte[dataLength2];
            rng.NextBytes(this.data2);

            this.data3 = new byte[dataLength3];
            rng.NextBytes(this.data3);

            // Set encrypters
            this.original1 = new ChaCha20Cipher.ChaCha20Cipher(key, nonce, counter);
            this.original2 = new ChaCha20Cipher.ChaCha20Cipher(key, nonce, counter);
            this.original3 = new ChaCha20Cipher.ChaCha20Cipher(key, nonce, counter);

            this.ns_20_1 = new CSChaCha20.ChaCha20(key, nonce, counter);
            this.ns_20_2 = new CSChaCha20.ChaCha20(key, nonce, counter);
            this.ns_20_3 = new CSChaCha20.ChaCha20(key, nonce, counter);

            this.ns_21_1 = new CSChaCha20_NS21.ChaCha20(key, nonce, counter);
            this.ns_21_2 = new CSChaCha20_NS21.ChaCha20(key, nonce, counter);
            this.ns_21_3 = new CSChaCha20_NS21.ChaCha20(key, nonce, counter);
        }