From 8f4895e8a5bd1549f41bc1d4d2b31d03cff689ad Mon Sep 17 00:00:00 2001 From: Phallacy Date: Thu, 7 Mar 2019 03:11:41 -0800 Subject: more fixes for perf and style --- MediaBrowser.Model/Cryptography/PasswordHash.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'MediaBrowser.Model/Cryptography') diff --git a/MediaBrowser.Model/Cryptography/PasswordHash.cs b/MediaBrowser.Model/Cryptography/PasswordHash.cs index 72bdc6745e..a9d0f67446 100644 --- a/MediaBrowser.Model/Cryptography/PasswordHash.cs +++ b/MediaBrowser.Model/Cryptography/PasswordHash.cs @@ -100,14 +100,14 @@ namespace MediaBrowser.Model.Cryptography public static byte[] ConvertFromByteString(string byteString) { - List bytes = new List(); + byte[] bytes = new byte[byteString.Length / 2]; for (int i = 0; i < byteString.Length; i += 2) { // TODO: NetStandard2.1 switch this to use a span instead of a substring. - bytes.Add(Convert.ToByte(byteString.Substring(i, 2), 16)); + bytes[i / 2] = Convert.ToByte(byteString.Substring(i, 2), 16); } - return bytes.ToArray(); + return bytes; } public static string ConvertToByteString(byte[] bytes) @@ -117,18 +117,18 @@ namespace MediaBrowser.Model.Cryptography private string SerializeParameters() { - string ReturnString = string.Empty; + string returnString = string.Empty; foreach (var KVP in _parameters) { - ReturnString += $",{KVP.Key}={KVP.Value}"; + returnString += $",{KVP.Key}={KVP.Value}"; } - if ((!string.IsNullOrEmpty(ReturnString)) && ReturnString[0] == ',') + if ((!string.IsNullOrEmpty(returnString)) && returnString[0] == ',') { - ReturnString = ReturnString.Remove(0, 1); + returnString = returnString.Remove(0, 1); } - return ReturnString; + return returnString; } public override string ToString() -- cgit v1.2.3