public string GeneratePass(PasswordOptions options) { StringBuilder passBuilder = new StringBuilder(); passBuilder.Append(GeneratePassWithSymbols(options.Symbols, options.Ambiguous)); passBuilder.Append(GeneratePassWithinLimits(options.UpperCase, 'A', 'Z' + 1, options.Similar)); passBuilder.Append(GeneratePassWithinLimits(options.Numbers, '0', '9' + 1, options.Similar)); passBuilder.Append(GeneratePassWithinLimits(options.Length - passBuilder.Length, 'a', 'z' + 1, options.Similar)); return ShuffleString(passBuilder.ToString()); }
public string Get(int length, int upper, int number, int symbols, bool similar, bool ambiguous) { var options = new PasswordOptions { Length = length, UpperCase = upper, Numbers = number, Symbols = symbols, Similar = similar, Ambiguous = ambiguous, }; var passwordGenerator = new PasswordGenerator(); var result = passwordGenerator.GeneratePass(options); return result; }