sam.cipher
Class Mars
java.lang.Object
|
+--sam.cipher.Cipher
|
+--sam.cipher.Mars
- public class Mars
- extends Cipher
Implementation of the MARS cipher.
Retrofitted for personal use by Guillaume Lacôte.
MARS is a submission to AES from a team of researchers at IBM.
MARS_Algorithm.java reference code - copyright(c) 1998 IBM.
All rights reserved.
Parts Copyright (c) 1997, 1998 Systemics Ltd on behalf of
the Cryptix Development Team. All rights reserved.
Portions of this code are Copyright © 1997, 1998
Systemics Ltd on behalf of the
Cryptix DevelopmentTeam.
All rights reserved.
$Revision: $
Nested Class Summary |
static class |
Mars.Key
Key implementation that is adapted to the Mars cipher. |
Constructor Summary |
Mars(sam.cipher.Key key)
|
Method Summary |
protected void |
decrypt(byte[] data,
int offset,
sam.cipher.Key sessionKey)
Decrypt exactly one block of ciphertext. |
protected void |
encrypt(byte[] data,
int offset,
sam.cipher.Key sessionKey)
Encrypt exactly one block of plaintext. |
protected int |
getPreferredSize(int size)
Gets the preferred cipher block size |
Methods inherited from class sam.cipher.Cipher |
cipher, cipher, fill, main, store, store, storeReversed, streamTest, test, unstoreInt, unstoreLong, unstoreReversedLong |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Mars
public Mars(sam.cipher.Key key)
getPreferredSize
protected int getPreferredSize(int size)
- Gets the preferred cipher block size
- Overrides:
getPreferredSize
in class Cipher
- Parameters:
size
- proposed buffer size (in bytes)
- Returns:
- The length in bytes of the Algorithm input block.
encrypt
protected void encrypt(byte[] data,
int offset,
sam.cipher.Key sessionKey)
- Encrypt exactly one block of plaintext.
- Specified by:
encrypt
in class Cipher
- Parameters:
sessionKey
- The session key to use for encryption.
decrypt
protected void decrypt(byte[] data,
int offset,
sam.cipher.Key sessionKey)
- Decrypt exactly one block of ciphertext.
- Specified by:
decrypt
in class Cipher
- Parameters:
sessionKey
- The session key to use for decryption.