Exemple #1
0
        private static void Test1()
        {
            byte[] test = Utilities.ScoopBytes(123);
            //
            Type type = typeof(HashAlgorithmHelper);

            PropertyInfo[] properties = type.GetProperties(BindingFlags.Static | BindingFlags.Public);
            foreach (PropertyInfo property in properties)
            {
                if (property.GetValue(type, null) is IHashAlgorithm algorithm)
                {
                    _total++;
                    IDigest digest = algorithm.GenerateDigest();
                    XTest(algorithm.Mechanism, digest, test);
                    _execute++;
                }
            }
            //
            List <string> names = new List <string>();

            names.AddRange(new string[] { "BLAKE2b-88", "SHA-512/368", "SHA512/368", "Skein-256-48" });
            foreach (string name in names)
            {
                _total++;
                _execute++;
                HashAlgorithmHelper.TryGetAlgorithm(name, out IHashAlgorithm algorithm);
                IDigest digest = algorithm.GenerateDigest();
                XTest(algorithm.Mechanism, digest, test);
            }
            Console.WriteLine();
        }