<commit_before>package br.com.dbsoft.util;

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;

import org.apache.log4j.Logger;


/**
 * @author ricardo.villar
 *
 */
/**
 * @author ricardo.villar
 *
 */
public class DBSPassword {

	protected static Logger	wLogger = Logger.getLogger(DBSPassword.class);

	public static String 	Algorithm = 	"PBKDF2WithHmacSHA1";
	public static String 	Algorithm256 = 	"PBKDF2WithHmacSHA256";
	public static String 	Algorithm512 = 	"PBKDF2WithHmacSHA512";
	public static String	Salt = "dbs";
	public static int		SaltLenghtInBytes = 15;
	public static int		PasswordLenght = SaltLenghtInBytes * 2;
	public static int		Iterations = 9000;
	public static String	ValidsCharacters = "\\-!@#$%&_+=;:,.";
	
    /**
     * Retorna string com valores em hexa, gerados randomicamente.
     * O tamanho da string retornada é o dobro do tamanho difido por <b>altLenghtInBytes</b>.
     * @return
     * @throws NoSuchAlgorithmException
     */
    public static String createRandomSalt(){
    	return createRandomSalt(SaltLenghtInBytes);
    }
	public static String createRandomSalt(int pTamanho){
		byte[] xSalt = new byte[pTamanho];
		try {
			SecureRandom.getInstance("SHA1PRNG").nextBytes(xSalt);
		} catch (NoSuchAlgorithmException e) {
			wLogger.error(e);
		}
		return DBSString.toHex(xSalt);
    }<commit_msg>Criado método para criptografia usando Algoritmo PBKDF2WithHmacSHA512<commit_after>package br.com.dbsoft.util;

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;

import org.apache.log4j.Logger;


/**
 * @author ricardo.villar
 *
 */
/**
 * @author ricardo.villar
 *
 */
public class DBSPassword {

	protected static Logger	wLogger = Logger.getLogger(DBSPassword.class);

	public static String 	Algorithm 		= "PBKDF2WithHmacSHA1";
	public static String 	Algorithm256 	= "PBKDF2WithHmacSHA256";
	public static String 	Algorithm512 	= "PBKDF2WithHmacSHA512";
	public static String	Salt 			= "dbs";
	public static int		SaltLenghtInBytes = 15;
	public static int		PasswordLenght = SaltLenghtInBytes * 2;
	public static int		Iterations = 9000;
	public static String	ValidsCharacters = "\\-!@#$%&_+=;:,.";
	
    /**
     * Retorna string com valores em hexa, gerados randomicamente.
     * O tamanho da string retornada é o dobro do tamanho difido por <b>altLenghtInBytes</b>.
     * @return
     * @throws NoSuchAlgorithmException
     */
    public static String createRandomSalt(){
    	return createRandomSalt(SaltLenghtInBytes);
    }
	public static String createRandomSalt(int pTamanho){
		byte[] xSalt = new byte[pTamanho];
		try {
			SecureRandom.getInstance("SHA1PRNG").nextBytes(xSalt);
		} catch (NoSuchAlgorithmException e) {
			wLogger.error(e);
		}
		return DBSString.toHex(xSalt);
    }
{'fraction_non_alphanumeric': 0.10227972889710413, 'fraction_numerical': 0.0166358595194085, 'mean_word_length': 4.402662229617304, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4223417', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1086, 'n_words': 244}