comparison dcrypt/crypto/Cipher.d @ 0:0e08791a1418

Initial import.
author Thomas Dixon <reikon@reikon.us>
date Sun, 10 Aug 2008 14:20:17 -0400
parents
children 71aae178f89a
comparison
equal deleted inserted replaced
-1:000000000000 0:0e08791a1418
1 /**
2 * This file is part of the dcrypt project.
3 *
4 * Copyright: Copyright (C) dcrypt contributors 2008. All rights reserved.
5 * License: MIT
6 * Authors: Thomas Dixon
7 */
8
9 module dcrypt.crypto.Cipher;
10
11 public import dcrypt.crypto.errors.InvalidKeyError;
12 public import dcrypt.crypto.errors.ShortBufferError;
13 public import dcrypt.crypto.errors.NotInitializedError;
14 public import dcrypt.crypto.errors.InvalidParameterError;
15
16 public import dcrypt.crypto.params.CipherParameters;
17
18 /** Base cipher class */
19 interface Cipher {
20 static const bool ENCRYPT = true,
21 DECRYPT = false;
22
23 /**
24 * Initialize a cipher.
25 *
26 * Params:
27 * encrypt = True if we are encrypting.
28 * params = Parameters to be passed to the cipher. (Key, rounds, etc.)
29 */
30 abstract void init(bool encrypt, CipherParameters params);
31
32 /** Returns: The name of the algorithm of this cipher. */
33 abstract char[] name();
34
35 /** Reset cipher to its state immediately subsequent the last init. */
36 abstract void reset();
37
38 }