aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Common/Compute.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-06-16 09:52:51 -0500
committerGitHub <noreply@github.com>2021-06-16 09:52:51 -0500
commitc324b6d2508ecb4d89b155795998e7b76a3d6b96 (patch)
tree53da3ae89ef898df3d5f93ff12f36dd2dc57785c /src/slskd/Common/Compute.cs
parent4cf8f8fa862b08131e9cc51c4bad3d6c9838342b (diff)
parenta9d6798794c7ed7ac89c6d9eccd9bbc1c3d011d6 (diff)
downloadslskd-c324b6d2508ecb4d89b155795998e7b76a3d6b96.tar.gz
Merge pull request #100 from slskd/reorg
Reorganize solution
Diffstat (limited to 'src/slskd/Common/Compute.cs')
-rw-r--r--src/slskd/Common/Compute.cs8
1 files changed, 8 insertions, 0 deletions
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;
/// <summary>
/// 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