<commit_before>package peergos.shared.user;

import peergos.shared.crypto.User;
import peergos.shared.crypto.asymmetric.curve25519.*;
import peergos.shared.crypto.hash.*;
import peergos.shared.crypto.random.*;
import peergos.shared.crypto.symmetric.*;

import java.util.Arrays;
import java.util.concurrent.CompletableFuture;

public class UserUtil {

    public static CompletableFuture<UserWithRoot> generateUser(String username,
															   String password,
															   LoginHasher hasher,
															   Salsa20Poly1305 provider,
															   SafeRandom random,
															   Ed25519 signer,
															   Curve25519 boxer,
															   UserGenerationAlgorithm algorithm) {
    	CompletableFuture<byte[]> fut = hasher.hashToKeyBytes(username, password, algorithm);
    	return fut.thenApply(keyBytes -> {
	        byte[] signBytesSeed = Arrays.copyOfRange(keyBytes, 0, 32);
	        byte[] secretBoxBytes = Arrays.copyOfRange(keyBytes, 32, 64);
	        byte[] rootKeyBytes = Arrays.copyOfRange(keyBytes, 64, 96);
	
	        byte[] secretSignBytes = Arrays.copyOf(signBytesSeed, 64);
	        byte[] publicSignBytes = new byte[32];
	
	        signer.crypto_sign_keypair(publicSignBytes, secretSignBytes);
	
	        byte[] pubilcBoxBytes = new byte[32];
	        boxer.crypto_box_keypair(pubilcBoxBytes, secretBoxBytes);
	
	        User user = new User(
	                new Ed25519SecretKey(secretSignBytes, signer),
	                new Curve25519SecretKey(secretBoxBytes, boxer),
	                new Ed25519PublicKey(publicSignBytes, signer),
	                new Curve25519PublicKey(pubilcBoxBytes, boxer, random));
	
	        SymmetricKey root =  new TweetNaClKey(rootKeyBytes, false, provider, random);

	        return new UserWithRoot(user, root);
    	});
    }
}<commit_msg>spaces<commit_after>package peergos.shared.user;

import peergos.shared.crypto.User;
import peergos.shared.crypto.asymmetric.curve25519.*;
import peergos.shared.crypto.hash.*;
import peergos.shared.crypto.random.*;
import peergos.shared.crypto.symmetric.*;

import java.util.Arrays;
import java.util.concurrent.CompletableFuture;

public class UserUtil {

    public static CompletableFuture<UserWithRoot> generateUser(String username,
                                                               String password,
                                                               LoginHasher hasher,
                                                               Salsa20Poly1305 provider,
                                                               SafeRandom random,
                                                               Ed25519 signer,
                                                               Curve25519 boxer,
                                                               UserGenerationAlgorithm algorithm) {
        CompletableFuture<byte[]> fut = hasher.hashToKeyBytes(username, password, algorithm);
        return fut.thenApply(keyBytes -> {
            byte[] signBytesSeed = Arrays.copyOfRange(keyBytes, 0, 32);
            byte[] secretBoxBytes = Arrays.copyOfRange(keyBytes, 32, 64);
            byte[] rootKeyBytes = Arrays.copyOfRange(keyBytes, 64, 96);
	
            byte[] secretSignBytes = Arrays.copyOf(signBytesSeed, 64);
            byte[] publicSignBytes = new byte[32];
	
            signer.crypto_sign_keypair(publicSignBytes, secretSignBytes);
	
            byte[] pubilcBoxBytes = new byte[32];
            boxer.crypto_box_keypair(pubilcBoxBytes, secretBoxBytes);
	
            User user = new User(
                    new Ed25519SecretKey(secretSignBytes, signer),
                    new Curve25519SecretKey(secretBoxBytes, boxer),
                    new Ed25519PublicKey(publicSignBytes, signer),
                    new Curve25519PublicKey(pubilcBoxBytes, boxer, random));
	
            SymmetricKey root =  new TweetNaClKey(rootKeyBytes, false, provider, random);

            return new UserWithRoot(user, root);
        });
    }
}
{'fraction_non_alphanumeric': 0.08191808191808192, 'fraction_numerical': 0.028971028971028972, 'mean_word_length': 1.9799107142857142, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '656099', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1024, 'n_words': 208}