diff dcrypt/crypto/prngs/PBKDF2.d @ 33:b9f8aa42a547

More changes suggested by Glenn Haecker for D2 compatibility.
author Thomas Dixon <reikon@reikon.us>
date Thu, 14 May 2009 01:33:11 -0400
parents 2b4bccdc8387
children
line wrap: on
line diff
--- a/dcrypt/crypto/prngs/PBKDF2.d	Tue May 12 22:09:33 2009 -0400
+++ b/dcrypt/crypto/prngs/PBKDF2.d	Thu May 14 01:33:11 2009 -0400
@@ -44,7 +44,7 @@
      *     iterations = The number of total iterations
      *     prf = The pseudo-random function
      */
-    this(string password, void[] salt_, uint iterations=1000, MAC prf=new HMAC(new SHA1))
+    this (string password, void[] salt_, uint iterations=1000, MAC prf=new HMAC(new SHA1))
     {
         
         salt = cast(ubyte[])salt_;
@@ -69,6 +69,15 @@
         _initialized = true;
     }
     
+    /** Play nice with D2's idea of const. */
+    version (D_Version2)
+    {
+        this (string password, string salt, uint iterations=1000, MAC prf=new HMAC(new SHA1))
+        {
+            this(password, cast(ubyte[])salt, iterations, prf);
+        }
+    }
+    
     void addEntropy(void[] input)
     {
         throw new NotSupportedError(name()~": addEntropy is not supported.");