Top Description Fields Constructors Methods
org.mortbay.jetty.security

public Class UnixCrypt

extends Object
Class Inheritance

Unix Crypt. Implements the one way cryptography used by Unix systems for simple password protection.
Author
Greg Wilkins (gregw)
Version
$Id: UnixCrypt.java,v 1.1 2005/10/05 14:09:14 janb Exp $

Field Summary

Modifier and TypeField and Description
private static byte[]
private static long[][]
private static final byte[]
private static final byte[]
private static long[][]
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static long[][]
private static final byte[]
private static long[][][]
private static final byte[]
private static final byte[][]
S

private static long[][]

Constructor Summary

AccessConstructor and Description
private
UnixCrypt()

You can't call the constructer.

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the encrypted String
crypt
(String
the key to be encrypted
key
,
String
the salt to be used
setting
)

Encrypts String into crypt (Unix) code.

private static long
des_cipher(long in, int salt, int num_iter, long[] KS)

Returns the DES encrypted code of the given word with the specified environment.

private static long[]
des_setkey(long keyword)

Returns the key schedule for the given key.

private static void
init_perm(long[][] perm, byte[] p, int chars_out)

Initializes the given permutation table with the mapping table.

public static void
main(String[] arg)

private static long
perm3264(int c, long[][] p)

Returns the permutation of the given 32-bit code with the specified permutataion table.

private static long
perm6464(long c, long[][] p)

Returns the permutation of the given 64-bit code with the specified permutataion table.

private static int
to_six_bit(int num)

Returns the transposed and split code of a 24-bit code into a 4-byte code, each having 6 bits.

private static long
to_six_bit(long num)

Returns the transposed and split code of two 24-bit code into two 4-byte code, each having 6 bits.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

A64TOIback to summary
private static byte[] A64TOI
CF6464back to summary
private static long[][] CF6464
CIFPback to summary
private static final byte[] CIFP
ExpandTrback to summary
private static final byte[] ExpandTr
IE3264back to summary
private static long[][] IE3264
IPback to summary
private static final byte[] IP
ITOA64back to summary
private static final byte[] ITOA64
P32Trback to summary
private static final byte[] P32Tr
PC1back to summary
private static final byte[] PC1
PC1ROTback to summary
private static long[][] PC1ROT
PC2back to summary
private static final byte[] PC2
PC2ROTback to summary
private static long[][][] PC2ROT
Rotatesback to summary
private static final byte[] Rotates
Sback to summary
private static final byte[][] S
SPEback to summary
private static long[][] SPE

Constructor Detail

UnixCryptback to summary
private UnixCrypt()

You can't call the constructer.

Method Detail

cryptback to summary
public static String crypt(String key, String setting)

Encrypts String into crypt (Unix) code.

Parameters
key:String

the key to be encrypted

setting:String

the salt to be used

Returns:String

the encrypted String

des_cipherback to summary
private static long des_cipher(long in, int salt, int num_iter, long[] KS)

Returns the DES encrypted code of the given word with the specified environment.

des_setkeyback to summary
private static long[] des_setkey(long keyword)

Returns the key schedule for the given key.

init_permback to summary
private static void init_perm(long[][] perm, byte[] p, int chars_out)

Initializes the given permutation table with the mapping table.

mainback to summary
public static void main(String[] arg)
perm3264back to summary
private static long perm3264(int c, long[][] p)

Returns the permutation of the given 32-bit code with the specified permutataion table.

perm6464back to summary
private static long perm6464(long c, long[][] p)

Returns the permutation of the given 64-bit code with the specified permutataion table.

to_six_bitback to summary
private static int to_six_bit(int num)

Returns the transposed and split code of a 24-bit code into a 4-byte code, each having 6 bits.

to_six_bitback to summary
private static long to_six_bit(long num)

Returns the transposed and split code of two 24-bit code into two 4-byte code, each having 6 bits.