Hey everyone... I'm writing a very SImple and very BASIC encryption algorithm.
It consists of 3 parts, dividing up the plaintext, dividing up the key, and then xoring, substituting and permutating (if thats a word ha) these individual pieces.
I havent begun the substitution yet but i think that should be easy, nor have i done the xoring but again that's simple as well.
What i am having trouble with is the permutation function.
It's EXTREMELY simple, it simply shifts the string 3 chars to the left on encryption and 3 chars to the right on decryption.
Here's the functions, for some reason the first few characters are getting messed up and i dont know why:
Thanks!Code:void ePermutation(string &block) { char temp = block.at(0); char temp2; for(int i=0; i<3; i++) { //shift everything one to the left for(int j=15; j>0; j--) { temp2 = block.at(j); block.at(j) = temp; temp = temp2; } } } void dPermutation(string &block) { char temp = block.at(15); char temp2; for(int i=0; i<3; i++) { for(int j=0; j<16; j++) { temp2 = block.at(j); block.at(j) = temp; temp = temp2; } } }