<commit_before>import crypto from 'crypto';

const CRYPTO_HASH_SALT = 'blinksocks';

/**
 * supported ciphers, key length and IV length
 */
const cipherKeyIVLens = {
  'aes-128-ctr': [16, 16],
  'aes-192-ctr': [24, 16],
  'aes-256-ctr': [32, 16],
  'aes-128-cfb': [16, 16],
  'aes-192-cfb': [24, 16],
  'aes-256-cfb': [32, 16],
  'aes-128-ofb': [16, 16],
  'aes-192-ofb': [24, 16],
  'aes-256-ofb': [32, 16],
  'aes-128-cbc': [16, 16],
  'aes-192-cbc': [24, 16],
  'aes-256-cbc': [32, 16]
};

/**
 * supported message digest algorithm
 */
const hmacLens = {
  'md5': 16,
  'sha': 20,
  'sha1': 20,
  'sha256': 32,
  'sha512': 64
};

/**
 * encrypt/decrypt data by a cipher/key obtained from config.json
 */
export class Crypto {

  /**
   * create cipher with/without IV
   * @param cipher
   * @param key
   * @param iv
   * @returns {Decipher}
   */
  static createCipher(cipher, key, iv) {<commit_msg>chore(crypto): deprecate md5 and sha<commit_after>import crypto from 'crypto';

const CRYPTO_HASH_SALT = 'blinksocks';

/**
 * supported ciphers, key length and IV length
 */
const cipherKeyIVLens = {
  'aes-128-ctr': [16, 16],
  'aes-192-ctr': [24, 16],
  'aes-256-ctr': [32, 16],
  'aes-128-cfb': [16, 16],
  'aes-192-cfb': [24, 16],
  'aes-256-cfb': [32, 16],
  'aes-128-ofb': [16, 16],
  'aes-192-ofb': [24, 16],
  'aes-256-ofb': [32, 16],
  'aes-128-cbc': [16, 16],
  'aes-192-cbc': [24, 16],
  'aes-256-cbc': [32, 16]
};

/**
 * supported message digest algorithm
 */
const hmacLens = {
  'sha1': 20,
  'sha256': 32,
  'sha512': 64
};

/**
 * encrypt/decrypt data by a cipher/key obtained from config.json
 */
export class Crypto {

  /**
   * create cipher with/without IV
   * @param cipher
   * @param key
   * @param iv
   * @returns {Decipher}
   */
  static createCipher(cipher, key, iv) {
{'fraction_non_alphanumeric': 0.20664819944598337, 'fraction_numerical': 0.11080332409972299, 'mean_word_length': 3.0952380952380953, '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': '2315558', 'n_tokens_mistral': 941, 'n_tokens_neox': 761, 'n_words': 190}