Hello! I'm trying/testing some stream cipher where, the key changes every time when it goes to the end of it, and then uses the new key again for the next decryption. I compile it with g++ no errors or warnings, but when I run the file, it gives me "Segmentation fault" as I am trying to view the first letter of the now new and decrypted text. Any ideas why is that? Here is my code.
Also, maybe this (j < strlen(key) || i < strlen(text)) should be (j < strlen(key) && i < strlen(text)) and, um... are you sure that you don't get out of the bounds of any of your arrays the way you're doing things? :/
The char new_t[strlen(text)]; did the right thing, and there i want to be 'or' statement so I think || is right for what I am trying to accomplish, but I have some mistake in the algorithm where I get the new key, so I have to figure it out because only the first 5 letters of the decrypted word are the right ones. The next are not right, because of the key changing every time.