示例#1
0
        private static string GetHash(string rootFolder, IEnumerable <string> relativeFilePath)
        {
            if (relativeFilePath == null)
            {
                return(null);
            }
            var files = (from p in relativeFilePath select Path.Combine(rootFolder, p)).ToList();

            using FileCollectionStream reader = new FileCollectionStream(files);
            return(HashUtility.GetSha256HashString(reader));
        }
示例#2
0
        private static string GetMd5(string rootFolder, IEnumerable <string> relativeFilePath)
        {
            if (relativeFilePath == null)
            {
                return(null);
            }
            var files = (from p in relativeFilePath select Path.Combine(rootFolder, p)).ToList();

            MD5 md5 = MD5.Create();

            using FileCollectionStream reader = new FileCollectionStream(files);
            var hash = md5.ComputeHash(reader);

            return(BitConverter.ToString(hash).Replace("-", ""));
        }
示例#3
0
文件: CacheBase.cs 项目: dotnet/docfx
        private static string GetMd5(string rootFolder, IEnumerable<string> relativeFilePath)
        {
            if (relativeFilePath == null) return null;
            var files = (from p in relativeFilePath select Path.Combine(rootFolder, p)).ToList();

            MD5 md5 = MD5.Create();

            using (FileCollectionStream reader = new FileCollectionStream(files))
            {
                var hash = md5.ComputeHash(reader);
                return BitConverter.ToString(hash).Replace("-", "");
            }
        }