Package org.eclipse.jetty.util.security
Class UnixCrypt
- java.lang.Object
-
- org.eclipse.jetty.util.security.UnixCrypt
-
public class UnixCrypt extends java.lang.ObjectUnix Crypt. Implements the one way cryptography used by Unix systems for simple password protection.- Version:
- $Id: UnixCrypt.java,v 1.1 2005/10/05 14:09:14 janb Exp $
-
-
Field Summary
Fields Modifier and Type Field Description private static byte[]A64TOIprivate static long[][]CF6464private static byte[]CIFPprivate static byte[]ExpandTrprivate static long[][]IE3264private static byte[]IPprivate static byte[]ITOA64private static byte[]P32Trprivate static byte[]PC1private static long[][]PC1ROTprivate static byte[]PC2private static long[][][]PC2ROTprivate static byte[]Rotatesprivate static byte[][]Sprivate static long[][]SPE
-
Constructor Summary
Constructors Modifier Constructor Description privateUnixCrypt()You can't call the constructer.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringcrypt(java.lang.String key, java.lang.String setting)Encrypts String into crypt (Unix) code.private static longdes_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 voidinit_perm(long[][] perm, byte[] p, int chars_out)Initializes the given permutation table with the mapping table.static voidmain(java.lang.String[] arg)private static longperm3264(int c, long[][] p)Returns the permutation of the given 32-bit code with the specified permutataion table.private static longperm6464(long c, long[][] p)Returns the permutation of the given 64-bit code with the specified permutataion table.private static intto_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 longto_six_bit(long num)Returns the transposed and split code of two 24-bit code into two 4-byte code, each having 6 bits.
-
-
-
Field Detail
-
IP
private static final byte[] IP
-
ExpandTr
private static final byte[] ExpandTr
-
PC1
private static final byte[] PC1
-
Rotates
private static final byte[] Rotates
-
PC2
private static final byte[] PC2
-
S
private static final byte[][] S
-
P32Tr
private static final byte[] P32Tr
-
CIFP
private static final byte[] CIFP
-
ITOA64
private static final byte[] ITOA64
-
A64TOI
private static final byte[] A64TOI
-
PC1ROT
private static final long[][] PC1ROT
-
PC2ROT
private static final long[][][] PC2ROT
-
IE3264
private static final long[][] IE3264
-
SPE
private static final long[][] SPE
-
CF6464
private static final long[][] CF6464
-
-
Method Detail
-
to_six_bit
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_bit
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.
-
perm6464
private static long perm6464(long c, long[][] p)Returns the permutation of the given 64-bit code with the specified permutataion table.
-
perm3264
private static long perm3264(int c, long[][] p)Returns the permutation of the given 32-bit code with the specified permutataion table.
-
des_setkey
private static long[] des_setkey(long keyword)
Returns the key schedule for the given key.
-
des_cipher
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.
-
init_perm
private static void init_perm(long[][] perm, byte[] p, int chars_out)Initializes the given permutation table with the mapping table.
-
crypt
public static java.lang.String crypt(java.lang.String key, java.lang.String setting)Encrypts String into crypt (Unix) code.- Parameters:
key- the key to be encryptedsetting- the salt to be used- Returns:
- the encrypted String
-
main
public static void main(java.lang.String[] arg)
-
-