comparison dcrypt/crypto/MAC.d @ 4:3de3a2de13a0

Added MAC base class and HMAC. Added StreamCipherWrapper as part of the work on the high-level cipher API. Running on fumes, so hopefully there isn't too much stupid mixed into the code.
author Thomas Dixon <reikon@reikon.us>
date Thu, 14 Aug 2008 01:45:24 -0400
parents
children 5ce3012f1def
comparison
equal deleted inserted replaced
3:a5789a7b3b3b 4:3de3a2de13a0
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.MAC;
10
11 public import dcrypt.crypto.params.CipherParameters;
12 public import dcrypt.crypto.errors.InvalidParameterError;
13 import dcrypt.misc.Util;
14
15 /** Base MAC class */
16 abstract class MAC {
17 /**
18 * Initialize a MAC.
19 *
20 * Params:
21 * params = Parameters to be passed to the MAC. (Key, etc.)
22 */
23 void init(CipherParameters params);
24
25 /**
26 * Introduce data into the MAC.
27 *
28 * Params:
29 * input_ = Data to be processed.
30 */
31 void update(void[] input_);
32
33 /** Returns: The name of this MAC. */
34 char[] name();
35
36 /** Reset MAC to its state immediately subsequent the last init. */
37 void reset();
38
39 /** Returns: The block size in bytes that this MAC will operate on. */
40 uint blockSize();
41
42 /** Returns: The output size of the MAC in bytes. */
43 uint macSize();
44
45 /** Returns: The computed MAC. */
46 ubyte[] finish();
47
48 /** Returns: The computed MAC in hexadecimal. */
49 char[] hexFinish() {
50 return Util.ubytesToHex(finish());
51 }
52 }