NOTE: Any web language example would be fine.
This question is solely for my own understanding. I realize it is not practical in use.
I want to code a simple encryption technique. It works like this:
Correct Password is: john
Entered Password: john
To obtain it...
1 Take position of character [j] in alphabet , which would be 10.
2. Get Letter in KeyPhrase1 at that position (10th). I suppose we would use MOD here, 10%len(keyphrase1) ? which would be 2, correct?
3. That would give us "a"
4. Take "a" position in alphabet ( 1 ) and Get Letter in KeyPhrase2 ( S )
So the first encrypted letter of john, would be S.
My Question is, how would I do this in code? How would I check to see if THEY ENTERED the correct password?
I have a feeling one of you EXPERTS could probably do this in one line of code ..
// Can someone help me with this complex statement, please?
My goal is to write code which the correct password is NOT in the source code. Again, I realize this is not practical but I will put to use elsewhere once I fully understand how this works. THANKS AGAIN!