Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.84
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.bouncycastle.crypto.engines
Class SerpentEngineBase

    java.lang.Object
      org.bouncycastle.crypto.engines.SerpentEngineBase

All Implemented Interfaces:
  BlockCipher

Direct Known Subclasses:
  SerpentEngine, TnepresEngine

public abstract class SerpentEngineBase
extends java.lang.Object
implements BlockCipher

Field Summary
`protected static int` | `BLOCK_SIZE`
`protected boolean` | `encrypting`
`protected int` | `keyBits`
`protected int[]` | `wKey`

Method Summary
`protected abstract void` | `decryptBlock(byte[] input, int inOff, byte[] output, int outOff)`
`protected abstract void` | `encryptBlock(byte[] input, int inOff, byte[] output, int outOff)`
`java.lang.String` | `getAlgorithmName()` Return the name of the algorithm the cipher implements.
`int` | `getBlockSize()` Return the block size for this cipher (in bytes).
`protected void` | `ib0(int[] X, int a, int b, int c, int d)` InvSO - {13, 3,11, 0,10, 6, 5,12, 1,14, 4, 7,15, 9, 8, 2 } - 15 terms.
`protected void` | `ib1(int[] X, int a, int b, int c, int d)` InvS1 - { 5, 8, 2,14,15, 6,12, 3,11, 4, 7, 9, 1,13,10, 0 } - 14 steps.
`protected void` | `ib2(int[] X, int a, int b, int c, int d)` InvS2 - {12, 9,15, 4,11,14, 1, 2, 0, 3, 6,13, 5, 8,10, 7 } - 16 steps.
`protected void` | `ib3(int[] X, int a, int b, int c, int d)` InvS3 - { 0, 9,10, 7,11,14, 6,13, 3, 5,12, 2, 4, 8,15, 1 } - 15 terms
`protected void` | `ib4(int[] X, int a, int b, int c, int d)` InvS4 - { 5, 0, 8, 3,10, 9, 7,14, 2,12,11, 6, 4,15,13, 1 } - 15 terms.
`protected void` | `ib5(int[] X, int a, int b, int c, int d)` InvS5 - { 8,15, 2, 9, 4, 1,13,14,11, 6, 5, 3, 7,12,10, 0 } - 16 terms.
`protected void` | `ib6(int[] X, int a, int b, int c, int d)` InvS6 - {15,10, 1,13, 5, 3, 6, 0, 4, 9,14, 7, 2,12, 8,11 } - 15 terms.
`protected void` | `ib7(int[] X, int a, int b, int c, int d)` InvS7 - { 3, 0, 6,13, 9,14,15, 8, 5,12,11, 7,10, 1, 4, 2 } - 17 terms.
`void` | `init(boolean encrypting, CipherParameters params)` initialise a Serpent cipher.
`protected void` | `inverseLT(int[] X)` Apply the inverse of the linear transformation to the register set.
`protected void` | `LT(int[] X)` Apply the linear transformation to the register set.
`protected abstract int[]` | `makeWorkingKey(byte[] key)`
`int` | `processBlock(byte[] in, int inOff, byte[] out, int outOff)` Process one block of input from the array in and write it to the out array.
`void` | `reset()` Reset the cipher.
`protected static int` | `rotateLeft(int x, int bits)`
`protected static int` | `rotateRight(int x, int bits)`
`protected void` | `sb0(int[] X, int a, int b, int c, int d)` S0 - { 3, 8,15, 1,10, 6, 5,11,14,13, 4, 2, 7, 0, 9,12 } - 15 terms.
`protected void` | `sb1(int[] X, int a, int b, int c, int d)` S1 - {15,12, 2, 7, 9, 0, 5,10, 1,11,14, 8, 6,13, 3, 4 } - 14 terms.
`protected void` | `sb2(int[] X, int a, int b, int c, int d)` S2 - { 8, 6, 7, 9, 3,12,10,15,13, 1,14, 4, 0,11, 5, 2 } - 16 terms.
`protected void` | `sb3(int[] X, int a, int b, int c, int d)` S3 - { 0,15,11, 8,12, 9, 6, 3,13, 1, 2, 4,10, 7, 5,14 } - 16 terms.
`protected void` | `sb4(int[] X, int a, int b, int c, int d)` S4 - { 1,15, 8, 3,12, 0,11, 6, 2, 5, 4,10, 9,14, 7,13 } - 15 terms.
`protected void` | `sb5(int[] X, int a, int b, int c, int d)` S5 - {15, 5, 2,11, 4,10, 9,12, 0, 3,14, 8,13, 6, 7, 1 } - 16 terms.
`protected void` | `sb6(int[] X, int a, int b, int c, int d)` S6 - { 7, 2,12, 5, 8, 4, 6,11,14, 9, 1,15,13, 3,10, 0 } - 15 terms.
`protected void` | `sb7(int[] X, int a, int b, int c, int d)` S7 - { 1,13,15, 0,14, 8, 2,11, 7, 4,12,10, 9, 3, 5, 6 } - 16 terms.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### BLOCK_SIZE

    protected static final int BLOCK_SIZE

See Also:
  Constant Field Values

### encrypting

    protected boolean encrypting

### wKey

    protected int[] wKey

### keyBits

    protected int keyBits

Method Detail

