Mercurial > projects > dcrypt
diff dcrypt/crypto/BlockCipherPadding.d @ 0:0e08791a1418
Initial import.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Sun, 10 Aug 2008 14:20:17 -0400 |
parents | |
children | cd376996cdb3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dcrypt/crypto/BlockCipherPadding.d Sun Aug 10 14:20:17 2008 -0400 @@ -0,0 +1,41 @@ +/** + * 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.BlockCipherPadding; + + public import dcrypt.crypto.errors.InvalidPaddingError; + + /** Base padding class for implementing block padding schemes. */ + abstract class BlockCipherPadding { + /** Returns: The name of the padding scheme implemented. */ + char[] name(); + + /** + * Pad the (last) block of plaintext to block length. + * + * Params: + * input_ = Plaintext block to be padded. + * inOffset = Offset at which to begin padding input_. + * + * Returns: The number of padding bytes added. + */ + uint padBlock(void[] input_, uint inOff); + + /** + * Return the number of pad bytes in the block. + * + * Params: + * input_ = Padded block of which to count the pad bytes. + * + * Returns: The number of pad bytes in the block. + * + * Throws: dcrypt.crypto.errors.InvalidPaddingError if + * pad length cannot be discerned. + */ + uint padLength(void[] input_); + }