diff dcrypt/crypto/params/SymmetricKey.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 0e08791a1418
children 8b5eaf3c2979
line wrap: on
line diff
--- a/dcrypt/crypto/params/SymmetricKey.d	Fri Sep 12 05:20:43 2008 -0400
+++ b/dcrypt/crypto/params/SymmetricKey.d	Tue Nov 18 18:03:40 2008 -0500
@@ -9,24 +9,23 @@
 module dcrypt.crypto.params.SymmetricKey;
 
 import dcrypt.crypto.params.CipherParameters;
+import dcrypt.crypto.errors.InvalidParameterError;
 
 /** Object representing and wrapping a symmetric key in bytes. */
 class SymmetricKey : CipherParameters {
-    private ubyte[] m_key;
+    private ubyte[] _key;
     
     /**
      * Params:
      *     key = Key to be held.
      */
-    this(void[] key_=null) {
-        ubyte[] key = cast(ubyte[]) key_;
-        if (key)
-            m_key = key;
+    this(void[] key=null) {
+        _key = cast(ubyte[]) key;
     }
     
     /** Returns: Key in ubytes held by this object. */
     ubyte[] key() {
-        return m_key;
+        return _key;
     }
     
     /**
@@ -36,8 +35,7 @@
      *     newKey = New key to be held.
      * Returns: The new key.
      */
-    ubyte[] key(void[] newKey_) {
-        ubyte[] newKey = cast(ubyte[])newKey_;
-        return m_key = newKey;
+    ubyte[] key(void[] newKey) {
+        return _key = cast(ubyte[]) newKey;
     }
 }