comparison dcrypt/crypto/BlockCipher.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 71aae178f89a
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.BlockCipher; 9 module dcrypt.crypto.BlockCipher;
10 10
11 public import dcrypt.crypto.Cipher; 11 public import dcrypt.crypto.SymmetricCipher;
12 public import dcrypt.crypto.params.SymmetricKey; 12 public import dcrypt.crypto.params.SymmetricKey;
13 13
14 /** Interface for a standard block cipher. */ 14 /** Interface for a standard block cipher. */
15 interface BlockCipher : Cipher { 15 abstract class BlockCipher : SymmetricCipher {
16 16
17 /** Returns: The block size in bytes that this cipher will operate on. */ 17 /** Returns: The block size in bytes that this cipher will operate on. */
18 uint blockSize(); 18 uint blockSize();
19
20 /**
21 * Process a block of data from the input array
22 * and place it into the output array.
23 *
24 * Params:
25 * input_ = Array containing input data.
26 * inOff = Offset at where the data in input_ starts.
27 * output_ = Array which will hold the output data.
28 * outOff = Offset at which to begin placing data in output_.
29 *
30 * Returns: The number of bytes processed (typically blockSize).
31 *
32 * Throws: dcrypt.crypto.errors.NotInitializedError if cipher
33 * was not initialized.
34 */
35 uint processBlock(void[] input_, uint inOff, void[] output_, uint outOff);
36 } 19 }