/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package plate.wellmann.shop.persistence;

//import java.nio.charset.Charset;
import java.security.SecureRandom;
import java.util.Arrays;
import javax.persistence.Entity;

/**
 *
 * @author Patrick
 */
@Entity
public class Salt extends AbstractEntity {
    
    //private final Charset UTF8_CHARSET = Charset.forName("UTF-8");
    
    private byte[] salt;
    private int interations;

    public Salt(){
        interations = 3072;
        generateSalt();
    }
    
    private void generateSalt() {
        SecureRandom random = new SecureRandom();
        byte bytes[] = new byte[64];
        random.nextBytes(bytes);
        salt = bytes;
    }
    
    public java.lang.String bytetoString(byte[] input) {
        return Arrays.toString(input);
    }

    public byte[] getSalt() {
        return salt;
    }

    public int getInterations() {
        return interations;
    }
}
