diff dcrypt/crypto/params/ParametersWithIV.d @ 14:5ce3012f1def

Removed some redundancy in code. Added NotSupportedError, a base PRNG class and a class which creates a PRNG from a hash function. Changed the MAC class' finalization methods to digest and hexDigest instead of finish and hexFinish respectively. Also added a base Checksum class, crc32 and adler32 in dcrypt.misc as per request.
author Thomas Dixon <reikon@reikon.us>
date Tue, 18 Nov 2008 18:03:40 -0500
parents 71aae178f89a
children 8b5eaf3c2979
line wrap: on
line diff
--- a/dcrypt/crypto/params/ParametersWithIV.d	Fri Sep 12 05:20:43 2008 -0400
+++ b/dcrypt/crypto/params/ParametersWithIV.d	Tue Nov 18 18:03:40 2008 -0500
@@ -12,25 +12,22 @@
 
 /** Wrap cipher parameters and IV. */
 class ParametersWithIV : CipherParameters {
-    private ubyte[] m_iv;
-    private CipherParameters m_params;
+    private ubyte[] _iv;
+    private CipherParameters _params;
     
     /**
      * Params:
      *     params = Parameters to wrap.
      *     iv     = IV to be held.
      */
-    this (CipherParameters params=null, ubyte[] iv_=null) {
-        if (params)
-            m_params = params;
-        ubyte[] iv = cast(ubyte[]) iv_;
-        if (iv)
-            m_iv = iv;
+    this (CipherParameters params=null, ubyte[] iv=null) {
+        _params = params;
+        _iv = cast(ubyte[]) iv;
     }
     
     /** Returns: The IV. */
     ubyte[] iv() {
-        return m_iv;
+        return _iv;
     }
     
     /**
@@ -40,14 +37,13 @@
      *     newIV = The new IV for this parameter object.
      * Returns: The new IV.
      */
-    ubyte[] iv(void[] newIV_) {
-        ubyte[] newIV = cast(ubyte[]) newIV_;
-        return m_iv = newIV;
+    ubyte[] iv(void[] newIV) {;
+        return _iv = cast(ubyte[]) newIV;
     }
     
     /** Returns: The parameters for this object. */
     CipherParameters parameters() {
-        return m_params;
+        return _params;
     }
     
     /**
@@ -58,6 +54,6 @@
      * Returns: The new parameters.
      */
     CipherParameters parameters(CipherParameters newParams) {
-        return m_params = newParams;
+        return _params = newParams;
     }
 }