diff dcrypt/crypto/ciphers/RC6.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 ec23779ee794
line wrap: on
line diff
--- a/dcrypt/crypto/ciphers/RC6.d	Fri Sep 12 05:20:43 2008 -0400
+++ b/dcrypt/crypto/ciphers/RC6.d	Tue Nov 18 18:03:40 2008 -0500
@@ -33,8 +33,6 @@
                    Q = 0x9e3779b9;
         uint[] S;
         ubyte[] workingKey;
-        bool initialized,
-             encrypt;
     }
     
     char[] name() {
@@ -50,7 +48,7 @@
         if (!keyParams)
             throw new InvalidParameterError(
                     name()~": Invalid parameter passed to init");
-        this.encrypt = encrypt;
+        _encrypt = encrypt;
         
         uint len = keyParams.key.length;
         if (len != 16 && len != 24 && len != 32)
@@ -62,11 +60,11 @@
         workingKey = keyParams.key;
         setup(workingKey);
         
-        initialized = true;
+        _initialized = true;
     }
     
     uint update(void[] input_, void[] output_) {
-        if (!initialized)
+        if (!_initialized)
             throw new NotInitializedError(name()~": Cipher not initialized");
             
         ubyte[] input = cast(ubyte[]) input_,
@@ -85,7 +83,7 @@
              t,
              u;
              
-        if (encrypt) {
+        if (_encrypt) {
             B += S[0];
             D += S[1];
             for (int i = 1; i <= ROUNDS; i++) {