示例#1
0
 public string EncryptString(string unencryptedString, DataStorageFormat format = DataStorageFormat.Base64)
 {
     byte[] encrytedByteArray = m_rsa.Encrypt(Encoding.UTF8.GetBytes(unencryptedString), false);
     return(format == DataStorageFormat.Base64 ? Convert.ToBase64String(encrytedByteArray) : Base32.ToBase32String(encrytedByteArray));
 }
示例#2
0
 public string DecryptString(string encryptedString, DataStorageFormat format = DataStorageFormat.Base64)
 {
     byte[] encrytpedByteArray = format == DataStorageFormat.Base64 ? Convert.FromBase64String(encryptedString) : Base32.FromBase32String(encryptedString);
     byte[] byteArray          = m_rsa.Decrypt(encrytpedByteArray, false);
     return(Encoding.UTF8.GetString(byteArray));
 }
示例#3
0
 public string ComputeHash(string filename)
 {
     byte[] allBytes = File.ReadAllBytes(filename);
     return(Base32.ToBase32String(SHA256.Create().ComputeHash(allBytes)));
 }