Mercurial > 510Connectbot
diff src/ch/ethz/ssh2/crypto/cipher/DESede.java @ 307:071eccdff8ea ganymed
fix java formatting
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 30 Jul 2014 14:16:58 -0700 |
parents | 91a31873c42a |
children |
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/crypto/cipher/DESede.java Wed Jul 30 12:09:51 2014 -0700 +++ b/src/ch/ethz/ssh2/crypto/cipher/DESede.java Wed Jul 30 14:16:58 2014 -0700 @@ -23,87 +23,76 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. + THE SOFTWARE. */ /** * DESede. - * + * * @author See comments in the source file * @version 2.50, 03/15/10 - * + * */ -public class DESede extends DES -{ - private int[] key1 = null; - private int[] key2 = null; - private int[] key3 = null; +public class DESede extends DES { + private int[] key1 = null; + private int[] key2 = null; + private int[] key3 = null; - private boolean encrypt; + private boolean encrypt; - /** - * standard constructor. - */ - public DESede() - { - } + /** + * standard constructor. + */ + public DESede() { + } - /** - * initialise a DES cipher. - * - * @param encrypting - * whether or not we are for encryption. - * @param key - * the parameters required to set up the cipher. - * @exception IllegalArgumentException - * if the params argument is inappropriate. - */ - @Override - public void init(boolean encrypting, byte[] key) - { - key1 = generateWorkingKey(encrypting, key, 0); - key2 = generateWorkingKey(!encrypting, key, 8); - key3 = generateWorkingKey(encrypting, key, 16); - - encrypt = encrypting; - } + /** + * initialise a DES cipher. + * + * @param encrypting + * whether or not we are for encryption. + * @param key + * the parameters required to set up the cipher. + * @exception IllegalArgumentException + * if the params argument is inappropriate. + */ + @Override + public void init(boolean encrypting, byte[] key) { + key1 = generateWorkingKey(encrypting, key, 0); + key2 = generateWorkingKey(!encrypting, key, 8); + key3 = generateWorkingKey(encrypting, key, 16); + encrypt = encrypting; + } - @Override - public String getAlgorithmName() - { - return "DESede"; - } + @Override + public String getAlgorithmName() { + return "DESede"; + } - @Override - public int getBlockSize() - { - return 8; - } + @Override + public int getBlockSize() { + return 8; + } - @Override - public void transformBlock(byte[] in, int inOff, byte[] out, int outOff) - { - if (key1 == null) - { - throw new IllegalStateException("DESede engine not initialised!"); - } + @Override + public void transformBlock(byte[] in, int inOff, byte[] out, int outOff) { + if (key1 == null) { + throw new IllegalStateException("DESede engine not initialised!"); + } - if (encrypt) - { - desFunc(key1, in, inOff, out, outOff); - desFunc(key2, out, outOff, out, outOff); - desFunc(key3, out, outOff, out, outOff); - } - else - { - desFunc(key3, in, inOff, out, outOff); - desFunc(key2, out, outOff, out, outOff); - desFunc(key1, out, outOff, out, outOff); - } - } + if (encrypt) { + desFunc(key1, in, inOff, out, outOff); + desFunc(key2, out, outOff, out, outOff); + desFunc(key3, out, outOff, out, outOff); + } + else { + desFunc(key3, in, inOff, out, outOff); + desFunc(key2, out, outOff, out, outOff); + desFunc(key1, out, outOff, out, outOff); + } + } - @Override - public void reset() - { - } + @Override + public void reset() { + } }