Mercurial > projects > dcrypt
comparison dcrypt/crypto/ciphers/XTEA.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 |
---|---|
149 // Encryption | 149 // Encryption |
150 t.init(true, key); | 150 t.init(true, key); |
151 t.processBlock(Util.hexToUbytes(test_plaintexts[i]), 0, buffer, 0); | 151 t.processBlock(Util.hexToUbytes(test_plaintexts[i]), 0, buffer, 0); |
152 result = Util.ubytesToHex(buffer); | 152 result = Util.ubytesToHex(buffer); |
153 assert(result == test_ciphertexts[i], | 153 assert(result == test_ciphertexts[i], |
154 t.name()~": ("~result~") != ("~test_ciphertexts[i]~")"); | 154 t.name~": ("~result~") != ("~test_ciphertexts[i]~")"); |
155 | 155 |
156 // Decryption | 156 // Decryption |
157 t.init(false, key); | 157 t.init(false, key); |
158 t.processBlock(Util.hexToUbytes(test_ciphertexts[i]), 0, buffer, 0); | 158 t.processBlock(Util.hexToUbytes(test_ciphertexts[i]), 0, buffer, 0); |
159 result = Util.ubytesToHex(buffer); | 159 result = Util.ubytesToHex(buffer); |
160 assert(result == test_plaintexts[i], | 160 assert(result == test_plaintexts[i], |
161 t.name()~": ("~result~") != ("~test_ciphertexts[i]~")"); | 161 t.name~": ("~result~") != ("~test_ciphertexts[i]~")"); |
162 } | 162 } |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |