comparison dcrypt/crypto/ciphers/RC6.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
21 * Ron Rivest et al. of RSA Security. 21 * Ron Rivest et al. of RSA Security.
22 * 22 *
23 * Note: This algorithm is patented and trademarked. 23 * Note: This algorithm is patented and trademarked.
24 */ 24 */
25 class RC6 : BlockCipher { 25 class RC6 : BlockCipher {
26 private const uint ROUNDS = 20, 26 private {
27 BLOCK_SIZE = 16, 27 const uint ROUNDS = 20,
28 // Magic constants for a 32 bit word size 28 BLOCK_SIZE = 16,
29 P = 0xb7e15163, 29 // Magic constants for a 32 bit word size
30 Q = 0x9e3779b9; 30 P = 0xb7e15163,
31 private uint[] S; 31 Q = 0x9e3779b9;
32 private ubyte[] workingKey; 32 uint[] S;
33 private bool initialized, 33 ubyte[] workingKey;
34 encrypt; 34 bool initialized,
35 encrypt;
36 }
35 37
36 char[] name() { 38 char[] name() {
37 return "RC6"; 39 return "RC6";
38 } 40 }
39 41