コード例 #1
0
 public PasswordGenerator(IHashingServiceProvider h, IPostHashingProcessor p)
 {
     hashingProvider  = h;
     postProcessor    = p;
     saltingProviders = new List <ISaltingServiceProvider>();
     saltValues       = new List <string>();
 }
コード例 #2
0
ファイル: HashGetter.cs プロジェクト: dioptre/nkd
 public HashGetter(IHashingServiceProvider hashingServiceProvider, HashEncodingType hashEncodingType)
 {
     if (hashEncodingType == null)
     {
         throw new ArgumentNullException("hashEncodingType");
     }
     _hashingServiceProvider = hashingServiceProvider;
     _hashEncodingType = hashEncodingType;
 }
コード例 #3
0
ファイル: HashGetter.cs プロジェクト: shanda506365/MVC-EXTJS
 public HashGetter(IHashingServiceProviderFactory hashingServiceProviderFactory, IHashEncodingTypeFactory hashEncodingTypeFactory)
 {
     if (hashEncodingTypeFactory == null)
     {
         throw new ArgumentNullException("hashEncodingTypeFactory");
     }
     _hashingServiceProvider = hashingServiceProviderFactory.GetProvider();
     _hashEncodingType       = hashEncodingTypeFactory.GetEncodingType();
 }
コード例 #4
0
 public HashGetter(IHashingServiceProvider hashingServiceProvider, HashEncodingType hashEncodingType)
 {
     if (hashEncodingType == null)
     {
         throw new ArgumentNullException("hashEncodingType");
     }
     _hashingServiceProvider = hashingServiceProvider;
     _hashEncodingType       = hashEncodingType;
 }
コード例 #5
0
        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);
        }