Mercurial > projects > dcrypt
comparison dcrypt/crypto/ciphers/XTEA.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 XTEA cipher designed by | 14 /** Implementation of the XTEA cipher designed by |
15 David Wheeler and Roger Needham. */ | 15 David Wheeler and Roger Needham. */ |
16 class XTEA : BlockCipher { | 16 class XTEA : 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 private uint[] subkeys, | 21 DELTA = 0x9e3779b9; |
22 sum0, | 22 uint[] subkeys, |
23 sum1; | 23 sum0, |
24 private bool initialized, | 24 sum1; |
25 encrypt; | 25 bool initialized, |
26 encrypt; | |
27 } | |
26 | 28 |
27 void reset(){} | 29 void reset(){} |
28 | 30 |
29 char[] name() { | 31 char[] name() { |
30 return "XTEA"; | 32 return "XTEA"; |