view 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 source

/**
 * 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);

}