Here you can find the source of generateSalt(int clientNonceByteCount)
public static String generateSalt(int clientNonceByteCount)
//package com.java2s; /*/*w w w . j a v a 2 s. co m*/ * Copyright (C) 2015 - 2016 Emmanuel Tourdot * * See the NOTICE file distributed with this work for additional information regarding copyright ownership. * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this software. * If not, see <http://www.gnu.org/licenses/>. * */ import javax.xml.bind.DatatypeConverter; import java.security.SecureRandom; public class Main { private static SecureRandom randomGenerator; public static String generateSalt(int clientNonceByteCount) { final byte[] salt = new byte[clientNonceByteCount]; randomGenerator.nextBytes(salt); return DatatypeConverter.printHexBinary(salt).toLowerCase(); } }