Comment has been collapsed.
Off hand, no. But it looks like you want the inverse of the modulo function. Maybe you can search out some information on that. If you can provide a bit more info on what's known and unknown in that formula, since there are three variables (a,k,n), that might help a little bit in figuring it out.
Comment has been collapsed.
Hmm, if it's doing what I think it's doing (namely shifting an alphabet, a
, by k
and cycling around the alphabet size n
) then the following should work to reverse it:
f(a) = ((a + n) - (k mod n)) mod n
Shifting forwards by the size of the alphabet to prevent values of a
from going negative when shifted backwards (which would make using mod n
to constrain it to the bounds of the alphabet size not work), then shifting it backwards by a value k
constrained to the alphabet size (to again prevent it going negative), and then using mod n to constrain the end result to the alphabet size.
This may not be the most efficient or concise way of doing it, but if I've interpreted correctly, I think it should work for what you are doing.
Comment has been collapsed.
156 Comments - Last post 36 minutes ago by NebraskaJones
395 Comments - Last post 1 hour ago by wigglenose
39 Comments - Last post 1 hour ago by Foxhack
284 Comments - Last post 1 hour ago by Wok
8 Comments - Last post 6 hours ago by TheLimeyDragon
1,247 Comments - Last post 9 hours ago by WaxWorm
82 Comments - Last post 10 hours ago by GarlicToast
4 Comments - Last post 46 seconds ago by ClapperMonkey
3 Comments - Last post 6 minutes ago by Filipi
217 Comments - Last post 12 minutes ago by jm
29 Comments - Last post 13 minutes ago by AndyyOak
79 Comments - Last post 19 minutes ago by Ottah
1,372 Comments - Last post 19 minutes ago by Vasharal
17 Comments - Last post 26 minutes ago by Mitsukuni
f(a)=(a+k) mod n
Anybody know how to reverse it?
Comment has been collapsed.