Exemple #1
0
        private static HashAlgorithm GetHashAlgorithm(DocumentHashAlgorithm algorithm)
        {
            switch (algorithm)
            {
            case DocumentHashAlgorithm.SHA1:
#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
                return(SHA1.Create());

#pragma warning restore CA5350 // Do Not Use Weak Cryptographic Algorithms
            case DocumentHashAlgorithm.SHA256:
                return(SHA256.Create());

            case DocumentHashAlgorithm.MD5:
#pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms
                return(MD5.Create());

#pragma warning restore CA5351 // Do Not Use Broken Cryptographic Algorithms
            }
            return(null);
        }