public static final String crypt ( String original ) { java . util . Random randomGenerator = new java . util . Random ( ) ; int numSaltChars = saltChars . length ; String salt ; salt = ( new StringBuffer ( ) ) . append ( saltChars [ Math . abs ( randomGenerator . nextInt ( ) ) % numSaltChars ] ) . append ( saltChars [ Math . abs ( randomGenerator . nextInt ( ) ) % numSaltChars ] ) . toString ( ) ; return crypt ( salt , original ) ; }
Encrypt a password given the cleartext password . This method generates a random salt using the java . util . Random class .