diff dcrypt/crypto/BlockCipher.d @ 0:0e08791a1418

Initial import.
author Thomas Dixon <reikon@reikon.us>
date Sun, 10 Aug 2008 14:20:17 -0400
parents
children 71aae178f89a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dcrypt/crypto/BlockCipher.d	Sun Aug 10 14:20:17 2008 -0400
@@ -0,0 +1,38 @@
+/**
+ * This file is part of the dcrypt project.
+ *
+ * Copyright: Copyright (C) dcrypt contributors 2008. All rights reserved.
+ * License:   MIT
+ * Authors:   Thomas Dixon
+ */
+ 
+module dcrypt.crypto.BlockCipher;
+
+public import dcrypt.crypto.Cipher;
+public import dcrypt.crypto.params.SymmetricKey;
+
+/** Interface for a standard block cipher. */
+abstract class BlockCipher : Cipher {
+    
+    /** Returns: The block size in bytes that this cipher will operate on. */
+    uint blockSize();
+    
+    /**
+     * Process a block of data from the input array
+     * and place it into the output array.
+     *
+     * Params:
+     *     input_  = Array containing input data.
+     *     inOff   = Offset at where the data in input_ starts.
+     *     output_ = Array which will hold the output data.
+     *     outOff  = Offset at which to begin placing data in output_.
+     *
+     * Returns: The number of bytes processed (typically blockSize).
+     *
+     * Throws: dcrypt.crypto.errors.NotInitializedError if cipher
+     *         was not initialized.
+     */
+    uint processBlock(void[] input_, 
+                          uint inOff, void[] output_, uint outOff);
+
+}