[hyena] Make CryptoUtil.Md5Encode thread-safe



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

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

 src/Hyena/Hyena/CryptoUtil.cs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/Hyena/Hyena/CryptoUtil.cs b/src/Hyena/Hyena/CryptoUtil.cs
index b8fefe4..f9fae15 100644
--- a/src/Hyena/Hyena/CryptoUtil.cs
+++ b/src/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]