diff dcrypt/crypto/ciphers/RC6.d @ 28:ad687db713a4

Further reworked the code for hash padding. Replaced all instances of 'char[]' with 'string' and removed a few 'const' modifiers as per Glenn Haecker's patch for D2 compatibility. Updated CONTRIBUTORS file.
author Thomas Dixon <reikon@reikon.us>
date Sun, 10 May 2009 22:38:48 -0400
parents 8b5eaf3c2979
children
line wrap: on
line diff
--- a/dcrypt/crypto/ciphers/RC6.d	Sat May 09 23:29:20 2009 -0400
+++ b/dcrypt/crypto/ciphers/RC6.d	Sun May 10 22:38:48 2009 -0400
@@ -29,16 +29,16 @@
 {
     private
     {
-        const uint ROUNDS = 20,
-                   BLOCK_SIZE = 16,
-                   // Magic constants for a 32 bit word size
-                   P = 0xb7e15163,
-                   Q = 0x9e3779b9;
+        static const uint ROUNDS = 20,
+                          BLOCK_SIZE = 16,
+                          // Magic constants for a 32 bit word size
+                          P = 0xb7e15163,
+                          Q = 0x9e3779b9;
         uint[] S;
         ubyte[] workingKey;
     }
     
-    char[] name()
+    string name()
     {
         return "RC6";
     }
@@ -172,7 +172,7 @@
     {
         unittest
         {
-            static const char[][] test_keys = [
+            static string[] test_keys = [
                 "00000000000000000000000000000000",
                 "0123456789abcdef0112233445566778",
                 "00000000000000000000000000000000"~
@@ -185,7 +185,7 @@
                 "899aabbccddeeff01032547698badcfe"
             ];
                  
-            static const char[][] test_plaintexts = [
+            static string[] test_plaintexts = [
                 "00000000000000000000000000000000",
                 "02132435465768798a9bacbdcedfe0f1",
                 "00000000000000000000000000000000",
@@ -194,7 +194,7 @@
                 "02132435465768798a9bacbdcedfe0f1"
             ];
                 
-            static const char[][] test_ciphertexts = [
+            static string[] test_ciphertexts = [
                 "8fc3a53656b1f778c129df4e9848a41e",
                 "524e192f4715c6231f51f6367ea43f18",
                 "6cd61bcb190b30384e8a3f168690ae82",
@@ -204,10 +204,10 @@
             ];
                 
             RC6 t = new RC6();
-            foreach (uint i, char[] test_key; test_keys)
+            foreach (uint i, string test_key; test_keys)
             {
                 ubyte[] buffer = new ubyte[t.blockSize];
-                char[] result;
+                string result;
                 SymmetricKey key = new SymmetricKey(ByteConverter.hexDecode(test_key));
                 
                 // Encryption