From 050be311e68bb316cfc40fbd23bfd5a812e1a060 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 14 Jun 2021 20:03:36 -0500 Subject: move stuff around --- src/slskd/Common/Compute.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/slskd/Common/Compute.cs') diff --git a/src/slskd/Common/Compute.cs b/src/slskd/Common/Compute.cs index 172de252..3d913d27 100644 --- a/src/slskd/Common/Compute.cs +++ b/src/slskd/Common/Compute.cs @@ -18,6 +18,8 @@ namespace slskd { using System; + using System.Security.Cryptography; + using System.Text; /// /// Computational functions. @@ -35,5 +37,11 @@ namespace slskd return (clampedDelay, jitter); } + + public static string Sha1Hash(string str) + { + using var sha1 = new SHA1Managed(); + return BitConverter.ToString(sha1.ComputeHash(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty); + } } } \ No newline at end of file -- cgit v1.2.3