comparison dcrypt/crypto/ciphers/TEA.d @ 1:483e4467b5f6

Added Blowfish with test vectors. Minor cleanup of other cipher classes (should probably clean more). Continued work on high-level cipher API (didn't get very far).
author Thomas Dixon <reikon@reikon.us>
date Tue, 12 Aug 2008 05:48:06 -0400
parents 0e08791a1418
children 71aae178f89a
comparison
equal deleted inserted replaced
0:0e08791a1418 1:483e4467b5f6
12 import dcrypt.crypto.BlockCipher; 12 import dcrypt.crypto.BlockCipher;
13 13
14 /** Implementation of the TEA cipher designed by 14 /** Implementation of the TEA cipher designed by
15 David Wheeler and Roger Needham. */ 15 David Wheeler and Roger Needham. */
16 class TEA : BlockCipher { 16 class TEA : BlockCipher {
17 private const uint ROUNDS = 32, 17 private {
18 KEY_SIZE = 16, 18 const uint ROUNDS = 32,
19 BLOCK_SIZE = 8, 19 KEY_SIZE = 16,
20 DELTA = 0x9e3779b9, 20 BLOCK_SIZE = 8,
21 DECRYPT_SUM = 0xc6ef3720; 21 DELTA = 0x9e3779b9,
22 private uint sk0, sk1, sk2, sk3, sum; 22 DECRYPT_SUM = 0xc6ef3720;
23 private bool initialized, 23 uint sk0, sk1, sk2, sk3, sum;
24 encrypt; 24 bool initialized,
25 encrypt;
26 }
25 27
26 void reset(){} 28 void reset(){}
27 29
28 char[] name() { 30 char[] name() {
29 return "TEA"; 31 return "TEA";