Mercurial > projects > dcrypt
diff dcrypt/crypto/Cipher.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/Cipher.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.Cipher; + +public import dcrypt.crypto.errors.InvalidKeyError; +public import dcrypt.crypto.errors.ShortBufferError; +public import dcrypt.crypto.errors.NotInitializedError; +public import dcrypt.crypto.errors.InvalidParameterError; + +public import dcrypt.crypto.params.CipherParameters; + +/** Base cipher class */ +interface Cipher { + static const bool ENCRYPT = true, + DECRYPT = false; + + /** + * Initialize a cipher. + * + * Params: + * encrypt = True if we are encrypting. + * params = Parameters to be passed to the cipher. (Key, rounds, etc.) + */ + abstract void init(bool encrypt, CipherParameters params); + + /** Returns: The name of the algorithm of this cipher. */ + abstract char[] name(); + + /** Reset cipher to its state immediately subsequent the last init. */ + abstract void reset(); + +}