<commit_before>package com.ironz.binaryprefs.encryption;

import com.ironz.binaryprefs.exception.EncryptionException;

import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

/**
 * Implementation of {@link ByteEncryption} class which uses AES for <code>byte[]</code> data encryption.
 */
public final class AesByteEncryptionImpl implements ByteEncryption {

    private static final String AES = "AES";
    private static final String AES_CBC_PKCS5_PADDING = "AES/CBC/PKCS5PADDING";
    private static final int KEY_LENGTH = 16;

    private final Cipher cipher;
    private final SecretKeySpec keySpec;
    private final IvParameterSpec iv;

    /**
     * Creates byte encryption instance which performs AES vice versa encryption operation.
     *
     * @param secretKeyBytes 16 bytes secret key
     * @param initialVector  16 bytes initial vector
     */
    public AesByteEncryptionImpl(byte[] secretKeyBytes, byte[] initialVector) {
        checkLength(secretKeyBytes, initialVector);
        this.cipher = getCipherInstance();
        this.keySpec = new SecretKeySpec(secretKeyBytes, AES);
        this.iv = new IvParameterSpec(initialVector);<commit_msg>updated preferences dumping [5]<commit_after>package com.ironz.binaryprefs.encryption;

import com.ironz.binaryprefs.exception.EncryptionException;

import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

/**
 * Implementation of {@link ByteEncryption} class which uses AES for <code>byte[]</code> data encryption.
 */
public final class AesByteEncryptionImpl implements ByteEncryption {

    private static final String AES = "AES";
    private static final String AES_CBC_PKCS5_PADDING = "AES/CBC/PKCS5PADDING";
    private static final int KEY_LENGTH = 16;

    private final Cipher cipher;
    private final SecretKeySpec keySpec;
    private final IvParameterSpec iv;

    /**
     * Creates byte encryption instance which performs AES vice versa-encryption operation.
     *
     * @param secretKeyBytes 16 bytes secret key
     * @param initialVector  16 bytes initial vector
     */
    public AesByteEncryptionImpl(byte[] secretKeyBytes, byte[] initialVector) {
        checkLength(secretKeyBytes, initialVector);
        this.cipher = getCipherInstance();
        this.keySpec = new SecretKeySpec(secretKeyBytes, AES);
        this.iv = new IvParameterSpec(initialVector);
{'fraction_non_alphanumeric': 0.07939739413680781, 'fraction_numerical': 0.006921824104234527, 'mean_word_length': 4.11875, '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': '1092627', 'n_tokens_mistral': 700, 'n_tokens_neox': 656, 'n_words': 195}