public static byte[] generateSalt() throws NoSuchAlgorithmException {
        SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
        byte[] salt = new byte[8];
        random.nextBytes(salt);
        return salt;
    }
public static byte [ ] generateSalt ( ) throws NoSuchAlgorithmException { SecureRandom random = SecureRandom . getInstance ( "SHA1PRNG" ) ; byte [ ] salt = new byte [ 8 ] ; random . nextBytes ( salt ) ; return salt ; }
Generate a random salt.

@return
the random salt.
@throws NoSuchAlgorithmException
the NoSuchAlgorithmException.