Mercurial > projects > dcrypt
comparison dcrypt/crypto/BlockCipherPadding.d @ 32:2b4bccdc8387
Added version() statements to play nice with D2's current feelings about const. Changed a few methods (addEntropy and read in the base PRNG class, and the constructor for ParametersWithIV) to accept void[] in place of ubyte[].
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Tue, 12 May 2009 22:09:33 -0400 |
parents | ad687db713a4 |
children | 6b2c35b84186 |
comparison
equal
deleted
inserted
replaced
31:f429c5e9dd69 | 32:2b4bccdc8387 |
---|---|
11 public import dcrypt.crypto.errors.InvalidPaddingError; | 11 public import dcrypt.crypto.errors.InvalidPaddingError; |
12 | 12 |
13 /** Base padding class for implementing block padding schemes. */ | 13 /** Base padding class for implementing block padding schemes. */ |
14 abstract class BlockCipherPadding | 14 abstract class BlockCipherPadding |
15 { | 15 { |
16 /** Returns: The name of the padding scheme implemented. */ | 16 /** Returns: The name of the padding scheme implemented. */ |
17 string name(); | 17 string name(); |
18 | |
19 /** | |
20 * Generate padding to a specific length. | |
21 * | |
22 * Params: | |
23 * len = Length of padding to generate | |
24 * | |
25 * Returns: The padding bytes to be added. | |
26 */ | |
27 ubyte[] pad(uint len); | |
28 | |
29 /** | |
30 * Return the number of pad bytes in the block. | |
31 * | |
32 * Params: | |
33 * input_ = Padded block of which to count the pad bytes. | |
34 * | |
35 * Returns: The number of pad bytes in the block. | |
36 * | |
37 * Throws: dcrypt.crypto.errors.InvalidPaddingError if | |
38 * pad length cannot be discerned. | |
39 */ | |
40 uint unpad(void[] input_); | |
18 | 41 |
19 /** | 42 /** Play nice with D2's idea of const. */ |
20 * Generate padding to a specific length. | 43 version (D_Version2) |
21 * | 44 { |
22 * Params: | 45 uint unpad(string input_) |
23 * len = Length of padding to generate | 46 { |
24 * | 47 return unpad(cast(ubyte[])input_); |
25 * Returns: The padding bytes to be added. | 48 } |
26 */ | 49 } |
27 ubyte[] pad(uint len); | |
28 | |
29 /** | |
30 * Return the number of pad bytes in the block. | |
31 * | |
32 * Params: | |
33 * input_ = Padded block of which to count the pad bytes. | |
34 * | |
35 * Returns: The number of pad bytes in the block. | |
36 * | |
37 * Throws: dcrypt.crypto.errors.InvalidPaddingError if | |
38 * pad length cannot be discerned. | |
39 */ | |
40 uint unpad(void[] input_); | |
41 } | 50 } |