<commit_before>package com.beta;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Arrays;

// TODO - cleanup
public final class BetaUserCreation {
    @JsonProperty
    private String email;
    @JsonProperty
    private char[] plainTextPassword;

    // Lazy
    private String salt;

    // needed for Jackson
    BetaUserCreation() {}

    @VisibleForTesting
    public BetaUserCreation(String email, char[] plainTextPassword) {
        this.email = email;
        this.plainTextPassword = <PASSWORD>;
    }

    public String email() {
        return email;
    }

    public String salt() { return getSalt(); }

    public String hashAndSaltPasswordThenClear() {
        System.out.println(getSalt());
        String hash = new PasswordSecurity(plainTextPassword, getSalt()).secure();
        Arrays.fill(plainTextPassword, 'a');
        return hash;
    }

    private String getSalt() {
        if (salt == null) {
            try {
                byte[] saltBuff = new byte[128];<commit_msg>Cleans up betaUserCreation to simplify<commit_after>package com.beta;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.annotations.VisibleForTesting;

import java.nio.ByteBuffer;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Arrays;

public final class BetaUserCreation {
    public final String email;
    public final char[] plainTextPassword;

    // Lazy
    private String salt;

    @VisibleForTesting
    public BetaUserCreation(@JsonProperty("email") String email,
                            @JsonProperty("plainTextPassword") char[] plainTextPassword) {
        this.email = email;
        this.plainTextPassword = <PASSWORD>;
    }

    public String email() {
        return email;
    }

    public String salt() { return getSalt(); }

    public String hashAndSaltPasswordThenClear() {
        String hash = new PasswordSecurity(plainTextPassword, getSalt()).secure();
        Arrays.fill(plainTextPassword, 'a');
        return hash;
    }

    private String getSalt() {
        if (salt == null) {
            try {
                byte[] saltBuff = new byte[128];
{'fraction_non_alphanumeric': 0.0984, 'fraction_numerical': 0.0024, 'mean_word_length': 3.060064935064935, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5516891', 'n_tokens_mistral': 702, 'n_tokens_neox': 660, 'n_words': 166}