Sharkysoft home

lava.security.des.spec
Class DesPermutation

java.lang.Object
  |
  +--lava.security.des.spec.DesPermutation

public final class DesPermutation
extends java.lang.Object

DES permutation tables.

Details: This class provides convenient access to all of the permutation functions described in the official DES specification. This class defines one variable for each permutation.

Since:
1999.08.04
Author:
Sharky

Field Summary
static DesPermutation fkcp
          Final key compression permutation.
static DesPermutation ftp
          Final text permutation.
static DesPermutation ikcp
          Initial key compression permutation.
static DesPermutation itp
          Initial text permutation.
static DesPermutation pbp
          P box permutation.
static DesPermutation tep
          Text expansion permutation.
 
Method Summary
 int getFipsValue(int fipsindex)
          Returns value from permutation table.
 int getReorderedValue(int bitindex)
          Returns value from reordered permutation table.
 int getTableSize()
          Returns table size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ikcp

public static final DesPermutation ikcp
Initial key compression permutation.

Details: This instance describes the initial key compression permutation, identified in FIPS PUB 46-2 as "permuted choice 1" (PC-1).


fkcp

public static final DesPermutation fkcp
Final key compression permutation.

Details: This instance describes the final key compression permutation, identified in FIPS PUB 46-2 as "permuted choice 2" (PC-2).


itp

public static final DesPermutation itp
Initial text permutation.

Details: This instance describes the initial text permutation, which is identified in FIPS PUB 46-2 as the "initial permutation" (IP).


ftp

public static final DesPermutation ftp
Final text permutation.

Details: This instance describes the final text permutation, identified in FIPS PUB 46-2 as the "inverse of the initial permutation" (IP-1).


tep

public static final DesPermutation tep
Text expansion permutation.

Details: This instance describes the text expansion permutation, identified in FIPS PUB 46-2 as the function "E" ("E bit-selection table").


pbp

public static final DesPermutation pbp
P box permutation.

Details: This instance describes the P box permutation, identified in FIPS PUB 46-2 as the "primitive function P".

Method Detail

getTableSize

public final int getTableSize()
Returns table size.

Details: This method returns the number of entries in the permutation table.

Returns:
the size

getFipsValue

public final int getFipsValue(int fipsindex)
Returns value from permutation table.

Details: This method returns an entry from the table. Both the index into the table and the returned value correspond to the FIPS bit numbering scheme. (The leftmost bit is bit number 1.) fipsindex is the index of the output bit, and the return value is the index of the input bit.

For example, if getFipsValue(7) returns 3, then bit 7 of the permutation function's output is the same as bit 3 of the permutation function's input.

Parameters:
fipsindex - the index of the output bit
Returns:
the index of the input bit

getReorderedValue

public final int getReorderedValue(int bitindex)
Returns value from reordered permutation table.

Details: This method returns an entry from the "reordered" table. By "reordered", we mean that bits are numbered as naturally as possible for software, with the right most bit indexed as "0" and the indeces increasing to the right. bitindex is the index of the output bit, and the return value is the index of the input bit.

For example, if getFipsValue(7) returns 3, then bit 7 of the permutation function's output is the same as bit 3 of the permutation function's input.

Parameters:
bitindex - the index of the output bit
Returns:
the index of the input bit

Sharkysoft home