internal KeyValuePair <string, string> CreateHash(HashVersionOne v1Hash)
        {
            if (v1Hash == null)
            {
                return(new KeyValuePair <string, string>());
            }

            if (!Utilities.AlgorithmKindNameMap.TryGetValue(v1Hash.Algorithm, out string algorithm))
            {
                algorithm = v1Hash.Algorithm.ToString().ToLowerInvariant();
            }

            return(new KeyValuePair <string, string>(algorithm, v1Hash.Value));
        }
        internal Hash CreateHash(HashVersionOne v1Hash)
        {
            Hash hash = null;

            if (v1Hash != null)
            {
                string algorithm;
                if (!Utilities.AlgorithmKindNameMap.TryGetValue(v1Hash.Algorithm, out algorithm))
                {
                    algorithm = v1Hash.Algorithm.ToString().ToLowerInvariant();
                }

                hash = new Hash
                {
                    Algorithm = algorithm,
                    Value     = v1Hash.Value
                };
            }

            return(hash);
        }
Esempio n. 3
0
        internal HashVersionOne CreateHash(Hash v2Hash)
        {
            HashVersionOne hash = null;

            if (v2Hash != null)
            {
                AlgorithmKindVersionOne algorithm;
                if (!Utilities.AlgorithmNameKindMap.TryGetValue(v2Hash.Algorithm, out algorithm))
                {
                    algorithm = AlgorithmKindVersionOne.Unknown;
                }

                hash = new HashVersionOne
                {
                    Algorithm = algorithm,
                    Value     = v2Hash.Value
                };
            }

            return(hash);
        }