|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sam.cipher.Factory | +--sam.cipher.WarFactory
Generic variable-size sam.cipher.War
factory.
This allows for dynamic instantiation of War
of various sizes.
War stands for Wide Area Rotator
This class implements a cipher that given a key of size n*p
bits shuffles a data-buffer
of size 4^p
bytes n
times. For the actual implementation, p = 8
so that the buffer is 65536 bytes wide.
Easy to break out by brute force (due to small keys: for example n*8
bits,
implying only n*65536
attack cases, which is not so big after all),
it is not intended to be used solely, but rather as a destructuring step in the ciphering stack.
Nested Class Summary | |
protected class |
WarFactory.Key
General purpose key class. |
class |
WarFactory.War
Actual War implementation |
Field Summary | |
int |
keyBits
Number of bits per key element |
int |
length
Total buffer length, i.e. |
int |
size
Size of the square composing the buffer |
Fields inherited from class sam.cipher.Factory |
description, name |
Constructor Summary | |
WarFactory(int keyBits)
Builds a variable-size new War factory. |
Method Summary | |
int |
getPreferredKeySize(int size)
Specifies preferred key size, in bits. |
protected sam.cipher.Cipher |
make(long[] material,
boolean direction)
Instantiates a new WarFactory.War cipher. |
protected boolean[] |
resize(long[] bits)
Resizes key to the uppest lower multiple of keyBits
If the current size is larger, the key is truncated. |
Methods inherited from class sam.cipher.Factory |
highestIn, highestMultiple, ranged, resizeKey, resizeKeyToPreferredSize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final int keyBits
public final int size
public final int length
size^2
Constructor Detail |
public WarFactory(int keyBits)
War
factory.
keyBits
- Number of bits per key element
Note that this also registers thie factoryRegistry.register(sam.cipher.Factory)
Method Detail |
public int getPreferredKeySize(int size)
Factory
getPreferredKeySize
in class Factory
size
- the suggested key size as computed from the password length
Key
,
Factory.highestMultiple(int, int)
protected sam.cipher.Cipher make(long[] material, boolean direction) throws java.lang.Error
WarFactory.War
cipher.
make
in class Factory
material
- the key as full long
s, its length having been retrofitted by the
getPreferredKeySize
method.direction
- true
if encrypting, false
otherwise (decrypting).
java.lang.Error
- in case of impossible instantiationCipher.ENCRYPT
,
Cipher.DECRYPT
protected boolean[] resize(long[] bits) throws java.lang.Error
key
to the uppest lower multiple of keyBits
If the current size is larger, the key is truncated.
If it is smaller, the key is concatenated to itself until it is large enough.
bits
- the key material to be resized
java.lang.Error
- if this key is empty and expected size is not
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |