Here you can find the source of generateSalt()
public static String generateSalt() throws NoSuchAlgorithmException
//package com.java2s; //License from project: Open Source License import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; public class Main { public static String generateSalt() throws NoSuchAlgorithmException { SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); return String.valueOf(secureRandom.nextInt()); }//from ww w .j a v a 2s.co m }