Welcome to mirror list, hosted at ThFree Co, Russian Federation.

StaticObjects.cs « Objects « UVtools.Core - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5f4dbf4ece752c0618662a6e62d5576289079c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.IO;
using System.Security.Cryptography;

namespace UVtools.Core.Objects
{
    public static class StaticObjects
    {
        public static readonly SHA256 Sha256 = SHA256.Create();

        public static readonly string[] LineBreakCharacters = {"\r\n", "\r", "\n"};

        // Compute the file's hash.
        public static byte[] GetHashSha256(string filename)
        {
            using (var stream = File.OpenRead(filename))
            {
                return Sha256.ComputeHash(stream);
            }
        }
    }
}