aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Cryptography
diff options
context:
space:
mode:
authorPhallacy <Dragoonmac@gmail.com>2019-03-07 03:11:41 -0800
committerPhallacy <Dragoonmac@gmail.com>2019-03-07 03:11:41 -0800
commit8f4895e8a5bd1549f41bc1d4d2b31d03cff689ad (patch)
treedb2b697d08c778ba85ccce9d61f95e4b819b84f2 /Emby.Server.Implementations/Cryptography
parentc31b0b311b339475650aa8812eb57152cac32d80 (diff)
more fixes for perf and style
Diffstat (limited to 'Emby.Server.Implementations/Cryptography')
-rw-r--r--Emby.Server.Implementations/Cryptography/CryptographyProvider.cs35
1 files changed, 19 insertions, 16 deletions
diff --git a/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs b/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs
index 2e882cefe..e27738f69 100644
--- a/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs
+++ b/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs
@@ -17,7 +17,7 @@ namespace Emby.Server.Implementations.Cryptography
private RandomNumberGenerator _randomNumberGenerator;
- private int _defaultIterations = 1000;
+ private const int _defaultIterations = 1000;
public CryptographyProvider()
{
@@ -27,20 +27,20 @@ namespace Emby.Server.Implementations.Cryptography
//Please note the default method of PBKDF2 is not included, it cannot be used to generate hashes cleanly as it is actually a pbkdf with sha1
_supportedHashMethods = new HashSet<string>()
{
- "MD5"
- ,"System.Security.Cryptography.MD5"
- ,"SHA"
- ,"SHA1"
- ,"System.Security.Cryptography.SHA1"
- ,"SHA256"
- ,"SHA-256"
- ,"System.Security.Cryptography.SHA256"
- ,"SHA384"
- ,"SHA-384"
- ,"System.Security.Cryptography.SHA384"
- ,"SHA512"
- ,"SHA-512"
- ,"System.Security.Cryptography.SHA512"
+ "MD5",
+ "System.Security.Cryptography.MD5",
+ "SHA",
+ "SHA1",
+ "System.Security.Cryptography.SHA1",
+ "SHA256",
+ "SHA-256",
+ "System.Security.Cryptography.SHA256",
+ "SHA384",
+ "SHA-384",
+ "System.Security.Cryptography.SHA384",
+ "SHA512",
+ "SHA-512",
+ "System.Security.Cryptography.SHA512"
};
_randomNumberGenerator = RandomNumberGenerator.Create();
}
@@ -120,7 +120,10 @@ namespace Emby.Server.Implementations.Cryptography
}
else
{
- return h.ComputeHash(bytes.Concat(salt).ToArray());
+ byte[] salted = new byte[bytes.Length + salt.Length];
+ Array.Copy(bytes, salted, bytes.Length);
+ Array.Copy(salt, 0, salted, bytes.Length, salt.Length);
+ return h.ComputeHash(salted);
}
}
}