當前位置: 首頁>>代碼示例>>C#>>正文


C# DebugStream.Read方法代碼示例

本文整理匯總了C#中MonoTests.System.Security.Cryptography.DebugStream.Read方法的典型用法代碼示例。如果您正苦於以下問題:C# DebugStream.Read方法的具體用法?C# DebugStream.Read怎麽用?C# DebugStream.Read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MonoTests.System.Security.Cryptography.DebugStream的用法示例。


在下文中一共展示了DebugStream.Read方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: NonMultipleOfBlockSize_Encrypt

		// Adapted from Subba Rao Thirumoorthy email on mono-devel-list (december 2003)
		private byte[] NonMultipleOfBlockSize_Encrypt (ICryptoTransform ct, byte[] data)
		{
			DebugStream stream = new DebugStream ();
			CryptoStream CryptStream = new CryptoStream (stream, ct, CryptoStreamMode.Write);

			int len = 0;
			long myLength = 0;
			byte[] Buffer = new byte [1024];
			
			DebugStream fout = new DebugStream (data);
			while (myLength < data.Length) {
				len = fout.Read (Buffer, 0, 1023);
				if (len == 0)
					break;
				CryptStream.Write (Buffer, 0, len);
				CryptStream.Flush ();
				myLength = myLength + len;
			}
			CryptStream.FlushFinalBlock ();
			// we must ensure that the result is correct
			Assert.AreEqual (64, len, "Length(final)");
			byte[] result = stream.ToArray ();
			string end = BitConverter.ToString (result, 65520, 16);
			Assert.AreEqual ("04-70-19-1D-28-C5-BD-9A-23-C6-60-E2-28-96-38-65", end, "End part");

			CryptStream.Close();
			stream.Close();
			return result;
		}
開發者ID:runefs,項目名稱:Marvin,代碼行數:30,代碼來源:CryptoStreamTest.cs


注:本文中的MonoTests.System.Security.Cryptography.DebugStream.Read方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。