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!"); } }
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; }
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); }
/// <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); }
public SeededGenerator(byte[] key) { _engine.Init(true, new KeyParameter(key)); MakeBytes(); }