diff options
author | UbitUmarov | 2018-11-18 01:01:39 +0000 |
---|---|---|
committer | UbitUmarov | 2018-11-18 01:01:39 +0000 |
commit | 65310f3e5ed493dc48233f7854e973f6c2c6d5dd (patch) | |
tree | dba32d7367ea8d6f22923d6e1e21cd28e5016c50 /OpenSim | |
parent | ohh we have build instructions on git also ;) (diff) | |
download | opensim-SC-65310f3e5ed493dc48233f7854e973f6c2c6d5dd.zip opensim-SC-65310f3e5ed493dc48233f7854e973f6c2c6d5dd.tar.gz opensim-SC-65310f3e5ed493dc48233f7854e973f6c2c6d5dd.tar.bz2 opensim-SC-65310f3e5ed493dc48233f7854e973f6c2c6d5dd.tar.xz |
don't share SHA256CryptoServiceProvider (can be improved)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXAssetData.cs | 9 | ||||
-rw-r--r-- | OpenSim/Services/FSAssetService/FSAssetService.cs | 5 |
2 files changed, 6 insertions, 8 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 9f9c9cf..5c92be9 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -58,11 +58,6 @@ namespace OpenSim.Data.MySQL | |||
58 | private bool m_enableCompression = false; | 58 | private bool m_enableCompression = false; |
59 | private string m_connectionString; | 59 | private string m_connectionString; |
60 | 60 | ||
61 | /// <summary> | ||
62 | /// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock | ||
63 | /// </summary> | ||
64 | private HashAlgorithm hasher = new SHA256CryptoServiceProvider(); | ||
65 | |||
66 | #region IPlugin Members | 61 | #region IPlugin Members |
67 | 62 | ||
68 | public string Version { get { return "1.0.0.0"; } } | 63 | public string Version { get { return "1.0.0.0"; } } |
@@ -250,7 +245,9 @@ namespace OpenSim.Data.MySQL | |||
250 | } | 245 | } |
251 | } | 246 | } |
252 | 247 | ||
253 | byte[] hash = hasher.ComputeHash(asset.Data); | 248 | byte[] hash; |
249 | using (HashAlgorithm hasher = new SHA256CryptoServiceProvider()) | ||
250 | hash = hasher.ComputeHash(asset.Data); | ||
254 | 251 | ||
255 | // m_log.DebugFormat( | 252 | // m_log.DebugFormat( |
256 | // "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}", | 253 | // "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}", |
diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs index 028dd01..2fb3e6c 100644 --- a/OpenSim/Services/FSAssetService/FSAssetService.cs +++ b/OpenSim/Services/FSAssetService/FSAssetService.cs | |||
@@ -52,7 +52,6 @@ namespace OpenSim.Services.FSAssetService | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 54 | static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); |
55 | static SHA256CryptoServiceProvider SHA256 = new SHA256CryptoServiceProvider(); | ||
56 | 55 | ||
57 | static byte[] ToCString(string s) | 56 | static byte[] ToCString(string s) |
58 | { | 57 | { |
@@ -357,7 +356,9 @@ namespace OpenSim.Services.FSAssetService | |||
357 | 356 | ||
358 | string GetSHA256Hash(byte[] data) | 357 | string GetSHA256Hash(byte[] data) |
359 | { | 358 | { |
360 | byte[] hash = SHA256.ComputeHash(data); | 359 | byte[] hash; |
360 | using (SHA256CryptoServiceProvider SHA256 = new SHA256CryptoServiceProvider()) | ||
361 | hash = SHA256.ComputeHash(data); | ||
361 | 362 | ||
362 | return BitConverter.ToString(hash).Replace("-", String.Empty); | 363 | return BitConverter.ToString(hash).Replace("-", String.Empty); |
363 | } | 364 | } |