/// <summary> /// Constructor. /// </summary> /// <param name="hashingProcessor">the hashing processor to use</param> /// <param name="postHashingProcessor">the post hashing processor to use</param> public HashingPasswordGenerator(IHashingProcessor hashingProcessor, IPostHashingProcessor postHashingProcessor) { this.saltProcessors = new List <ISaltProcessor>(); this.hashingProcessor = hashingProcessor; this.postHashingProcessor = postHashingProcessor; this.totalHashingTimes = 1; }
/// <summary> /// Initializes a new instance of the <see cref="HashTree{T}" /> class. /// </summary> /// <param name="hashingProcessor"> /// A processor that produces hash values. /// </param> /// <param name="algorithm"> /// The algorithm used to produce hash values. The default value is <see cref="HashingAlgorithmSpecification.ShaTwo256" />. /// </param> /// <param name="blocks"> /// An ordered collection of data block objects underlying the tree. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="hashingProcessor" /> is <see langword="null" /> -or- <paramref name="blocks" /> is /// <see langword="null" />. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="algorithm" /> is equal to <see cref="HashingAlgorithmSpecification.Unspecified" />. /// </exception> /// <exception cref="SecurityException"> /// An exception was raised during hashing or serialization. /// </exception> public HashTree(IHashingProcessor <TBlock> hashingProcessor, HashingAlgorithmSpecification algorithm, IEnumerable <TBlock> blocks) : base() { Algorithm = algorithm.RejectIf().IsEqualToValue(HashingAlgorithmSpecification.Unspecified, nameof(algorithm)); HashingProcessor = hashingProcessor.RejectIf().IsNull(nameof(hashingProcessor)).TargetArgument; LeafNodes = new List <HashTreeNode>(); RootNode = new HashTreeNode(); AddBlockRange(blocks); }
/// <summary> /// Initializes a new instance of the <see cref="CryptographyService"/> class /// </summary> public CryptographyService(ICryptographyProcessorFactory processorFactory) { if (processorFactory == null) { throw new ArgumentNullException(nameof(processorFactory)); } _encryptionProcessor = processorFactory.GetEncryptionProcessor(); _hashingProcessor = processorFactory.GetHashingProcessor(); }
/// <summary> /// Initializes a new instance of the <see cref="HashTree{T}" /> class. /// </summary> /// <param name="hashingProcessor"> /// A processor that produces hash values. /// </param> /// <param name="algorithm"> /// The algorithm used to produce hash values. The default value is <see cref="HashingAlgorithmSpecification.ShaTwo256" />. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="hashingProcessor" /> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="algorithm" /> is equal to <see cref="HashingAlgorithmSpecification.Unspecified" />. /// </exception> public HashTree(IHashingProcessor <TBlock> hashingProcessor, HashingAlgorithmSpecification algorithm) : this(hashingProcessor, algorithm, Array.Empty <TBlock>()) { return; }
/// <summary> /// Initializes a new instance of the <see cref="HashTree{T}" /> class. /// </summary> /// <param name="hashingProcessor"> /// A processor that produces hash values. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="hashingProcessor" /> is <see langword="null" />. /// </exception> public HashTree(IHashingProcessor <TBlock> hashingProcessor) : this(hashingProcessor, DefaultAlgorithm) { return; }