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.
46 Comments - Last post 1 minute ago by AKFalcon
37 Comments - Last post 19 minutes ago by julikaiba
1 Comments - Last post 23 minutes ago by Stakaniy
116 Comments - Last post 1 hour ago by SketCZ
1,009 Comments - Last post 3 hours ago by InSpec
221 Comments - Last post 4 hours ago by ScorchedRelic
8 Comments - Last post 6 hours ago by lostsoul67
45 Comments - Last post 20 minutes ago by Lakraj1209
43 Comments - Last post 50 minutes ago by Georgeous
155 Comments - Last post 1 hour ago by s4k1s
177 Comments - Last post 1 hour ago by TerrifyingMetal
465 Comments - Last post 1 hour ago by Vampus
1,147 Comments - Last post 1 hour ago by JMM72
36 Comments - Last post 3 hours ago by BauerBoy24
f(a)=(a+k) mod n
Anybody know how to reverse it?
Comment has been collapsed.