My algorithm is acting kind of strange...

At first, it was working unless it was thrown a line with a length longer than the bitsize of the key. Now, I'm not sure whats happening.

Here is my...