|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sam.cipher.Cipher | +--sam.cipher.WarFactory.War
Actual War
implementation
Nested Class Summary |
Nested classes inherited from class sam.cipher.Cipher |
Cipher.ByteArrayFilter, Cipher.Error |
Field Summary |
Fields inherited from class sam.cipher.Cipher |
DECRYPT, EMPTY, ENCRYPT, INVERSE, key, REGISTRY |
Constructor Summary | |
protected |
WarFactory.War(WarFactory.Key key)
Builds a new War cipher. |
Method Summary | |
protected void |
decrypt(byte[] data,
int offset,
sam.cipher.Key key)
Decrypts exactly one block of ciphertext. |
protected void |
encrypt(byte[] data,
int offset,
sam.cipher.Key key)
Encrypts exactly one block of plaintext. |
int |
getPreferredSize(int size)
Specifiy preferred buffer size. |
protected void |
rotate(byte[] data,
int offset,
boolean[] directions)
Main permutation routine. |
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 |
Constructor Detail |
protected WarFactory.War(WarFactory.Key key)
War
cipher.
key
- the fixed key to be used (either encryption or decryption key)Key
Method Detail |
public int getPreferredSize(int size)
Cipher
May return a fixed value, ignoring suggested size (e.g. return 16;
).
By default, this implementation simply returns its argument unchanged.
getPreferredSize
in class Cipher
size
- proposed buffer size (in bytes)
protected void encrypt(byte[] data, int offset, sam.cipher.Key key)
encrypt
in class Cipher
data
- The plaintext.key
- The session key to use for encryption.protected void decrypt(byte[] data, int offset, sam.cipher.Key key)
decrypt
in class Cipher
data
- The plaintext.key
- The session key to use for decryption.protected void rotate(byte[] data, int offset, boolean[] directions)
This works as follows: given a square
it first rotates block either clockwiseA B C D
or counter-clockwiseC A D B
according toB D A C
directions
's lowest bit.
It then recurses into each of the four squares for the next bits.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |