public SPMScheme() { fields = new List <SPMSchemeField>(); name = "New Scheme"; description = "No description."; crypto = SPMSchemeCrypto.MD5; timeToHashType = SPMSchemeTimeToHashType.FIXED; timeToHashParam = 1; processType = SPMSchemeProcessType.NO_EFFECT; }
public SPMScheme(SPMScheme o) { fields = new List <SPMSchemeField>(o.fields.Count); foreach (var field in o.fields) { fields.Add(new SPMSchemeField(field)); } name = o.name; description = o.description; crypto = o.crypto; timeToHashType = o.timeToHashType; timeToHashParam = o.timeToHashParam; processType = o.processType; }
public static IPostHashingProcessor GetPostHashingProcessor(SPMSchemeProcessType p) { switch (p) { case SPMSchemeProcessType.NO_EFFECT: return(new NoEffectProcessor()); case SPMSchemeProcessType.MIXED_CASE: return(new MixedCasesProcessor()); case SPMSchemeProcessType.CHARS: return(new HexToCharsProcessor()); default: return(new NoEffectProcessor()); } }
public static PasswordGenerator GetPwdGenerator(SPMScheme scheme, List <string> salts, bool overrideProcess = false, SPMSchemeProcessType process = SPMSchemeProcessType.NO_EFFECT) { if (scheme == null || salts == null || scheme.Fields.Count != salts.Count) { return(null); } PasswordGenerator gen = new PasswordGenerator(GetHashingServiceProvider(scheme.Crypto), GetPostHashingProcessor(overrideProcess ? process : scheme.ProcessType)); for (int i = 0; i < scheme.Fields.Count; ++i) { gen.AddSalt(GetSaltingServiceProvider(scheme.Fields[i].SaltingType), salts[i]); } return(gen); }