Mercurial > projects > dcrypt
comparison dcrypt/crypto/ciphers/RC4.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 |
---|---|
14 import dcrypt.misc.Util; | 14 import dcrypt.misc.Util; |
15 } | 15 } |
16 | 16 |
17 /** Implementation of RC4 designed by Ron Rivest of RSA Security. */ | 17 /** Implementation of RC4 designed by Ron Rivest of RSA Security. */ |
18 class RC4 : StreamCipher { | 18 class RC4 : StreamCipher { |
19 private ubyte[] state, | 19 private { |
20 workingKey; | 20 ubyte[] state, |
21 private ubyte x, y; | 21 workingKey; |
22 private bool initialized; | 22 ubyte x, y; |
23 bool initialized; | |
24 } | |
23 | 25 |
24 void init(bool encrypt, CipherParameters params) { | 26 void init(bool encrypt, CipherParameters params) { |
25 SymmetricKey keyParams = cast(SymmetricKey)params; | 27 SymmetricKey keyParams = cast(SymmetricKey)params; |
26 if (!keyParams) | 28 if (!keyParams) |
27 throw new InvalidParameterError( | 29 throw new InvalidParameterError( |