aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/HexHelper.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-09-17 18:07:15 +0200
committerAnthony Lavado <anthony@lavado.ca>2019-09-17 12:07:15 -0400
commit6f17a0b7af5775386e554f2e2e2a4a6829d2895d (patch)
treece792d21af0f8e5d0208aec1aba55e8047f2f439 /MediaBrowser.Common/HexHelper.cs
parentadc2a68a98a572e6541ffac587fd9f6247aec6d5 (diff)
Remove legacy auth code (#1677)
* Remove legacy auth code * Adds tests so we don't break PasswordHash (again) * Clean up interfaces * Remove duplicate code * Use auto properties * static using * Don't use 'this' * Fix build
Diffstat (limited to 'MediaBrowser.Common/HexHelper.cs')
-rw-r--r--MediaBrowser.Common/HexHelper.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/MediaBrowser.Common/HexHelper.cs b/MediaBrowser.Common/HexHelper.cs
new file mode 100644
index 000000000..5587c03fd
--- /dev/null
+++ b/MediaBrowser.Common/HexHelper.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Globalization;
+
+namespace MediaBrowser.Common
+{
+ public static class HexHelper
+ {
+ public static byte[] FromHexString(string str)
+ {
+ byte[] bytes = new byte[str.Length / 2];
+ for (int i = 0; i < str.Length; i += 2)
+ {
+ bytes[i / 2] = byte.Parse(str.Substring(i, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
+ }
+
+ return bytes;
+ }
+
+ public static string ToHexString(byte[] bytes)
+ => BitConverter.ToString(bytes).Replace("-", "");
+ }
+}