static { // Register default implementation so that something is present s_aPHCMgr.registerPasswordHashCreator(new PasswordHashCreatorDefault()); s_aPHCMgr.registerPasswordHashCreator(new PasswordHashCreatorPBKDF2_1000_48()); // Set the default password hash creator s_aPHCMgr.setDefaultPasswordHashCreatorAlgorithm(PasswordHashCreatorPBKDF2_1000_48.ALGORITHM); // Register all custom SPI implementations for (final IPasswordHashCreatorRegistrarSPI aSPI : ServiceLoaderHelper.getAllSPIImplementations(IPasswordHashCreatorRegistrarSPI.class)) aSPI.registerPasswordHashCreators(s_aPHCMgr); }
/** * Create the password hash from the passed plain text password, using the default password hash * creator. * * @param sAlgorithmName The password hash creator algorithm name to query. May neither be <code> * null</code> nor empty. * @param aSalt Optional salt to be used. This parameter is only <code>null</code> for backwards * compatibility reasons. * @param sPlainTextPassword Plain text password. May not be <code>null</code>. * @return The password hash. Never <code>null</code>. */ @Nonnull public static PasswordHash createUserPasswordHash( @Nonnull @Nonempty final String sAlgorithmName, @Nullable final IPasswordSalt aSalt, @Nonnull final String sPlainTextPassword) { return s_aPHCMgr.createUserPasswordHash(sAlgorithmName, aSalt, sPlainTextPassword); }
/** * Create the password hash from the passed plain text password, using the default password hash * creator. * * @param aSalt Optional salt to be used. This parameter is only <code>null</code> for backwards * compatibility reasons. * @param sPlainTextPassword Plain text password. May not be <code>null</code>. * @return The password hash. Never <code>null</code>. */ @Nonnull public static PasswordHash createUserDefaultPasswordHash( @Nullable final IPasswordSalt aSalt, @Nonnull final String sPlainTextPassword) { return s_aPHCMgr.createUserDefaultPasswordHash(aSalt, sPlainTextPassword); }