public void Encrypt(ICryptoTransform crypto) { if (crypto == null) { throw new ArgumentNullException("crypto"); } long instanceId; if (crypto.Encrypt(this.Bytes, out instanceId)) { this.InstanceId = instanceId; } }
/// <summary> /// AES加密 /// </summary> /// <param name="clearText">明文</param> /// <returns></returns> public string Encrypt(string clearText) { ICryptoTransform encryptor = Aes.CreateEncryptor(); return(encryptor.Encrypt(clearText)); }