Mercurial > projects > dcrypt
comparison dcrypt/crypto/ciphers/TEA.d @ 2:71aae178f89a
Added copy() to hash functions. Modified some code style.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Wed, 13 Aug 2008 22:01:19 -0400 |
parents | 483e4467b5f6 |
children | 5cb17e09d685 |
comparison
equal
deleted
inserted
replaced
1:483e4467b5f6 | 2:71aae178f89a |
---|---|
122 // Encryption | 122 // Encryption |
123 t.init(true, key); | 123 t.init(true, key); |
124 t.processBlock(Util.hexToUbytes(test_plaintexts[i]), 0, buffer, 0); | 124 t.processBlock(Util.hexToUbytes(test_plaintexts[i]), 0, buffer, 0); |
125 result = Util.ubytesToHex(buffer); | 125 result = Util.ubytesToHex(buffer); |
126 assert(result == test_ciphertexts[i], | 126 assert(result == test_ciphertexts[i], |
127 t.name()~": ("~result~") != ("~test_ciphertexts[i]~")"); | 127 t.name~": ("~result~") != ("~test_ciphertexts[i]~")"); |
128 | 128 |
129 // Decryption | 129 // Decryption |
130 t.init(false, key); | 130 t.init(false, key); |
131 t.processBlock(Util.hexToUbytes(test_ciphertexts[i]), 0, buffer, 0); | 131 t.processBlock(Util.hexToUbytes(test_ciphertexts[i]), 0, buffer, 0); |
132 result = Util.ubytesToHex(buffer); | 132 result = Util.ubytesToHex(buffer); |
133 assert(result == test_plaintexts[i], | 133 assert(result == test_plaintexts[i], |
134 t.name()~": ("~result~") != ("~test_ciphertexts[i]~")"); | 134 t.name~": ("~result~") != ("~test_ciphertexts[i]~")"); |
135 } | 135 } |
136 } | 136 } |
137 } | 137 } |