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.
43 Comments - Last post 48 minutes ago by malkavian1331
215 Comments - Last post 1 hour ago by adam1224
10 Comments - Last post 2 hours ago by gameboy9725
16 Comments - Last post 7 hours ago by Tenn
238 Comments - Last post 8 hours ago by BHTrellis188
386 Comments - Last post 10 hours ago by Bum8ara5h
18 Comments - Last post 11 hours ago by RobbyRatpoison
134 Comments - Last post 12 minutes ago by Lakraj1209
2,839 Comments - Last post 16 minutes ago by TheOldestDream
326 Comments - Last post 16 minutes ago by xXShurraXx
125 Comments - Last post 30 minutes ago by Calibr3
122 Comments - Last post 1 hour ago by fedordolohov
281 Comments - Last post 1 hour ago by Galioverhere
164 Comments - Last post 1 hour ago by ChimChakMan
f(a)=(a+k) mod n
Anybody know how to reverse it?
Comment has been collapsed.