aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Extensions/BaseExtensions.cs
diff options
context:
space:
mode:
authorWWWesten <4700006+WWWesten@users.noreply.github.com>2021-11-01 23:43:29 +0500
committerGitHub <noreply@github.com>2021-11-01 23:43:29 +0500
commit0a14279e2a21bcb9654a06a2d49e1e4f0cc5329c (patch)
treee1b1bd603b011ca98e5793e356326bf4a35a7050 /MediaBrowser.Common/Extensions/BaseExtensions.cs
parentf2817fef743eeb75a00782ceea363b2d3e7dc9f2 (diff)
parent76eeb8f655424d295e73ced8349c6fefee6ddb12 (diff)
Merge branch 'jellyfin:master' into master
Diffstat (limited to 'MediaBrowser.Common/Extensions/BaseExtensions.cs')
-rw-r--r--MediaBrowser.Common/Extensions/BaseExtensions.cs27
1 files changed, 16 insertions, 11 deletions
diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.cs
index db0514bb1..08964420e 100644
--- a/MediaBrowser.Common/Extensions/BaseExtensions.cs
+++ b/MediaBrowser.Common/Extensions/BaseExtensions.cs
@@ -1,37 +1,42 @@
using System;
+using System.Security.Cryptography;
+using System.Text;
using System.Text.RegularExpressions;
-using MediaBrowser.Model.Cryptography;
namespace MediaBrowser.Common.Extensions
{
/// <summary>
- /// Class BaseExtensions
+ /// Class BaseExtensions.
/// </summary>
public static class BaseExtensions
{
- public static ICryptoProvider CryptographyProvider { get; set; }
-
/// <summary>
/// Strips the HTML.
/// </summary>
/// <param name="htmlString">The HTML string.</param>
- /// <returns>System.String.</returns>
+ /// <returns><see cref="string" />.</returns>
public static string StripHtml(this string htmlString)
{
// http://stackoverflow.com/questions/1349023/how-can-i-strip-html-from-text-in-net
- const string pattern = @"<(.|\n)*?>";
+ const string Pattern = @"<(.|\n)*?>";
- return Regex.Replace(htmlString, pattern, string.Empty).Trim();
+ return Regex.Replace(htmlString, Pattern, string.Empty).Trim();
}
/// <summary>
- /// Gets the M d5.
+ /// Gets the Md5.
/// </summary>
- /// <param name="str">The STR.</param>
- /// <returns>Guid.</returns>
+ /// <param name="str">The string.</param>
+ /// <returns><see cref="Guid" />.</returns>
public static Guid GetMD5(this string str)
{
- return CryptographyProvider.GetMD5(str);
+#pragma warning disable CA5351
+ using (var provider = MD5.Create())
+ {
+ return new Guid(provider.ComputeHash(Encoding.Unicode.GetBytes(str)));
+ }
+
+#pragma warning restore CA5351
}
}
}