Java Salt Value Create generateSalt()

Here you can find the source of generateSalt()

Description

Generate a random salt value of 8 bytes

License

Apache License

Return

Salt data

Declaration

private static byte[] generateSalt() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.security.SecureRandom;

public class Main {
    private static final SecureRandom random = new SecureRandom();

    /**/*  ww  w  .j a v a 2 s .  c  o m*/
     * Generate a random salt value of 8 bytes
     *
     * @return Salt data
     */
    private static byte[] generateSalt() {
        final byte[] salt = new byte[8];
        random.nextBytes(salt);
        return salt;
    }
}

Related

  1. generateSalt()
  2. generateSalt()
  3. generateSalt()
  4. generateSalt()
  5. generateSalt()
  6. generateSalt()
  7. generateSalt()
  8. generateSalt(final Integer size)
  9. generateSalt(int bits)