You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2009/08/05 19:46:03 UTC
svn commit: r801333 - in /incubator/lucene.net/trunk/C#/src/Lucene.Net:
Store/FSDirectory.cs SupportClass.cs
Author: digy
Date: Wed Aug 5 17:46:03 2009
New Revision: 801333
URL: http://svn.apache.org/viewvc?rev=801333&view=rev
Log:
LUCENENET-175 for Lucene.Net 2.4.0
Modified:
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/FSDirectory.cs?rev=801333&r1=801332&r2=801333&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs Wed Aug 5 17:46:03 2009
@@ -87,12 +87,18 @@
/// the <code>getDirectory</code> methods that take a
/// <code>lockFactory</code> (for example, {@link #GetDirectory(String, LockFactory)}).
/// </deprecated>
- public static readonly System.String LOCK_DIR = SupportClass.AppSettings.Get("Lucene.Net.lockDir", System.IO.Path.GetTempPath());
+
+ //Deprecated. As of 2.1, LOCK_DIR is unused because the write.lock is now stored by default in the index directory.
+ //If you really want to store locks elsewhere you can create your own SimpleFSLockFactory (or NativeFSLockFactory, etc.) passing in your preferred lock directory.
+ //Then, pass this LockFactory instance to one of the getDirectory methods that take a lockFactory (for example, getDirectory(String, LockFactory)).
+ //public static readonly System.String LOCK_DIR = SupportClass.AppSettings.Get("Lucene.Net.lockDir", System.IO.Path.GetTempPath());
+
+
/// <summary>The default class which implements filesystem-based directories. </summary>
private static System.Type IMPL;
-
- private static System.Security.Cryptography.MD5 DIGESTER;
+
+ private static System.Security.Cryptography.HashAlgorithm DIGESTER;
/// <summary>A buffer optionally used in renameTo method </summary>
private byte[] buffer = null;
@@ -972,7 +978,8 @@
{
try
{
- DIGESTER = System.Security.Cryptography.MD5.Create();
+ DIGESTER = SupportClass.Cryptography.GetHashAlgorithm();
+
}
catch (System.Exception e)
{
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/SupportClass.cs?rev=801333&r1=801332&r2=801333&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs Wed Aug 5 17:46:03 2009
@@ -1559,4 +1559,23 @@
}
#endregion
+ public class Cryptography
+ {
+ static public bool FIPSCompliant = false;
+
+ static public System.Security.Cryptography.HashAlgorithm GetHashAlgorithm()
+ {
+ if (FIPSCompliant)
+ {
+ //LUCENENET-175
+ //No Assumptions should be made on the HashAlgorithm. It may change in time.
+ //SHA256 SHA384 SHA512 etc.
+ return System.Security.Cryptography.SHA1.Create();
+ }
+ return System.Security.Cryptography.MD5.Create();
+ }
+ }
+
+
+
}