class Crypto{
    constructor(phrase){
        this.phrase = phrase;
    }

    /**
     * Remove all numbers, symbols, spaces and punctuation
     * from the text*/
    normalizePlaintext() {
        return this.phrase.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
    }

    /**
     * Determines the size of the rectangle, gets the length of the rectangle
     * finds its square root and rounds up the value
     */
    size() {
        var len = Math.sqrt(this.normalizePlaintext().length);
        return Math.ceil(len);
    }

    /**splits the normalized plain text into segments
     * by the given size
     * Will group the text segments into chunks according to the length of the normalized text
     */
    plaintextSegments() {
        let plainText = this.normalizePlaintext();
        let chunks = this.size();
        let reg = new RegExp(".{1," + chunks + "}", "g");

        return plainText.match(reg);
    }

    /**
     * 
     */
    ciphertext() {

    }
}

module.exports = Crypto;
@@ -1,8 +1,23 @@
+%22use-strict%22;%0A%0A
 class Cr
@@ -271,32 +271,246 @@
 rCase();%0A    %7D%0A%0A
+    /**Normalizes the cipher text */%0A    normalizeCipherText()%7B%0A        var chunks = this.size();%0A        var reg = new RegExp(%22.%7B1%22+ chunks + %22%7D%22, %22g%22);%0A        return this.ciphertext.match(reg).join(%22 %22);%0A    %7D%0A%0A
     /**%0A     * D
@@ -1169,36 +1169,1108 @@
   * 
-%0A     */%0A    ciphertext() %7B%0A
+Makes a cipher from the plain text segments%0A     * Adds columns which will be used to add letters from the text segments %0A     */%0A    ciphertext() %7B%0A        var textSegments = this.plaintextSegments();%0A        var columns = %5B%5D, currentLetter, currentSegment;%0A        var i, j;%0A%0A        // add columns based on the length of the text segments%0A        for(i = 0;i %3C this.size(); i++)%7B%0A            columns.push(%5B%5D);%0A        %7D%0A%0A        // for each text segment, get a letter and push to a column%0A        for(i = 0; i %3C textSegments.length; i++)%7B%0A            currentSegment = textSegments%5Bi%5D;%0A%0A            for(j = 0; j %3C columns.length; j++)%7B%0A                currentLetter = currentSegment%5Bj%5D;%0A                columns%5Bj%5D.push(currentLetter);%0A            %7D%0A        %7D%0A%0A        // for each column, join the letters for form one word, and reassign the column to become%0A        // a word, so each column is a word, instead of an array of letters%0A        for(i = 0; i %3C columns.length; i++)%7B%0A            columns%5Bi%5D = columns%5Bi%5D.join(%22%22);%0A        %7D%0A%0A        // return the columns%0A        return columns.join(%22%22);
 %0A   

add normalize cipher text