Because each increment the length of the key is added to i. This makes it so the key string doesn't become longer than the string to be encrypted.
The loop will keep going until it has a key length equal to the string length (in theory)
And the += operator was just an example of concatenation. If you are using char arrays then that wont concatenate, it'll give you weird characters since it's adding the ASCII values together.
Last edited by ShawnCplus; Dec 6th, 2007 at 5:40 pm.
Reputation Points: 520
Solved Threads: 268
Code Monkey
Offline 1,564 posts
since Apr 2005