I am having a little trouble attempting to reverse my encryption algorithm. The algorithm is a variation on the Caesar Cipher, and works like so:
(V1 + V2 + D) % 26 + 1
Where V1 is the letter of the phrase to be encrypted mapped to the relevant number (A = 1, etc), V2 is the letter of the users chosen key (the same length as the phrase), again mapped to the relevant number, and D is a chosen displacement value, ranging from 1 - 10.
The issue I am having is in attempting to reverse this. I have tried simply reversing the algorithm:
(V1 - V2 - D) % 26 - 1
but this obviously fails, due to the modulus involved. I have also attempted:
(V1 - V2 - D + 26) % 26
on the advice of here, but again this failed. It would be extremely helpful if somebody would be able to show me the solution to this, or at least point me in the correct direction.