### init

    public void init(boolean encrypting,
                     CipherParameters params)

  initialise a Serpent cipher.

  Specified by:
    `init` in interface `BlockCipher`
  Parameters:
    `encrypting` - whether or not we are for encryption.
    `params` - the parameters required to set up the cipher.
  Throws:
    `java.lang.IllegalArgumentException` - if the params argument is inappropriate.

### getAlgorithmName

    public java.lang.String getAlgorithmName()

  Description copied from interface: `BlockCipher`
  Return the name of the algorithm the cipher implements.

  Specified by:
    `getAlgorithmName` in interface `BlockCipher`
  Returns:
    the name of the algorithm the cipher implements.

### getBlockSize

    public int getBlockSize()

  Description copied from interface: `BlockCipher`
  Return the block size for this cipher (in bytes).

  Specified by:
    `getBlockSize` in interface `BlockCipher`
  Returns:
    the block size for this cipher in bytes.

### processBlock

    public final int processBlock(byte[] in,
                                  int inOff,
                                  byte[] out,
                                  int outOff)

  Process one block of input from the array in and write it to the out array.

  Specified by:
    `processBlock` in interface `BlockCipher`
  Parameters:
    `in` - the array containing the input data.
    `inOff` - offset into the in array the data starts at.
    `out` - the array the output data will be copied into.
    `outOff` - the offset into the out array the output will start at.
  Returns:
    the number of bytes processed and produced.
  Throws:
    `DataLengthException` - if there isn't enough data in in, or space in out.
    `java.lang.IllegalStateException` - if the cipher isn't initialised.

### reset

    public void reset()

  Description copied from interface: `BlockCipher`
  Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one).

  Specified by:
    `reset` in interface `BlockCipher`

### rotateLeft

    protected static int rotateLeft(int x,
                                    int bits)

### rotateRight

    protected static int rotateRight(int x,
                                     int bits)

### sb0

    protected final void sb0(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  S0 - { 3, 8,15, 1,10, 6, 5,11,14,13, 4, 2, 7, 0, 9,12 } - 15 terms.

### ib0

    protected final void ib0(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  InvSO - {13, 3,11, 0,10, 6, 5,12, 1,14, 4, 7,15, 9, 8, 2 } - 15 terms.

### sb1

    protected final void sb1(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  S1 - {15,12, 2, 7, 9, 0, 5,10, 1,11,14, 8, 6,13, 3, 4 } - 14 terms.

### ib1

    protected final void ib1(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  InvS1 - { 5, 8, 2,14,15, 6,12, 3,11, 4, 7, 9, 1,13,10, 0 } - 14 steps.

### sb2

    protected final void sb2(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  S2 - { 8, 6, 7, 9, 3,12,10,15,13, 1,14, 4, 0,11, 5, 2 } - 16 terms.

### ib2

    protected final void ib2(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  InvS2 - {12, 9,15, 4,11,14, 1, 2, 0, 3, 6,13, 5, 8,10, 7 } - 16 steps.

### sb3

    protected final void sb3(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  S3 - { 0,15,11, 8,12, 9, 6, 3,13, 1, 2, 4,10, 7, 5,14 } - 16 terms.

### ib3

    protected final void ib3(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  InvS3 - { 0, 9,10, 7,11,14, 6,13, 3, 5,12, 2, 4, 8,15, 1 } - 15 terms

### sb4

    protected final void sb4(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  S4 - { 1,15, 8, 3,12, 0,11, 6, 2, 5, 4,10, 9,14, 7,13 } - 15 terms.

### ib4

    protected final void ib4(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  InvS4 - { 5, 0, 8, 3,10, 9, 7,14, 2,12,11, 6, 4,15,13, 1 } - 15 terms.

### sb5

    protected final void sb5(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  S5 - {15, 5, 2,11, 4,10, 9,12, 0, 3,14, 8,13, 6, 7, 1 } - 16 terms.

### ib5

    protected final void ib5(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  InvS5 - { 8,15, 2, 9, 4, 1,13,14,11, 6, 5, 3, 7,12,10, 0 } - 16 terms.

### sb6

    protected final void sb6(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  S6 - { 7, 2,12, 5, 8, 4, 6,11,14, 9, 1,15,13, 3,10, 0 } - 15 terms.

### ib6

    protected final void ib6(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  InvS6 - {15,10, 1,13, 5, 3, 6, 0, 4, 9,14, 7, 2,12, 8,11 } - 15 terms.

### sb7

    protected final void sb7(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  S7 - { 1,13,15, 0,14, 8, 2,11, 7, 4,12,10, 9, 3, 5, 6 } - 16 terms.

### ib7

    protected final void ib7(int[] X,
                             int a,
                             int b,
                             int c,
                             int d)

  InvS7 - { 3, 0, 6,13, 9,14,15, 8, 5,12,11, 7,10, 1, 4, 2 } - 17 terms.

### LT

    protected final void LT(int[] X)

  Apply the linear transformation to the register set.

### inverseLT

    protected final void inverseLT(int[] X)

  Apply the inverse of the linear transformation to the register set.

### makeWorkingKey

    protected abstract int[] makeWorkingKey(byte[] key)

### encryptBlock

    protected abstract void encryptBlock(byte[] input,
                                         int inOff,
                                         byte[] output,
                                         int outOff)

### decryptBlock

    protected abstract void decryptBlock(byte[] input,
                                         int inOff,
                                         byte[] output,
                                         int outOff)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.84
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD