public static bool VerifyPassword(string accountName, string inputPassword, string userInfoPassword, UserRegistType userRegistType) { #if DEBUG return(userInfoPassword.Equals(AppUtils.EncryptPassword(accountName, inputPassword, userRegistType))); #else // 生产环境中前端需要进行一次 SHA256(inputAccountName.ToLower() + inputPassword) return(Utils.EncryptSHA256(inputPassword + accountName.ToLower() + userRegistType.ToString().ToLower()) .Equals(userInfoPassword)); #endif }
public static string EncryptPassword(string inputAccountName, string inputPassword, UserRegistType regiserType) { string firstEncryptStr = inputAccountName.ToLower() + inputPassword; string secondEncryptStr = Utils.EncryptSHA256(firstEncryptStr) + inputAccountName.ToLower() + regiserType.ToString().ToLower(); return(Utils.EncryptSHA256(secondEncryptStr)); }