public interface RandomNumberGenerator
SecureRandom, and indeed implementations of this interface will probably all use
SecureRandominstances, but this interface provides a few additional benefits to end-users:
SecureRandomconcrete implementation. Implementation details can be customized as necessary based on the application's needs
ByteSourceformat in case that data needs to be
RandomNumberGenerator saltGenerator = new
SecureRandomNumberGenerator(); User user = new User(); user.setPasswordSalt(saltGenerator.nextBytes().toBase64()); userDAO.save(user);
|Modifier and Type||Method and Description|
Generates a byte array of fixed length filled with random data, often useful for generating salts, initialization vectors or other seed data.
Generates a byte array of the specified length filled with random data.
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.