コード例 #1
0
ファイル: MonteCarloTest2.cs プロジェクト: todoasap/CEX-NET
        private void PerformTest()
        {
            _engine.Init(true, _key);

            byte[] outBytes = new byte[_input.Length];

            Array.Copy(_input, 0, outBytes, 0, outBytes.Length);

            for (int i = 0; i != _iterations; i++)
            {
                _engine.ProcessBlock(outBytes, 0, outBytes, 0);
            }

            if (!outBytes.SequenceEqual(_output))
            {
                throw new Exception("Arrays are not equal!");
            }

            _engine.Init(false, _key);

            for (int i = 0; i != _iterations; i++)
            {
                _engine.ProcessBlock(outBytes, 0, outBytes, 0);
            }

            if (!outBytes.SequenceEqual(_input))
            {
                throw new Exception("Arrays are not equal!");
            }
        }
コード例 #2
0
ファイル: SpeedTest2.cs プロジェクト: modulexcite/CEX
        private byte[] DecryptAesFast(byte[] Key, byte[] Data)
        {
            int blocks = Data.Length / 16;
            byte[] outputData = new byte[Data.Length];

            AesFastEngine transform = new AesFastEngine();
            transform.Init(false, Key);

            for (int i = 0; i < blocks; i++)
                transform.ProcessBlock(Data, i * 16, outputData, i * 16);

            return outputData;
        }
コード例 #3
0
        private byte[] EncryptAesFast(byte[] Key, byte[] Data)
        {
            int blocks = Data.Length / 16;

            byte[] outputData = new byte[Data.Length];

            AesFastEngine transform = new AesFastEngine();

            transform.Init(true, Key);

            for (int i = 0; i < blocks; i++)
            {
                transform.ProcessBlock(Data, i * 16, outputData, i * 16);
            }

            return(outputData);
        }
コード例 #4
0
        /// <summary>
        /// Creates a new instance of the mabi cipher
        /// </summary>
        /// <param name="forEncryption">True if the cipher will be used to encrypt data, false otherwise</param>
        /// <param name="key">The key, in little endian form</param>
        public MabiAesEngine(bool forEncryption, byte[] key)
        {
            _aesEngine = new AesFastEngine();

            _aesEngine.Init(forEncryption, key);
        }
コード例 #5
0
 public SeededGenerator(byte[] key)
 {
     _engine.Init(true, new KeyParameter(key));
     MakeBytes();
 }
コード例 #6
0
ファイル: MabiAesEngine.cs プロジェクト: tkiapril/aura
		/// <summary>
		/// Creates a new instance of the mabi cipher
		/// </summary>
		/// <param name="forEncryption">True if the cipher will be used to encrypt data, false otherwise</param>
		/// <param name="key">The key, in little endian form</param>
		public MabiAesEngine(bool forEncryption, byte[] key)
		{
			_aesEngine = new AesFastEngine();

			_aesEngine.Init(forEncryption, key);
		}