public void Simple() { var r = new MockRandom(); var key = new byte[54]; r.Fill(new ArraySegment <byte>(key)); var de = Default.CreateDecrypt(key); var en = Default.CreateEncrypt(key, r); const int maxSize = 1024 * 1024 * 16; var input = new byte[maxSize]; r.Fill(new ArraySegment <byte>(input)); var out1 = new byte[maxSize]; var out2 = new byte[maxSize]; var tmp = new byte[maxSize]; for (var i = 1; i < maxSize; i = 3 * i + 1) { Console.WriteLine(i); var inas = new ArraySegment <byte>(input, 0, i); var enInfo = en.Analyze(inas); var out1As = new ArraySegment <byte>(out1, 0, enInfo.EncryptedMaxSize); var out2As = new ArraySegment <byte>(out2, 0, enInfo.EncryptedMaxSize); var enCount1 = en.Encrypt(inas, out1As, enInfo); var enCount2 = en.Encrypt(inas, out2As, enInfo); Assert.AreEqual(enCount1, enCount2); Assert.False(AllSame(enCount1, out1, out2)); { var en1As = new ArraySegment <byte>(out1, 0, enCount1); var de1Info = de.Analyze(en1As); var tmpAs = new ArraySegment <byte>(tmp, 0, de1Info.DecryptedMaxSize); var deCount1 = de.Decrypt(en1As, tmpAs, de1Info); Assert.AreEqual(i, deCount1); Assert.True(AllSame(deCount1, input, tmp)); } { var en2As = new ArraySegment <byte>(out2, 0, enCount2); var de2Info = de.Analyze(en2As); var tmpAs = new ArraySegment <byte>(tmp, 0, de2Info.DecryptedMaxSize); var deCount2 = de.Decrypt(en2As, tmpAs, de2Info); Assert.AreEqual(i, deCount2); Assert.True(AllSame(deCount2, input, tmp)); } } }