public byte[] GenerateVector() { while (true) { rc2.GenerateIV(); if (UTF8Encoding.UTF8.GetString(rc2.IV).IndexOf("'") == -1 && UTF8Encoding.UTF8.GetString(rc2.IV).IndexOf((char)34) == -1) { return(rc2.IV); } } }
public Cryptographer() { this.rc2 = new RC2CryptoServiceProvider(); this.rc2.KeySize = 128; EncryptionKey = GetDefaultKey(); IV = GetDefaultVector(); rc2.GenerateKey(); rc2.Key = EncryptionKey; rc2.GenerateIV(); rc2.IV = IV; }