public void GlobalSetup()
        {
            this.data = new byte[this.DataLengthKb * 1024];
            new Random(31).NextBytes(data);
            this.key   = XChaChaKey.Generate();
            this.nonce = XChaChaNonce.Generate();
            var aeadCipher = new XChaChaAeadCipher();

            this.encryptedData       = new byte[aeadCipher.GetCipherTextLength(this.data.Length)];
            this.decryptOutputBuffer = new byte[aeadCipher.GetCipherTextLength(this.data.Length)];
            aeadCipher.Encrypt(data, this.encryptedData, this.key, this.nonce);
        }
示例#2
0
        public void Test_GenerateNonce_GeneratesNonceOfTheCorrectLength()
        {
            var nonce = XChaChaNonce.Generate();

            Assert.Equal(NonceLength, nonce.ReadOnlySpan.Length);
        }