|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.logi.crypto.Crypto | +--org.logi.crypto.keys.K | +--org.logi.crypto.keys.SymmetricKey | +--org.logi.crypto.keys.BlowfishKey
This is the class for Blowfish keys. It is a feistel blockcipher with a 64-bit block size and variable key-size. It was designed by Bruce Schneier and is in the public domain. (This implementation is licensed in the same way as the rest of the logi.crypto package.)
This implementation was made from the description given in Schneier's book Applied Cryptography.
The CDS for a Blowfish key is BlowfishKey(key)
with
key
a string of hexadecimal digits to create a specific
key or BlowfishKey(?)
for a random BlowfishKey object.
Fields inherited from class org.logi.crypto.Crypto |
BIT,
cdsPath,
EMPTY_ARRAY,
FOUR,
keySource,
NIBBLE,
ONE,
primeCertainty,
random,
TWO,
ZERO |
Constructor Summary | |
BlowfishKey()
Create a new random 448 bit Blowfish key. |
|
BlowfishKey(byte[] key)
Create a new Blowfish key with the key bits from key . |
|
BlowfishKey(int n)
Create a new random n-bit Blowfish key. |
Method Summary | |
int |
cipherBlockSize()
The block-size for the Blowfish cipher is 8 bytes. |
void |
decrypt(byte[] source,
int i,
byte[] dest,
int j)
Decrypt one block of data. |
void |
encrypt(byte[] source,
int i,
byte[] dest,
int j)
Encrypt one block of data. |
boolean |
equals(java.lang.Object o)
Return true iff the two keys are equivalent. |
java.lang.String |
getAlgorithm()
The name of the algorithm is "Blowfish". |
byte[] |
getKey()
Return the key-bits for this key as an array of bytes. |
int |
getSize()
Return the size of this key. |
static BlowfishKey |
parseCDS(java.lang.String key)
If "BlowfishKey( key )" is a valid CDS for a BlowfishKey, then BlowfishKey.parseCDS(key) will return the described BlowfishKey object. |
int |
plainBlockSize()
The block-size for the Blowfish cipher is 8 bytes. |
java.lang.String |
toString()
Return a CDS for this key. |
Methods inherited from class org.logi.crypto.keys.SymmetricKey |
isPrivate,
matches |
Methods inherited from class org.logi.crypto.keys.K |
getFingerprint,
getFingerprint,
hashCode,
matchFingerprint,
matchFingerprint |
Methods inherited from class org.logi.crypto.Crypto |
binString,
binString,
equal,
equalRelaxed,
equalSub,
fromHexNibble,
fromHexString,
fromString,
fromString,
hexString,
hexString,
hexString,
hexString,
hexString,
initRandom,
initRandom,
makeClass,
makeInt,
makeLong,
makeSessionKey,
pastSpace,
pickBits,
pickBits,
readInt,
writeBytes,
writeBytes,
writeInt |
Methods inherited from class java.lang.Object |
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public BlowfishKey(int n)
public BlowfishKey()
public BlowfishKey(byte[] key)
key
.Method Detail |
public static BlowfishKey parseCDS(java.lang.String key) throws InvalidCDSException
A valid CDS can be created by calling the BlowfishKey.toString() method.
Crypto.fromString(String)
public int plainBlockSize()
public int cipherBlockSize()
public int getSize()
public java.lang.String getAlgorithm()
public boolean equals(java.lang.Object o)
public byte[] getKey()
public java.lang.String toString()
Crypto.fromString(java.io.Reader)
public void encrypt(byte[] source, int i, byte[] dest, int j)
source[i..i+7]
and ciphertext is written to
dest[j..j+7]
public void decrypt(byte[] source, int i, byte[] dest, int j)
source[i..i+7]
and plaintext is written to
dest[j..j+7]
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |