コード例 #1
0
        private HashAlgorithm[] ConvertToHashAlgorithmArray(string hashAlgorithmsCsv)
        {
            pfPGPHashAlgorithm[] hashAlgorithms = null;

            if (String.IsNullOrEmpty(hashAlgorithmsCsv))
            {
                hashAlgorithms    = new pfPGPHashAlgorithm[1];
                hashAlgorithms[0] = pfPGPHashAlgorithm.SHA1;
                return(ConvertToHashAlgorithmArray(hashAlgorithms));
            }

            string[] sHashAlgorithms = hashAlgorithmsCsv.Split(',');
            hashAlgorithms = new pfPGPHashAlgorithm[sHashAlgorithms.Length];
            for (int i = 0; i < sHashAlgorithms.Length; i++)
            {
                hashAlgorithms[i] = ToHashAlgorithm(sHashAlgorithms[i]);
            }


            return(ConvertToHashAlgorithmArray(hashAlgorithms));
        }
コード例 #2
0
        /// <summary>
        /// Converts text name of algorithm to a pfPGPHashAlgorithm object.
        /// </summary>
        /// <param name="hashDescription">Text of algorithm name.</param>
        /// <returns>pfPGPHashAlgorithm object corresponding to algorithm name.</returns>
        public pfPGPHashAlgorithm ToHashAlgorithm(string hashDescription)
        {
            pfPGPHashAlgorithm alg = (pfPGPHashAlgorithm)Enum.Parse(typeof(pfPGPHashAlgorithm), hashDescription);

            return(alg);
        }