如何獲得RSA加密進度?我想在進度條上顯示它。 感謝您的幫助。C# - 獲取RSA加密進度
using System.Security.Cryptography;
RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(4096);
//I want to get percentage process of this function, because it takes a lot of time.
byte[] encrypted = RSA.Encrypt(Encoding.Default.GetBytes("some text", true));
通過將總字節數保存在一個變量中,並將當前字節數保存在另一個變量中進行加密。閱讀[問],顯示你的代碼並解釋你所嘗試的。 – CodeCaster
您不能,該方法不報告進度。如果可能的話,你唯一的選擇是用較小的塊調用該方法或類似的方法,以更新兩者之間的進度。 –
**但是,您通常不會使用RSA加密來加密大型二進制文件。相反,您生成一個隨機密鑰並使用更快的加密方法,如RIJNDAEL,只用RSA加密密鑰。 –