Beispiel #1
0
        /// <summary>
        /// Extracts the hash iterations from the salt.
        /// </summary>
        /// <exception cref="FormatException">Salt has not the format {int}.{string}</exception>
        private void ExtractHashIterationAndHmac()
        {
            try
            {
                var content = Salt.Split('.');


                //Get the hash iteration from the first index
                HashIterations = int.Parse(content[1], System.Globalization.NumberStyles.Number);
                HashAlgorithm  = new HashAlgorithmName(content[0]);
            }
            catch (Exception)
            {
                throw new FormatException("The salt was not in an expected format of {string}.{int}.{string}");
            }
        }