Here you can find the source of generateSalt()
private static byte[] generateSalt()
//package com.java2s; //License from project: Open Source License import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; public class Main { private static byte[] generateSalt() { try {/* w w w .j a va 2 s. c om*/ final byte[] salt = new byte[8]; final SecureRandom saltGen = SecureRandom.getInstance("SHA1PRNG"); saltGen.nextBytes(salt); return salt; } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } }