Here you can find the source of generateSalt()
public static byte[] generateSalt()
//package com.java2s; //License from project: Open Source License import java.security.SecureRandom; import java.util.function.Supplier; public class Main { private static final ThreadLocal<SecureRandom> SECURERANDOMS = new ThreadLocal<>(); public static byte[] generateSalt() { return newByteGenerator(64).get(); }//from www . ja v a 2s .c o m public static Supplier<byte[]> newByteGenerator(int size) { return () -> { byte[] iv = new byte[size]; if (SECURERANDOMS.get() == null) SECURERANDOMS.set(new SecureRandom()); SECURERANDOMS.get().nextBytes(iv); return iv; }; } }