| devonrevenge (897) | |
|
So i scrambled a sentence with a function that was 16 lines of code usigfqedtwjsvusygih EDIT: I have no idea how easy its gonna be;if its too hard i could submit the coder but that might then be too easy EDIT2: Heres another mulooqlrizlok EDIT3:heres the algorithm that scrambled it: int q = (a+b)*cipher%27; a = letter pos in sentence, b position in 27 char alphabet, cipher is the cipher so make a program that decodes it :D EDIT4:it is reversible, a java function decoded it | |
|
Last edited on
|
|
| helios (10258) | |
| How do we know if the function is reversible? | |
|
|
|
| devonrevenge (897) | |
| it is cos i built another function to reverse it, but it might be quite hard;but i will submit an easy level too | |
|
Last edited on
|
|
| Peter87 (3917) | |
|
Give us some time and we will solve this. EDIT: When I read scrambled I thought shuffled but if it's encrypted in some more advanced way it can be very hard to solve because there could be thousands of possible solutions. | |
|
Last edited on
|
|
| ResidentBiscuit (2650) | |
| Yes knowing whether or not it is just scrambled (ie same letters as original, just different order) or encrypted would be nice to know. | |
|
|
|
| hamsterman (4435) | |
| I decode it as "banana". Besides it not being the word you wanted, there is no way to show that I am wrong. There does indeed exist an encoding that takes "banana" to "usigfqedtwjsvusygih". The challenge is not had, it is plain impossible. | |
|
|
|
| Catfish3 (279) | |
|
@ devonrevenge: I want to know if your code does selective substitution. | |
|
|
|
| Dissimulation (35) | |||
I figured it out with hamsterman's help
| |||
|
|
|||
| devonrevenge (897) | |
|
heres the algorithm that scrambled it: int q = (a+b)*cipher%27; a = letter pos in sentence, b position in 27 char alphabet, cipher is the cipher It was too hard to just suss out but i got the best idea for challenge 2 you will love it @catfish, could you give me an example of that? | |
|
Last edited on
|
|
| helios (10258) | ||
| ||
|
|
||
| devonrevenge (897) | |
|
no it is my mathmetician freind helped me...well actually he said the same thing but then couldnt understand how i came up with code in the first place...% isnt really what mathmeticians call modulos its the coding version (it has a different name i think modulous just cought on) basically i thing the remainder is returned as an int so it is reversable (cos alphabet [30]%27 = 3 (so 'c') ) my mathmetician freind built the reverse function with the algorithm ^_^ | |
|
Last edited on
|
|
| Catfish3 (279) | ||
@ devonrevenge: by "selective substitution" I meant a switch() that only replaced certain letters and left others as they were.
Which is what? Do you mean "key"? A number given by the user? | ||
|
|
||
| helios (10258) | |||
The remainder of the division a/b is an integer r such that a = b*q+r, where q is some integer and 0<=r<b. If cipher is a multiple of 27, then it's expressible as 27*k, where k is some integer. Then (a+b)*cipher%27 == (a+b)*(27*k)%27 == (a*27*k+b*27*k)%27 == by properties of remainder: == ((a*27*k)%27+(b*27*k)%27)%27 == and again: == (((a%27)*(27%27)*(k%27))%27+((b%27)*(27%27)*(k%27))%27)%27 == by definition of remainder, for all integer values of c different than 0, c%c == 0. In particular, 27%27 == 0: == (((a%27)*0*(k%27))%27+((b%27)*0*(k%27))%27)%27 == == (0%27+0%27)%27 == 0%27 == 0 Trust me, I've been doing proofs like this all year. The function is not fully invertible. | |||
|
|
|||
| devonrevenge (897) | |
|
cipher is just a number in this case, 4. the reversing function has worked perfectly for all sentences so far | |
|
Last edited on
|
|
| helios (10258) | ||
| ||
|
|
||
| Catfish3 (279) | |
|
I'd love to see your alphabet, devon. I figured out what the messages are, but some of the letters are wrong. | |
|
|
|
| hamsterman (4435) | |
|
even if cipher = 4, a+b could be divisible by 27. Instead just 'b' at position 26 and 'a' at position 27. | |
|
Last edited on
|
|
| devonrevenge (897) | |
|
the alphabet is a=0 and so on but with 27 = ' '. the cipher was between 2 and 9, shouldn't modulus always just keep it all together ie: 3 = 'c', 30 = 'c' 57 = 'c' etc etc rah rah rah? my idea for the second one is sooo much cooler but i will test it a lot more | |
|
Last edited on
|
|
| Catfish3 (279) | |
|
Could you please just copy paste the alphabet as it is in the code? Because either I messed up the "decoder", or you messed up the alphabet. | |
|
|
|
| hamsterman (4435) | |
| oh wait, for 4 it totally is reversible. if it was 6 though, you'd have 'i' = 'r' (9 = 18) at any position. | |
|
|
|