SecureRandomSaltService.java 361 Bytes
Newer Older
liqin's avatar
liqin committed
1
package cn.chnmuseum.party.auth;
liqin's avatar
liqin committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

import java.security.SecureRandom;

public class SecureRandomSaltService {

	/**
	 * Instance of SecureRandom for generating the salt.
	 */
	private static SecureRandom secureRandom = new SecureRandom();

	public static byte[] generateSalt() {
		byte[] salt = new byte[32];
		secureRandom.nextBytes(salt);
		return salt;
	}

}