Mercurial > projects > dcrypt
annotate dcrypt/crypto/Cipher.d @ 2:71aae178f89a
Added copy() to hash functions. Modified some code style.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Wed, 13 Aug 2008 22:01:19 -0400 |
parents | 0e08791a1418 |
children |
rev | line source |
---|---|
0 | 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 */ | |
2
71aae178f89a
Added copy() to hash functions. Modified some code style.
Thomas Dixon <reikon@reikon.us>
parents:
0
diff
changeset
|
30 void init(bool encrypt, CipherParameters params); |
0 | 31 |
32 /** Returns: The name of the algorithm of this cipher. */ | |
2
71aae178f89a
Added copy() to hash functions. Modified some code style.
Thomas Dixon <reikon@reikon.us>
parents:
0
diff
changeset
|
33 char[] name(); |
0 | 34 |
35 /** Reset cipher to its state immediately subsequent the last init. */ | |
2
71aae178f89a
Added copy() to hash functions. Modified some code style.
Thomas Dixon <reikon@reikon.us>
parents:
0
diff
changeset
|
36 void reset(); |
0 | 37 } |