public PasswordGenerator(IHashingServiceProvider h, IPostHashingProcessor p) { hashingProvider = h; postProcessor = p; saltingProviders = new List <ISaltingServiceProvider>(); saltValues = new List <string>(); }
public HashGetter(IHashingServiceProvider hashingServiceProvider, HashEncodingType hashEncodingType) { if (hashEncodingType == null) { throw new ArgumentNullException("hashEncodingType"); } _hashingServiceProvider = hashingServiceProvider; _hashEncodingType = hashEncodingType; }
public HashGetter(IHashingServiceProviderFactory hashingServiceProviderFactory, IHashEncodingTypeFactory hashEncodingTypeFactory) { if (hashEncodingTypeFactory == null) { throw new ArgumentNullException("hashEncodingTypeFactory"); } _hashingServiceProvider = hashingServiceProviderFactory.GetProvider(); _hashEncodingType = hashEncodingTypeFactory.GetEncodingType(); }
public IHashingServiceProvider RegisterHashingProviderImplementer() { Type hashingServiceProviderType = typeof(IHashingServiceProvider); IEnumerable <Type> hashingServiceProviderImplementers = AppDomain.CurrentDomain.GetAssemblies().SelectMany(s => s.GetTypes()) .Where(p => !p.IsAbstract && p.IsClass && hashingServiceProviderType.IsAssignableFrom(p)); HashingAlgorithm hashingAlgorithmToUse = HashingAlgorithm.FromName(_configSettings.HashAlgorithm); IHashingServiceProvider instance = hashingServiceProviderImplementers .Select(Activator.CreateInstance).OfType <IHashingServiceProvider>() .Where(instanceOfType => hashingAlgorithmToUse == instanceOfType.HashingAlgorithm) .FirstOrDefault(); if (instance == null) { throw new Exception(string.Format("Could not find implementation for the HashingAlgorithm {0}.", hashingAlgorithmToUse)); } return(instance); }