Mercurial > projects > dcrypt
view dcrypt/crypto/params/ParametersWithIV.d @ 2:71aae178f89a
Added copy() to hash functions. Modified some code style.
author | Thomas Dixon <reikon@reikon.us> |
---|---|
date | Wed, 13 Aug 2008 22:01:19 -0400 |
parents | 0e08791a1418 |
children | 5ce3012f1def |
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.params.ParametersWithIV; public import dcrypt.crypto.params.CipherParameters; /** Wrap cipher parameters and IV. */ class ParametersWithIV : CipherParameters { private ubyte[] m_iv; private CipherParameters m_params; /** * Params: * params = Parameters to wrap. * iv = IV to be held. */ this (CipherParameters params=null, ubyte[] iv_=null) { if (params) m_params = params; ubyte[] iv = cast(ubyte[]) iv_; if (iv) m_iv = iv; } /** Returns: The IV. */ ubyte[] iv() { return m_iv; } /** * Set the IV held by this object. * * Params: * newIV = The new IV for this parameter object. * Returns: The new IV. */ ubyte[] iv(void[] newIV_) { ubyte[] newIV = cast(ubyte[]) newIV_; return m_iv = newIV; } /** Returns: The parameters for this object. */ CipherParameters parameters() { return m_params; } /** * Set the parameters held by this object. * * Params: * newParams = The new parameters to be held. * Returns: The new parameters. */ CipherParameters parameters(CipherParameters newParams) { return m_params = newParams; } }