Oracle

com.compoze.util
Class IdeaCipher

java.lang.Object
  extended by com.compoze.util.IdeaCipher

public class IdeaCipher
extends java.lang.Object


Field Summary
 int blockSize
           
 int keySize
           
 
Constructor Summary
IdeaCipher()
          Constructor.
IdeaCipher(byte[] key)
           
IdeaCipher(int keySize, int blockSize)
           
IdeaCipher(java.lang.String keyStr)
           
 
Method Summary
 int blockSize()
           
 byte[] decrypt(byte[] cipherText)
          Encrypts some cleartext to a new byte array with ciphertext.
 void decrypt(byte[] cipherText, byte[] clearText)
           
 void decrypt(byte[] cipherText, int cipherOff, byte[] clearText, int clearOff)
           
 byte[] encrypt(byte[] clearText)
          Encrypts some cleartext to a new byte array with ciphertext.
 void encrypt(byte[] clearText, byte[] cipherText)
           
 void encrypt(byte[] clearText, int clearOff, byte[] cipherText, int cipherOff)
           
static byte[] getBytesFromLong(long lLong)
          Get an array of bytes from a long.
static long getLongFromBytes(byte[] byteArray)
           
 int keySize()
           
static void main(java.lang.String[] args)
           
 byte[] makeKey(java.lang.String keyStr)
           
 void setKey(byte[] key)
           
 void setKey(java.lang.String keyStr)
           
static void spreadShortsToBytes(int[] inShorts, int inOff, byte[] outBytes, int outOff, int shortLen)
           
static void squashBytesToShorts(byte[] inBytes, int inOff, int[] outShorts, int outOff, int shortLen)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blockSize

public int blockSize

keySize

public int keySize
Constructor Detail

IdeaCipher

public IdeaCipher()
Constructor.


IdeaCipher

public IdeaCipher(int keySize,
                  int blockSize)

IdeaCipher

public IdeaCipher(java.lang.String keyStr)

IdeaCipher

public IdeaCipher(byte[] key)
Method Detail

blockSize

public int blockSize()

encrypt

public void encrypt(byte[] clearText,
                    byte[] cipherText)

decrypt

public void decrypt(byte[] cipherText,
                    byte[] clearText)

setKey

public void setKey(byte[] key)

encrypt

public byte[] encrypt(byte[] clearText)
               throws java.io.IOException
Encrypts some cleartext to a new byte array with ciphertext.

Throws:
java.io.IOException

decrypt

public byte[] decrypt(byte[] cipherText)
               throws java.io.IOException
Encrypts some cleartext to a new byte array with ciphertext.

Throws:
java.io.IOException

encrypt

public void encrypt(byte[] clearText,
                    int clearOff,
                    byte[] cipherText,
                    int cipherOff)

decrypt

public void decrypt(byte[] cipherText,
                    int cipherOff,
                    byte[] clearText,
                    int clearOff)

keySize

public int keySize()

setKey

public void setKey(java.lang.String keyStr)

makeKey

public byte[] makeKey(java.lang.String keyStr)

squashBytesToShorts

public static void squashBytesToShorts(byte[] inBytes,
                                       int inOff,
                                       int[] outShorts,
                                       int outOff,
                                       int shortLen)

spreadShortsToBytes

public static void spreadShortsToBytes(int[] inShorts,
                                       int inOff,
                                       byte[] outBytes,
                                       int outOff,
                                       int shortLen)

getLongFromBytes

public static long getLongFromBytes(byte[] byteArray)

getBytesFromLong

public static byte[] getBytesFromLong(long lLong)
Get an array of bytes from a long.

Parameters:
lLong - the long
Returns:
the array of bytes

main

public static void main(java.lang.String[] args)

Oracle

Copyright ©1999-2008 Oracle All rights reserved.