diff dcrypt/crypto/ciphers/TEA.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/TEA.d	Sat May 09 23:29:20 2009 -0400
+++ b/dcrypt/crypto/ciphers/TEA.d	Sun May 10 22:38:48 2009 -0400
@@ -17,17 +17,17 @@
 {
     private
     {
-        const uint ROUNDS = 32,
-                   KEY_SIZE = 16,
-                   BLOCK_SIZE = 8,
-                   DELTA = 0x9e3779b9u,
-                   DECRYPT_SUM = 0xc6ef3720u;
+        static const uint ROUNDS = 32,
+                          KEY_SIZE = 16,
+                          BLOCK_SIZE = 8,
+                          DELTA = 0x9e3779b9u,
+                          DECRYPT_SUM = 0xc6ef3720u;
         uint sk0, sk1, sk2, sk3, sum;
     }
     
     void reset(){}
     
-    char[] name()
+    string name()
     {
         return "TEA";
     }
@@ -103,21 +103,21 @@
     {
         unittest
         {
-            static const char[][] test_keys = [
+            static string[] test_keys = [
                 "00000000000000000000000000000000",
                 "00000000000000000000000000000000",
                 "0123456712345678234567893456789a",
                 "0123456712345678234567893456789a"
             ];
                  
-            static const char[][] test_plaintexts = [
+            static string[] test_plaintexts = [
                 "0000000000000000",
                 "0102030405060708",
                 "0000000000000000",
                 "0102030405060708"
             ];
                 
-            static const char[][] test_ciphertexts = [
+            static string[] test_ciphertexts = [
                 "41ea3a0a94baa940",
                 "6a2f9cf3fccf3c55",
                 "34e943b0900f5dcb",
@@ -126,10 +126,10 @@
                 
             
             TEA t = new TEA();
-            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