Well I couldn't sleep tonight and ComputerJy got me looking at it again. It appears that strKey is modified as encoding progresses. Each time a character is encoded the current position in strKey is modified somehow by using the next character in strKey, unless you're currently looking at the last character. Then for each character in your data, two characters are created in the encoding. One shows the value of the current data character integer divide by part of the key, while the other shows modulo. I believe that's the "key" to reproducing the original message. Without both the div and mod values the data from the original message would be lost by either operation. Then there's a lot of mathematical manipulation to make sure all values stay within a particular range, specifically the final result is all uppercase ascii characters.