comparison dcrypt/crypto/Cipher.d @ 14:5ce3012f1def

Removed some redundancy in code. Added NotSupportedError, a base PRNG class and a class which creates a PRNG from a hash function. Changed the MAC class' finalization methods to digest and hexDigest instead of finish and hexFinish respectively. Also added a base Checksum class, crc32 and adler32 in dcrypt.misc as per request.
author Thomas Dixon <reikon@reikon.us>
date Tue, 18 Nov 2008 18:03:40 -0500
parents 8c7f8fecdd75
children 8b5eaf3c2979
comparison
equal deleted inserted replaced
13:7ea528b61802 14:5ce3012f1def
17 17
18 /** Base symmetric cipher class */ 18 /** Base symmetric cipher class */
19 abstract class Cipher { 19 abstract class Cipher {
20 static const bool ENCRYPT = true, 20 static const bool ENCRYPT = true,
21 DECRYPT = false; 21 DECRYPT = false;
22
23 protected bool _initialized,
24 _encrypt;
22 25
23 /** 26 /**
24 * Initialize a cipher. 27 * Initialize a cipher.
25 * 28 *
26 * Params: 29 * Params:
42 uint update(void[] input_, void[] output_); 45 uint update(void[] input_, void[] output_);
43 46
44 /** Returns: The name of the algorithm of this cipher. */ 47 /** Returns: The name of the algorithm of this cipher. */
45 char[] name(); 48 char[] name();
46 49
50 /** Returns: Whether or not the cipher has been initialized. */
51 bool initialized() {
52 return _initialized;
53 }
54
47 /** Reset cipher to its state immediately subsequent the last init. */ 55 /** Reset cipher to its state immediately subsequent the last init. */
48 void reset(); 56 void reset();
49 } 57 }