[banshee] [Hyena] Make CryptoUtil.Md5Encode thread-safe



commit e166a3ac0fdece6d1b869193df00c122ac479bf5
Author: Alan McGovern <alan mcgovern gmail com>
Date:   Mon Mar 1 15:23:13 2010 -0800

    [Hyena] Make CryptoUtil.Md5Encode thread-safe
    
    Signed-off-by: Gabriel Burt <gabriel burt gmail com>

 src/Libraries/Hyena/Hyena/CryptoUtil.cs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/Libraries/Hyena/Hyena/CryptoUtil.cs b/src/Libraries/Hyena/Hyena/CryptoUtil.cs
index b8fefe4..f9fae15 100644
--- a/src/Libraries/Hyena/Hyena/CryptoUtil.cs
+++ b/src/Libraries/Hyena/Hyena/CryptoUtil.cs
@@ -55,7 +55,10 @@ namespace Hyena
                 return String.Empty;
             }
 
-            byte [] hash = md5.ComputeHash (encoding.GetBytes (text));
+            byte [] hash;
+            lock (md5) {
+                hash = md5.ComputeHash (encoding.GetBytes (text));
+            }
 
             StringBuilder shash = new StringBuilder ();
             for (int i = 0; i < hash.Length; i++) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]