<commit_before>function changeCipherBasic() {
  var cipherText = document.getElementById("ciphertext").value;
  document.getElementById("reverse").value = reverse(cipherText);
  document.getElementById("atbash").value = atbash(cipherText); 
  document.getElementById("odd").value = extractAlternatingChars(cipherText, 0); 
  document.getElementById("even").value = extractAlternatingChars(cipherText, 1); 
  document.getElementById("filter-uppercase").value = removeCharRange(cipherText, "uppercase");
  document.getElementById("filter-lowercase").value = removeCharRange(cipherText, "lowercase");
  document.getElementById("filter-numbers").value = removeCharRange(cipherText, "numbers");
}
/**
 * Converts the input text to its reverse.
 * @param {string} the string to be reversed.
 * @return {string} returns the reversed string.
 */
function reverse(text) {
  return reversedString = text.split("").reverse().join("");
}
/**
 * Extracts even/odd characters from input text
 * @param {string} text - text to be extracted from.
 * @param {integer} parity - shift for parity. use 0 to extract odd characters and 1 for even.
 * @return {string} - returns extracted text.
 * @author - Cyan
 */
function extractAlternatingChars(text, parity) {
  var i = 0;
  var outputtext = "";
  if (parity==1 || parity==0) {
    i = parity;
  } else {
    return "WTF is this? Wrong args!!";
  }
  for (i; i < text.length; i=i+2) {
    outputtext = outputtext + text.charAt(i);
  }
  return outputtext;
}

/**
 * Removes a range of characters from input text
 * @param {string} text - text to be extracted from.
 * @param {integer} range - shift for for the character range to be removed. valid values are "uppercase", "lowercase", and "numbers".
 * @return {string} - returns extracted text.
 * @author - Cyan
 */
function removeCharRange(text, range) {
  var outputtext = "";

  function createOutput(cipherText, minLimit, maxLimit) {
    for (i = 0; i < cipherText.length; i++) {
      character = text.charCodeAt(i);
      if (character < minLimit || character > maxLimit) {
        outputtext = outputtext + cipherText.charAt(i);
      } 
    }
  }

  switch (range) {
    case "uppercase": 
      createOutput(text, 65, 90) //remove uppercase characters
      break;
    case "lowercase": 
      createOutput(text, 97, 122) //remove lowercase characters
      break;
    case "numbers": 
      createOutput(text, 48, 57) //remove number characters (0-9)
      break;
    default: 
      outputtext = "This shit is not implemented yet!";
  }

  return outputtext;
}
/**
 * Converts the input text in to an atbash cipher using an alphabet [a-z] and [A-Z].
 * Numbers and all other characters are left as they are.
 * @param {string} text - text to be atbashed.
 * @param {integer} flag - flag denoting the type of the atbash (letters only, letters and numbers).
 * @return {string} - returns atbash converted string of the input.
 * @author - KJ <<EMAIL>>
 */
function atbash(text, flag) {
  var i = 0;
  var index = 0;
  var character = "";
  var outputchar = "";
  var outputtext = "";

  var az = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9",".","-"];
  var za = ["z","y","x","w","v","u","t","s","r","q","p","o","n","m","l","k","j","i","h","g","f","e","d","c","b","a","Z","Y","X","W","V","U","T","S","R","Q","P","O","N","M","L","K","J","I","H","G","F","E","D","C","B","A","9","8","7","6","5","4","3","2","1","-","."];
  for (i = 0; i < text.length; i++) {
    character = text.charAt(i);
    index = az.indexOf(character);
    if(index >= 0){
    	if(index >= 51){
    		if (flag == 0 ){
    			outputchar = character;
    		}
    	}
    	else{
    		outputchar = za[index];
    	}
    }
    outputtext = outputtext + outputchar;
  }
  return outputtext;
}


