mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
483 B
19 lines
483 B
using System.Globalization; |
|
using System.Security.Cryptography; |
|
using System.Text; |
|
|
|
namespace ErsatzTV.Core; |
|
|
|
public static class PathUtils |
|
{ |
|
public static string GetPathHash(string path) |
|
{ |
|
byte[] bytes = SHA256.HashData(Encoding.UTF8.GetBytes(path)); |
|
var builder = new StringBuilder(); |
|
foreach (byte b in bytes) |
|
{ |
|
builder.Append(b.ToString("x2", CultureInfo.InvariantCulture)); |
|
} |
|
return builder.ToString(); |
|
} |
|
} |