|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tribble.crypto.AbstractCipher tribble.crypto.SymmetricCipher tribble.crypto.ZoidfarbCipher
Zoidfarb cryptographic symmetric block cipher. Encrypts or decrypts a 160-bit (20-byte) data block using a 128-bit symmetric encryption key.
Note that none of these methods are synchronized.
Acknowledgments
This code is based on an original algorithm invented by David R. Tribble in April 2003. This is version "C" of the algorithm.
License is granted to use this algorithm without fees or restrictions for all private and commercial uses.
Copyright ©2003-2005 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code
provided that the original copyright and authorship notices remain
intact.
tribble.security.ZoidfarbHash
Field Summary |
Fields inherited from class tribble.crypto.SymmetricCipher |
m_blockLen |
Fields inherited from class tribble.crypto.AbstractCipher |
m_alg, m_decrypt, m_init, m_keyLen |
Constructor Summary | |
ZoidfarbCipher()
Default constructor. |
Method Summary | |
protected void |
blockDecrypt(byte[] in,
int inOff,
byte[] out,
int outOff)
Decrypt a block of ciphertext. |
protected void |
blockEncrypt(byte[] in,
int inOff,
byte[] out,
int outOff)
Encrypt a block of plaintext. |
protected void |
clear()
Clear (wipe) this cipher. |
protected void |
initialize(byte[] key,
boolean decrypt)
Initialize this cipher. |
static void |
main(java.lang.String[] args)
Test driver. |
Methods inherited from class tribble.crypto.SymmetricCipher |
getBlockSize, test, test |
Methods inherited from class tribble.crypto.AbstractCipher |
finalize, getAlgorithm, getKeySize, getKeySizes |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ZoidfarbCipher()
Method Detail |
public static final void main(java.lang.String[] args) throws java.lang.Exception
args
- Command line arguments.
java.lang.Exception
- Thrown if an error occurs in the encryption engine.protected void initialize(byte[] key, boolean decrypt) throws java.security.InvalidKeyException
initialize
in class AbstractCipher
key
- The symmetric (secret) key for this cipher.decrypt
- If true, this indicates that this cipher is to be initialized for
decrypting, otherwise it is to be initialized for encrypting.
java.security.InvalidKeyException
clear()
protected void clear()
Note that this cipher object can no longer be used after this method has been called.
clear
in class AbstractCipher
initialize()
protected void blockEncrypt(byte[] in, int inOff, byte[] out, int outOff)
blockEncrypt
in class SymmetricCipher
in
- Array containing a single block of plaintext bytes to encrypt.
The length of the block is exactly equal to the cipher block size
(160 bits, 20 bytes).inOff
- Index of the first byte of the plaintext block within array in to
encrypt.out
- Array that will be filled with the encrypted ciphertext block.
The length of the block is exactly equal to the cipher block size
(160 bits, 20 bytes).outOff
- Index of the first byte of array out to fill with the encrypted
ciphertext block.blockDecrypt()
,
initialize()
protected void blockDecrypt(byte[] in, int inOff, byte[] out, int outOff)
blockDecrypt
in class SymmetricCipher
in
- Array containing a single block of ciphertext bytes to decrypt.
The length of the block is exactly equal to the cipher block size
(160 bits, 20 bytes).inOff
- Index of the first byte of the ciphertext block within array in
to decrypt.out
- Array that will be filled with the decrypted plaintext block.
The length of the block is exactly equal to the cipher block size
(160 bits, 20 bytes).outOff
- Index of the first byte of array out to fill with the decrypted
plaintext block.blockEncrypt()
,
initialize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |