A symmetric key encryption program that pseudo-randomly shuffles alphabets based on 3-character sections of key. After creating all alphabets stored in the key, reapplies the cipher to the key to create the next array of substitution alphabets.
Step-through of cipher process:
- The cipher takes a string of plaintext and a string that is the key (The key's length should be a multiple of 3)
- The first 3 characters of the key are used to seed a random number, which shuffles an alphabet of A-Z, a-z, 0-9 and several other characters.
- Step 2 is repeated for all 3-long sections of the key, creating an array of substitution alphabets (stored as maps with the original alphabet letter as the key and its substitution equivalent as the value)
- Apply 1st alphabet to 1st plaintext character, 2nd alphabet to 2nd character, etc. for as many alphabets as are stored in the array.
- The subPolyB function which is responsible for shuffling and applying alphabets is called with the first parameter(the plaintext) as the key, and the second (key to cipher with) as the key's reverse.
- Steps 1 through 5 are repeated over and over until all of the characters of plaintext are converted to characters of ciphertext.
- Ciphertext is returned.