comparison dcrypt/crypto/StreamCipher.d @ 8:23c62e28b3a4

Reworked symmetric cipher classes to have SymmetricCipher as their superclass, and follow the general interface of init(), process(), etc. Made sure everything still passed test vectors. Removed Cipher class. I'll worry about that shit when we support something other than symmetric ciphers.
author Thomas Dixon <reikon@reikon.us>
date Mon, 18 Aug 2008 01:14:37 -0400
parents 0e08791a1418
children cd376996cdb3
comparison
equal deleted inserted replaced
7:23e6e80f8ee3 8:23c62e28b3a4
6 * Authors: Thomas Dixon 6 * Authors: Thomas Dixon
7 */ 7 */
8 8
9 module dcrypt.crypto.StreamCipher; 9 module dcrypt.crypto.StreamCipher;
10 10
11 public import dcrypt.crypto.Cipher; 11 public import dcrypt.crypto.SymmetricCipher;
12 public import dcrypt.crypto.params.CipherParameters; 12 public import dcrypt.crypto.params.CipherParameters;
13 public import dcrypt.crypto.params.SymmetricKey; 13 public import dcrypt.crypto.params.SymmetricKey;
14 14
15 /** Interface for a standard stream cipher. */ 15 /** Interface for a standard stream cipher. */
16 class StreamCipher : Cipher { 16 abstract class StreamCipher : SymmetricCipher {
17 /** 17 /**
18 * Process one byte of input. 18 * Process one byte of input.
19 * 19 *
20 * Params: 20 * Params:
21 * input = Byte to XOR with keystream. 21 * input = Byte to XOR with keystream.
22 * 22 *
23 * Returns: One byte of input XORed with the keystream. 23 * Returns: One byte of input XORed with the keystream.
24 */ 24 */
25 abstract ubyte returnByte(ubyte input); 25 ubyte returnByte(ubyte input);
26
27 /**
28 * Process data from the input array
29 * and place it into the output array.
30 *
31 * Params:
32 * input_ = Array containing input data.
33 * inOff = Offset at where the data in input_ starts.
34 * len = Length of input_ to process.
35 * output_ = Array which will hold the output data.
36 * outOff = Offset at which to begin placing data in output_.
37 *
38 * Throws: dcrypt.crypto.errors.NotInitializedError if cipher
39 * was not initialized.
40 */
41 abstract void processBytes(void[] input_, uint inOff,
42 uint len, void[] output_, uint outOff);
43 } 26 }