0
錯誤CS0236一個字段初始不能引用非靜態字段,方法或屬性錯誤在我的解密/加密器錯誤CS0236
而且我一直在試圖修復它,但我就是」牛逼 這是我正在做
string hash = (materialSingleLineTextField4.Text);
private void materialRaisedButton1_Click(object sender, EventArgs e)
{
//Encrypt Function
byte[] data = UTF8Encoding.UTF8.GetBytes(materialSingleLineTextField1.Text);
using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
{
byte[] keys = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
using (TripleDESCryptoServiceProvider tripDes = new TripleDESCryptoServiceProvider() { Key = keys, Mode = CipherMode.ECB, Padding = PaddingMode.PKCS7 })
{
ICryptoTransform transform = tripDes.CreateEncryptor();
byte[] results = transform.TransformFinalBlock(data, 0, data.Length);
materialSingleLineTextField2.Text = Convert.ToBase64String(results, 0, results.Length);
}
}
}
我的錯誤的加密/解密程序在這裏string hash = (materialSingleLineTextField4.Text);
第1行,並以紅色 強調materialSingleLineTestField4
有人可以幫我嗎?我有difficulites謝謝c;
或構造函數:) – niceman
@niceman:好點,我已經更新了答案。我一直認爲這兩者足夠相似,但它確實是一個重要的區別。 – David
謝謝c;這對我來說真的很有幫助 – SniperX