gnu.rfb.server
Class DesCipher

java.lang.Object
  extended by gnu.rfb.server.DesCipher

public class DesCipher
extends java.lang.Object

Implements the DES algorithm for encryption / decryption.


Constructor Summary
DesCipher(byte[] key)
          Constructor, byte-array key.
 
Method Summary
 void decrypt(byte[] cipherText, int cipherOff, byte[] clearText, int clearOff)
          Decrypt a block of eight bytes.
 void encrypt(byte[] clearText, int clearOff, byte[] cipherText, int cipherOff)
          Encrypt a block of eight bytes.
 void setKey(byte[] key)
          Setter for 'key'
static void spreadIntsToBytes(int[] inInts, int inOff, byte[] outBytes, int outOff, int intLen)
          Spread ints into bytes.
static void squashBytesToInts(byte[] inBytes, int inOff, int[] outInts, int outOff, int intLen)
          Squash bytes down to ints.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DesCipher

public DesCipher(byte[] key)
Constructor, byte-array key.

Parameters:
key - The key to use for the cipher.
Method Detail

setKey

public void setKey(byte[] key)
Setter for 'key'

Parameters:
key - Sets the key to use for the cipher.

encrypt

public void encrypt(byte[] clearText,
                    int clearOff,
                    byte[] cipherText,
                    int cipherOff)
Encrypt a block of eight bytes.


decrypt

public void decrypt(byte[] cipherText,
                    int cipherOff,
                    byte[] clearText,
                    int clearOff)
Decrypt a block of eight bytes.

Parameters:
cipherText -
cipherOff -
clearText -
clearOff -

squashBytesToInts

public static void squashBytesToInts(byte[] inBytes,
                                     int inOff,
                                     int[] outInts,
                                     int outOff,
                                     int intLen)
Squash bytes down to ints.


spreadIntsToBytes

public static void spreadIntsToBytes(int[] inInts,
                                     int inOff,
                                     byte[] outBytes,
                                     int outOff,
                                     int intLen)
Spread ints into bytes.

Parameters:
inInts -
inOff -
outBytes -
outOff -
intLen -