<commit_before>// caesar.js

cipher.caesar = function(mode, input, key) {
    
    var outputtext = "";
    
    var cinput = input.replace(/\s/g, ""); // strip out all spaces
    
    if (key < 1 || key > (data.alphabet.length - 1)) {
        return null; // end the function
    }
    
    for (var i = 0; i < cinput.length; i++) { // loop through all of the input text
        
        var position = data.alphabet.indexOf(cinput.charAt(i));
        var l;
        
        if (mode === true) { // encryption mode
            l = position + key;
            
            l = l % data.alphabet.length;
        }
        
        if (mode === false) { // decryption mode
            l = position - key;
            
            if (l < 0) {
                
                l = l + data.alphabet.length;
                
            }
        }
        
        outputtext += data.alphabet[l]; // put the outputtext letter in the ciphertext
        
    }
    
    return outputtext;
    
};<commit_msg>Caesar cipher can now handle uppercase and lowercase messages<commit_after>// caesar.js

cipher.caesar = function(mode, input, key) {
    // function assumes that data.alphabet.length == data.upperbet.length
    
    var outputtext = "";
    
    var cinput = input.replace(/\s/g, ""); // strip out all spaces
    
    if (key < 1 || key > (data.alphabet.length - 1)) {
        return null; // end the function
    }
    
    for (var i = 0; i < cinput.length; i++) { // loop through all of the input text
        
        var position;
        var l;
        
        if (mode === true) { // encryption mode
            position = data.alphabet.indexOf(cinput.charAt(i).toLowerCase()); // normalize input
            
            l = position + key;
            
            l = l % data.alphabet.length;
            
            outputtext += data.upperbet[l]; // put the outputtext letter in the ciphertext (UPPERCASE)
            
        } else if (mode === false) { // decryption mode
            position = data.alphabet.indexOf(cinput.charAt(i).toLowerCase()); // normalize input
            
            l = position - key;
            
            if (l < 0) {
                
                l = l + data.alphabet.length;
                
            }
            
            outputtext += data.alphabet[l]; // put the outputtext letter in the ciphertext (lowercase)
            
        }
        
        
    }
    
    return outputtext;
    
};
{'fraction_non_alphanumeric': 0.11268747466558574, 'fraction_numerical': 0.0032428050263477908, 'mean_word_length': 1.2830712303422758, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '482536', 'n_tokens_mistral': 703, 'n_tokens_neox': 690, 'n_words': 194}