diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2022-06-25 19:10:27 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2022-06-25 19:10:27 -0500 |
| commit | a8deb4361362ed01c930447dcfa92a9b756d03c0 (patch) | |
| tree | b29508c1d3ba35a7f8b664984ee628b0e466ef5c /src/slskd/Common/Compute.cs | |
| parent | 037c6b2bbb37442fb09eb5163ecfe84f2adb3fa9 (diff) | |
| download | slskd-a8deb4361362ed01c930447dcfa92a9b756d03c0.tar.gz | |
move some things into Core
Diffstat (limited to 'src/slskd/Common/Compute.cs')
| -rw-r--r-- | src/slskd/Common/Compute.cs | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/slskd/Common/Compute.cs b/src/slskd/Common/Compute.cs index eacaedf1..b9dc882a 100644 --- a/src/slskd/Common/Compute.cs +++ b/src/slskd/Common/Compute.cs @@ -44,22 +44,5 @@ namespace slskd using var sha1 = SHA1.Create(); return BitConverter.ToString(sha1.ComputeHash(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty); } - - public static string MaskHash(string str) - { - var hash = Sha1Hash(str); - hash = Convert.ToBase64String(Encoding.UTF8.GetBytes(hash)); - hash = Regex.Replace(hash, @"[\d=]", string.Empty).ToLowerInvariant(); - - // in some very unlucky circumstances, the sha1 might end up being all or mostly numbers. - // if this is the case the resulting hash could be fewer than the 5 characters we need, - // so copy it until we get to 5 - while (hash.Length < 5) - { - hash += hash; - } - - return $"@@{hash.Substring(0, 5)}"; - } } }
\ No newline at end of file |
