So essentially I'm trying to make a function that takes an ASCII value and multiplies it by the remainder of the previous multiplication in the iteration.
So for the first iteration (i = 0), the remainder just gets set as the initial asc value. The second iteration (i = 1), the calculation is something like rem = (rem * ascVal)%N
, where rem
in rem * ascVal
is the rem (remainder) from the previous iteration.
This continues until i = e where the last value of rem
is returned.
This is what i have so far:
function newVal(ascVal) {
var i = 0;
var rem = ascVal;
while (i < e) {
rem = (rem * ascVal) % N;
i++;
if (i == e) {
return rem;
}
}
newVal(rem);
}
e
iterations. Any help would be great and i can post the entire script if needed (includes all calculations etc.)
P.S. This script is a small prototype elliptic curve encrypter.