Class UnixCrypt

java.lang.Object
org.eclipse.jetty.util.security.UnixCrypt

public class UnixCrypt extends Object
Unix 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 final byte[]
     
    private static final long[][]
     
    private static final byte[]
     
    private static final byte[]
     
    private static final long[][]
     
    private static final byte[]
     
    private static final byte[]
     
    private static final byte[]
     
    private static final byte[]
     
    private static final long[][]
     
    private static final byte[]
     
    private static final long[][][]
     
    private static final byte[]
     
    private static final byte[][]
     
    private static final long[][]
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    You can't call the constructer.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    crypt(String key, String 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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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
  • Constructor Details

    • UnixCrypt

      private UnixCrypt()
      You can't call the constructer.
  • Method Details

    • 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 String crypt(String key, String setting)
      Encrypts String into crypt (Unix) code.
      Parameters:
      key - the key to be encrypted
      setting - the salt to be used
      Returns:
      the encrypted String
    • main

      public static void main(String[] arg)