dbuser/src/test/java/no/kantega/security/api/impl/dbuser/password/CopyOfMD5Crypt.java
/**
     * LINUX/BSD MD5Crypt function
     * @return The encrypted password as an MD5 hash
     * @param password Password to be encrypted
     */
LINUX/BSD MD5Crypt function
@return The encrypted password as an MD5 hash
@param password Password to be encrypted
LINUX / BSD MD5Crypt function @return The encrypted password as an MD5 hash @param password Password to be encrypted
public String crypt(String password) throws NoSuchAlgorithmException {
        StringBuffer salt = new StringBuffer();
        java.util.Random rnd = new java.util.Random();
        while (salt.length() < 8)
        {
            int index = (int) (rnd.nextFloat() * SALTCHARS.length());
            salt.append(SALTCHARS.substring(index, index+1));
        }
        return crypt(password, salt.toString(), "$1$");
    }
public String crypt ( String password ) throws NoSuchAlgorithmException { StringBuffer salt = new StringBuffer ( ) ; java . util . Random rnd = new java . util . Random ( ) ; while ( salt . length ( ) < 8 ) { int index = ( int ) ( rnd . nextFloat ( ) * SALTCHARS . length ( ) ) ; salt . append ( SALTCHARS . substring ( index , index + 1 ) ) ; } return crypt ( password , salt . toString ( ) , "$1$" ) ; }
LINUX/BSD MD5Crypt function
 @return The encrypted password as an MD5 hash
 @param password Password to be encrypted
LINUX / BSD MD5Crypt function @return The encrypted password as an MD5 hash @param password Password to be encrypted
// build a random 8 chars salt // crypt