Simplified some names

This commit is contained in:
Alexander 2018-12-28 12:57:35 +02:00
parent 947aba84ee
commit c257ef5a6e

View file

@ -13,31 +13,31 @@ class EncryptedString
public EncryptedString(string String) public EncryptedString(string String)
{ {
this.des.GenerateIV(); des.GenerateIV();
this.des.GenerateKey(); des.GenerateKey();
this.Set(String); Set(String);
} }
public EncryptedString() public EncryptedString()
{ {
this.des.GenerateIV(); des.GenerateIV();
this.des.GenerateKey(); des.GenerateKey();
} }
public string Get() public string Get()
{ {
if (this.encryptedString == null) return null; if (encryptedString == null) return null;
var decryptor = this.des.CreateDecryptor(); var decryptor = des.CreateDecryptor();
byte[] output = decryptor.TransformFinalBlock(this.encryptedString, 0, this.encryptedString.Length); byte[] output = decryptor.TransformFinalBlock(encryptedString, 0, encryptedString.Length);
return Encoding.Default.GetString(output); return Encoding.Default.GetString(output);
} }
public void Set(string String) public void Set(string String)
{ {
if (String == null) { this.encryptedString = null; return; } if (String == null) { encryptedString = null; return; }
var encryptor = this.des.CreateEncryptor(); var encryptor = des.CreateEncryptor();
byte[] str = Encoding.Default.GetBytes(String); byte[] str = Encoding.Default.GetBytes(String);
this.encryptedString = encryptor.TransformFinalBlock(str, 0, str.Length); encryptedString = encryptor.TransformFinalBlock(str, 0, str.Length);
} }
} }
} }