/// <summary> /// 用户登录验证 /// </summary> /// <returns></returns> public bool UserLoginValidation() { try { return(lbll.userLoginValidation(LoginAttribute.UserID, eahm.Encrypt(LoginAttribute.UserPassword))); } catch { throw; } }
public string Encrypt(string toEncrypt) { if (toEncrypt == null) { throw new ArgumentNullException("toEncrypt"); } if (!regex.IsMatch(toEncrypt)) { throw new ArgumentException("String is not alphanumeric"); } // Obviously pseudocode // Replace this line with a call to AES, 3DES, Twofish, Caesar Cipher, or whatever encryption algorithm you want return(EncryptionAlgorithm.Encrypt(toEncrypt, whateverKey)); }
public string Encrypt(string toEncrypt) { if (toEncrypt == null) { throw new ArgumentNullException("toEncrypt"); } // This check is very important // If toEncrypt contains non-alphanumeric characters, is an empty string, or consists only of whitespace don't accept it if (!regex.IsMatch(toEncrypt)) { throw new ArgumentException("String is not alphanumeric"); } // Obviously pseudocode // Replace this line with a call to AES, 3DES, Twofish, Caesar Cipher, or whatever encryption algorithm you want return(EncryptionAlgorithm.Encrypt(toEncrypt, whateverKey)); }