Here you can find the source of generateSalt()
public static String generateSalt()
//package com.java2s; /**/*from w w w . j a va 2s . c o m*/ * Licensed under the GNU LGPL v.2.1 or later. */ import java.math.BigInteger; import java.security.SecureRandom; public class Main { /** * Generates a salt for working with passwords. * * @return A salt */ public static String generateSalt() { return new BigInteger(40, new SecureRandom()).toString(32); } }