First of all I see a few problems in
encrypt
.
var oKey = "P";
The initial value of
oKey
is set from outside of the
encrypt
function. How do know that the value is always "P" when you encrypt.
After encoding each char in
position
, you do nothing with it.
The function returns nothing.
How do you know the value of
oKey
when you call the
decrypt
function.