Beispiel #1
0
        static AesEncryptorBenchmark()
        {
            ciphertext = new byte[(2048 * 16 + 16) & ~15];
            key        = SymmetricJwk.GenerateKey(128).AsSpan().ToArray();
            nonce      = new byte[] { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 };
            _encryptor = new AesCbcEncryptor(EncryptionAlgorithm.A128CbcHS256);
#if NETCOREAPP3_0
            _encryptorNi = new Aes128CbcEncryptor();
#endif
        }
Beispiel #2
0
        static AesEncryptorBenchmark()
        {
            ciphertext = new byte[(2048 * 16 + 16) & ~15];
            var key = SymmetricJwk.GenerateKey(128);

            nonce      = new byte[] { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 };
            _encryptor = new AesCbcEncryptor(key.K, EncryptionAlgorithm.Aes128CbcHmacSha256);
#if NETCOREAPP3_0
            _encryptorNi = new Aes128NiCbcEncryptor(key.K);
#endif
        }
        static AesDecryptorBenchmark()
        {
            plaintext  = new byte[2048 * 16 + 16];
            key        = SymmetricJwk.GenerateKey(128).AsSpan().ToArray();
            nonce      = new byte[] { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 };
            _encryptor = new AesCbcEncryptor(EncryptionAlgorithm.A128CbcHS256);
            _decryptor = new AesCbcDecryptor(EncryptionAlgorithm.A128CbcHS256);
#if SUPPORT_SIMD
            _decryptorNi = new Aes128CbcDecryptor();
#endif
        }