QuickImage – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using System; |
2 | using System.Collections.Generic; |
||
3 | using System.IO; |
||
4 | using System.Linq; |
||
5 | using System.Security.Cryptography; |
||
6 | using System.Text; |
||
7 | using System.Threading.Tasks; |
||
8 | |||
9 | namespace QuickImage.Utilities.Cryptography |
||
10 | { |
||
11 | public static class Hashes |
||
12 | { |
||
13 | public static string MD5Hash(string fileName) |
||
14 | { |
||
15 | using var md5 = MD5.Create(); |
||
16 | |||
17 | using var stream = File.OpenRead(fileName); |
||
18 | |||
19 | var stringBuilder = new StringBuilder(); |
||
20 | foreach (var @byte in md5.ComputeHash(stream)) |
||
21 | { |
||
22 | stringBuilder.Append(@byte.ToString("x2")); |
||
23 | } |
||
24 | |||
25 | return stringBuilder.ToString(); |
||
26 | } |
||
27 | } |
||
28 | } |