Java Utililty Methods Salt Value Create

List of utility methods to do Salt Value Create

Description

The list of methods to do Salt Value Create are organized into topic(s).

Method

byte[]createSalt()
create Salt
byte[] salt = new byte[8];
Random random = new Random();
random.nextBytes(salt);
return salt;
byte[]createSalt(int byte_length)
Creates a random filled byte array
if (byte_length < 1) {
    return new byte[0];
Random rand = new Random();
byte[] arr = new byte[byte_length];
rand.nextBytes(arr);
return arr;
byte[]generateSalt()
Generates secure random bytes.
return generateSalt(SALT_DEFAULT_SIZE);
byte[]generateSalt()
Generates a radom salt
try {
    SecureRandom random = SecureRandom.getInstance(SALT_ALGORITHM);
    byte[] salt = new byte[SALT_LENGTH];
    random.nextBytes(salt);
    return salt;
} catch (final NoSuchAlgorithmException exc) {
    exc.printStackTrace();
return null;
byte[]generateSalt()
generate Salt
try {
    final byte[] salt = new byte[8];
    final SecureRandom saltGen = SecureRandom.getInstance("SHA1PRNG");
    saltGen.nextBytes(salt);
    return salt;
} catch (NoSuchAlgorithmException e) {
    throw new RuntimeException(e);
intgenerateSalt()
generate Salt
return new SecureRandom().nextInt();
StringgenerateSalt()
generate Salt
return generateSalt(rand.nextInt(10) + 5);
StringgenerateSalt()
Returns a salt.
final Random r = new SecureRandom();
byte[] salt = new byte[8];
r.nextBytes(salt);
return toHex(salt);
StringgenerateSalt()
generate Salt
KeyGenerator keyGenerator = KeyGenerator.getInstance(AES);
keyGenerator.init(KEY_SIZE);
return byteArrayToHexString(keyGenerator.generateKey().getEncoded());
byte[]generateSalt()
generate Salt
return newByteGenerator(64).get();