<commit_before>/*
 * Copyright (c) 2014 Diona Ltd.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of Diona
 * ("Confidential Information"). You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the license agreement you
 * entered into with Diona.
 */
package com.diona.fileReader;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;

import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;

// import org.apache.commons.io.FileUtils;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Base64;
import android.util.Log;

// import com.diona.socialworker.app.SocialWorkerSharedPreferences;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;

import android.app.Activity;
import android.content.Intent;

/**
 * Cipher utility class.
 */
public final class CipherUtil extends CordovaPlugin{
  // private static BootstrapProperties bootstrapProperties = BootstrapProperties.getInstance();
  public static final String ACTION_ENCRYPT_FILE = "encryptFile";
  public static final String ACTION_DECRYPT_FILE = "decryptFile";
  private static final boolean ENCRYPTION_ENABLED = true;
  private static final String ENCRYPTION_ALGORITHM = "AES/CBC/PKCS5Padding";
  private static final String SECRET_KEY_ALGORITHM = "PBKDF2WithHmacSHA1";
  private static final int KEY_SIZE = 256;
  private static final int KEY_ITERATIONS = 1;

  private static final String TAG = "CipherUtil";
  private static final String SECRET_KEY_PASSPHRASE = "!$%^&*()+=";
  private static CipherUtil instance;
  private static final int IV_LENGTH = 16;<commit_msg>Update CipherUtil.java<commit_after>/*
 * Copyright (c) 2014 Diona Ltd.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of Diona
 * ("Confidential Information"). You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the license agreement you
 * entered into with Diona.
 */
package com.diona.fileReader;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;

import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;

// import org.apache.commons.io.FileUtils;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Base64;
import android.util.Log;

// import com.diona.socialworker.app.SocialWorkerSharedPreferences;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;

import android.app.Activity;
import android.content.Intent;

/**
 * Cipher utility class.
 */
public final class CipherUtil extends CordovaPlugin{
  // private static BootstrapProperties bootstrapProperties = BootstrapProperties.getInstance();
  public static final String ACTION_ENCRYPT_FILE = "encryptFile";
  public static final String ACTION_DECRYPT_FILE = "decryptFile";
  private static final boolean ENCRYPTION_ENABLED = true;
  private static final String ENCRYPTION_ALGORITHM = "AES";
  private static final String SECRET_KEY_ALGORITHM = "PBKDF2WithHmacSHA1";
  private static final int KEY_SIZE = 256;
  private static final int KEY_ITERATIONS = 1;

  private static final String TAG = "CipherUtil";
  private static final String SECRET_KEY_PASSPHRASE = "!$%^&*()+=";
  private static CipherUtil instance;
  private static final int IV_LENGTH = 16;
{'fraction_non_alphanumeric': 0.08370855505525993, 'fraction_numerical': 0.0059353254195661075, 'mean_word_length': 5.740689655172414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '93450', 'n_tokens_mistral': 1430, 'n_tokens_neox': 1379, 'n_words': 388}