diff options
| author | JP Dillingham <jp@dillingham.me> | 2023-01-02 13:59:41 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-02 13:59:41 -0600 |
| commit | 23c9d2fda9125f8bc0b35810521f2d53eead6be6 (patch) | |
| tree | 8fc15093a36672e77dfa4910bd7beb28d63d7b28 /src/slskd/Common | |
| parent | bf65e2c278d3362f46a5aea3d1beedfe2488c718 (diff) | |
| parent | 7832e867ee393dd8e00ff3c3c83e272185597d7d (diff) | |
| download | slskd-23c9d2fda9125f8bc0b35810521f2d53eead6be6.tar.gz | |
Merge pull request #820 from slskd/mutex
Refactor single-instance mutex to use a more specific handle
Diffstat (limited to 'src/slskd/Common')
| -rw-r--r-- | src/slskd/Common/Compute.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/slskd/Common/Compute.cs b/src/slskd/Common/Compute.cs index b9dc882a..befceb88 100644 --- a/src/slskd/Common/Compute.cs +++ b/src/slskd/Common/Compute.cs @@ -20,7 +20,6 @@ namespace slskd using System; using System.Security.Cryptography; using System.Text; - using System.Text.RegularExpressions; /// <summary> /// Computational functions. @@ -44,5 +43,11 @@ namespace slskd using var sha1 = SHA1.Create(); return BitConverter.ToString(sha1.ComputeHash(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty); } + + public static string Sha256Hash(string str) + { + using var sha256 = SHA256.Create(); + return BitConverter.ToString(sha256.ComputeHash(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty); + } } }
\ No newline at end of file |