/**
 * Converts the input text using caesar cipher using an alphabet [a-z] and [A-Z].
 * @param {string} text - text to be encrypted/decrypted.<commit_msg>Updated atbash()<commit_after>function changeCipherBasic() {
  var cipherText = document.getElementById("ciphertext").value;
  document.getElementById("reverse").value = reverse(cipherText);
  document.getElementById("atbash").value = atbash(cipherText); 
  document.getElementById("odd").value = extractAlternatingChars(cipherText, 0); 
  document.getElementById("even").value = extractAlternatingChars(cipherText, 1); 
  document.getElementById("filter-uppercase").value = removeCharRange(cipherText, "uppercase");
  document.getElementById("filter-lowercase").value = removeCharRange(cipherText, "lowercase");
  document.getElementById("filter-numbers").value = removeCharRange(cipherText, "numbers");
}
/**
 * Converts the input text to its reverse.
 * @param {string} the string to be reversed.
 * @return {string} returns the reversed string.
 */
function reverse(text) {
  return reversedString = text.split("").reverse().join("");
}
/**
 * Extracts even/odd characters from input text
 * @param {string} text - text to be extracted from.
 * @param {integer} parity - shift for parity. use 0 to extract odd characters and 1 for even.
 * @return {string} - returns extracted text.
 * @author - Cyan
 */
function extractAlternatingChars(text, parity) {
  var i = 0;
  var outputtext = "";
  if (parity==1 || parity==0) {
    i = parity;
  } else {
    return "WTF is this? Wrong args!!";
  }
  for (i; i < text.length; i=i+2) {
    outputtext = outputtext + text.charAt(i);
  }
  return outputtext;
}

/**
 * Removes a range of characters from input text
 * @param {string} text - text to be extracted from.
 * @param {integer} range - shift for for the character range to be removed. valid values are "uppercase", "lowercase", and "numbers".
 * @return {string} - returns extracted text.
 * @author - Cyan
 */
function removeCharRange(text, range) {
  var outputtext = "";

  function createOutput(cipherText, minLimit, maxLimit) {
    for (i = 0; i < cipherText.length; i++) {
      character = text.charCodeAt(i);
      if (character < minLimit || character > maxLimit) {
        outputtext = outputtext + cipherText.charAt(i);
      } 
    }
  }

  switch (range) {
    case "uppercase": 
      createOutput(text, 65, 90) //remove uppercase characters
      break;
    case "lowercase": 
      createOutput(text, 97, 122) //remove lowercase characters
      break;
    case "numbers": 
      createOutput(text, 48, 57) //remove number characters (0-9)
      break;
    default: 
      outputtext = "This shit is not implemented yet!";
  }

  return outputtext;
}
/**
 * Converts the input text in to an atbash cipher using an alphabet [a-z] and [A-Z].
 * Numbers and all other characters are left as they are.
 * @param {string} text - text to be atbashed.
 * @param {integer} flag - flag denoting the type of the atbash (letters only, letters and numbers).
 * @return {string} - returns atbash converted string of the input.
 * @author - KJ <<EMAIL>>
 */
function atbash(text, flag) {
  var i = 0;
  var index = 0;
  var character = "";
  var outputchar = "";
  var outputtext = "";

  var az = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9",".","-"];
  var za = ["z","y","x","w","v","u","t","s","r","q","p","o","n","m","l","k","j","i","h","g","f","e","d","c","b","a","Z","Y","X","W","V","U","T","S","R","Q","P","O","N","M","L","K","J","I","H","G","F","E","D","C","B","A","9","8","7","6","5","4","3","2","1","-","."];
  for (i = 0; i < text.length; i++) {
    character = text.charAt(i);
    index = az.indexOf(character);
    if(index >= 0){
    	if(flag == 0){
    		if (index >= 51 ){
    			outputchar = character;
    		}
    		else{
    			outputchar = za[index];	
    		}
    	}
    	else{
    		outputchar = za[index];
    	}
    }
    outputtext = outputtext + outputchar;
  }
  return outputtext;
}


/**
 * Converts the input text using caesar cipher using an alphabet [a-z] and [A-Z].
 * @param {string} text - text to be encrypted/decrypted.
{'fraction_non_alphanumeric': 0.20848953924295563, 'fraction_numerical': 0.011851493530052002, 'mean_word_length': 3.8790560471976403, 'pattern_counts': {'":': 6, '<': 15, '<?xml version=': 0, '>': 13, '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': 2, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '447322', 'n_tokens_mistral': 2850, 'n_tokens_neox': 2679, 'n_words': 703}