diff dcrypt/crypto/ciphers/XTEA.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/XTEA.d	Sat May 09 23:29:20 2009 -0400
+++ b/dcrypt/crypto/ciphers/XTEA.d	Sun May 10 22:38:48 2009 -0400
@@ -17,10 +17,10 @@
 {
     private
     {
-        const uint ROUNDS = 32,
-                   KEY_SIZE = 16,
-                   BLOCK_SIZE = 8,
-                   DELTA = 0x9e3779b9u;
+        static const uint ROUNDS = 32,
+                          KEY_SIZE = 16,
+                          BLOCK_SIZE = 8,
+                          DELTA = 0x9e3779b9u;
         uint[] subkeys,
                sum0,
                sum1;
@@ -28,7 +28,7 @@
     
     void reset(){}
     
-    char[] name()
+    string name()
     {
         return "XTEA";
     }
@@ -115,7 +115,7 @@
     {
         unittest
         {
-            static const char[][] test_keys = [
+            static string[] test_keys = [
                 "00000000000000000000000000000000",
                 "00000000000000000000000000000000",
                 "0123456712345678234567893456789a",
@@ -128,7 +128,7 @@
                 "00000000000000000000000000000000"
             ];
                  
-            static const char[][] test_plaintexts = [
+            static string[] test_plaintexts = [
                 "0000000000000000",
                 "0102030405060708",
                 "0000000000000000",
@@ -141,7 +141,7 @@
                 "4141414141414141"
             ];
                 
-            static const char[][] test_ciphertexts = [
+            static string[] test_ciphertexts = [
                 "dee9d4d8f7131ed9",
                 "065c1b8975c6a816",
                 "1ff9a0261ac64264",
@@ -155,10 +155,10 @@
             ];
                 
             XTEA t = new XTEA();
-            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