diff dcrypt/crypto/Cipher.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 8c7f8fecdd75
children 8b5eaf3c2979
line wrap: on
line diff
--- a/dcrypt/crypto/Cipher.d	Fri Sep 12 05:20:43 2008 -0400
+++ b/dcrypt/crypto/Cipher.d	Tue Nov 18 18:03:40 2008 -0500
@@ -19,6 +19,9 @@
 abstract class Cipher {
     static const bool ENCRYPT = true,
                       DECRYPT = false;
+                      
+    protected bool _initialized,
+                   _encrypt;
     
     /**
      * Initialize a cipher.
@@ -44,6 +47,11 @@
     /** Returns: The name of the algorithm of this cipher. */
     char[] name();
     
+    /** Returns: Whether or not the cipher has been initialized. */
+    bool initialized() {
+        return _initialized;
+    }
+    
     /** Reset cipher to its state immediately subsequent the last init. */
     void reset();
 }