Just don’t: http://xkcd.com/153/
Bruce Schneier likes to say, “Anyone can invent an encryption algorithm they themselves can’t break; it’s much harder to invent one that no one else can break”
The current algorithms RSA, AES etc has been through rigorous scrutiny over years by tens of thousands. Why not just use of these?
Also: Lessons learned and misconceptions regarding encryption and cryptology
Isn’t this a Vigenère cipher ?
Lookup the article, I’m pretty sure it talks about cryptanalysis of this code (find the ley length, frequency analysis etc)
And if the key is of the same length that the plaintext, you have a One-time pad that is virtually unbreakable without the key (provided this key has good random properties and is never reused).
The first you need to consider when requesting someone to test your algorithm code or anything of that sort is MAKE IT UNDERSTANDABLE. If you can understand what you mean it doesn’t mean everyone can. Anyway there are two problems in your cipher: It is insecure under Semantic Security (with a key shorter than the message) and it is insecure under CPA (Chosen Plaintext Attack) and any such cipher is not even considered. Let me explain in a little more detail. As you can see from the general construction of your cipher it is something slightly resembling the OTP (One-time pad) though much less secure. However even if your encryption system would have been as secure as the OTP the moment you use the same key to encrypted multiple messages your encryption is quickly broken and more than that the key is deduced. And even if your encryption algorithm would have been resistant to deducing the key from the ciphertext-plaintext pair the encryption algorithm is definitely not a randomized function nor a nonce-based encryption algorithm and therefore is not resistant to CPA. To make a last point your encryption algorithm is even worse than the OTP encryption algorithm because what you are doing is simply creating a Stream Cipher with a completely predictable PRG (Pseudo Random Generator) which does nothing random looking instead it just repeats the key when ever the space is finished. The only secure case with your cipher is when the key is as long as the message and then there is no point to encrypt it because if you have a way to communicate the key to the recipient securely why waste time and not use the method for communicating the whole message? Anyway the key point is you made a try at making a stream cipher but you used a completely insecure Pseudo Random Generator and let this be a lesson to you not to try and reinvent the wheel.