Ejemplo n.º 1
0
        /// <summary>
        /// EN: Add a new algorithm to recipe. Note: the best way is to configure recipe from constructor.
        /// </summary>
        /// <param name="hashAlgorithm">EN: Algorithm to add</param>
        public void Add(CryptoHashName hashAlgorithm)
        {
            var newRecipe = new List <ICryptoHash>(this._recipe);

            newRecipe.Add(CryptoHashFactory.Create(hashAlgorithm));
            this._recipe = newRecipe.ToArray();
            ConfigComputing();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// EN: Creates a hash recipe with a list of hash algorithms
        /// </summary>
        /// <param name="recipe">EN: List of hash algorithms</param>
        public HashRecipe(CryptoHashName[] recipe)
        {
            if (recipe == null || recipe.Length < 1)
            {
                throw new ArgumentException();
            }

            this._recipe = new ICryptoHash[recipe.Length];
            for (int h = 0; h < recipe.Length; h++)
            {
                this._recipe[h] = CryptoHashFactory.Create(recipe[h]);
            }
            ConfigComputing();
        }