# HG changeset patch # User Thomas Dixon # Date 1231482285 18000 # Node ID 3a57367afe340fb21bc97d1d68a8eea5327013a9 # Parent 6e11990d031d5f967f5448bc9e5059c6868f9ff3 Fixed bug which prevented Blowfish from resetting correctly. diff -r 6e11990d031d -r 3a57367afe34 dcrypt/crypto/ciphers/Blowfish.d --- a/dcrypt/crypto/ciphers/Blowfish.d Wed Nov 19 19:48:31 2008 -0500 +++ b/dcrypt/crypto/ciphers/Blowfish.d Fri Jan 09 01:24:45 2009 -0500 @@ -231,15 +231,11 @@ throw new InvalidKeyError( name()~": Invalid key length (requires 4-56 bytes)"); - S0[] = S_INIT[0..256]; - S1[] = S_INIT[256..512]; - S2[] = S_INIT[512..768]; - S3[] = S_INIT[768..1024]; - P[] = P_INIT[]; + workingKey = keyParams.key; - workingKey = keyParams.key; // Yes, this is ghetto. I know. _initialized = true; + setup(workingKey); if (!_encrypt) @@ -288,6 +284,12 @@ } private void setup(ubyte[] key) { + S0[] = S_INIT[0..256]; + S1[] = S_INIT[256..512]; + S2[] = S_INIT[512..768]; + S3[] = S_INIT[768..1024]; + P[] = P_INIT[]; + uint index = 0; for (int i = 0; i < PBOX_SIZE; i++) {