Codebusters B/C
-
Sorrow2
- Member

- Posts: 32
- Joined: December 8th, 2022, 3:05 pm
- Division: B
- State: KS
- Pronouns: He/Him/His
- Has thanked: 5 times
- Been thanked: 1 time
- Contact:
Re: Codebusters B/C
Is there any codebusters book that you guys can recommend? I love to read. Thank you in advance!
"I have blessed you with my absolute definitions of good and evil, so that you may join my crew with unhesitating, UNWAVERING tenacity."
- Umaroth
- Exalted Member

- Posts: 402
- Joined: February 10th, 2018, 8:51 pm
- Division: C
- State: CA
- Pronouns: He/Him/His
- Has thanked: 170 times
- Been thanked: 327 times
Re: Codebusters B/C
If you're reading to get better at the event, there won't be anything like that to help since this event is pretty much entirely practice-based
-
Mythic
- Member

- Posts: 9
- Joined: December 19th, 2022, 9:35 am
- Division: B
- State: MI
- Pronouns: He/Him/His
- Has thanked: 2 times
- Been thanked: 0
Re: Codebusters B/C
Thanks for the idea but I was wondering how you went from (68 + b) mod 26 = 1 --> (16 + b) mod 26 = 1knightmoves wrote: ↑March 16th, 2023, 10:28 amHere's a worked example for you. You are given the cyphertext
"ABOBRFLYBMLHGQBPSLYLSSRYBTODGWLYLQDFRF", and told that the first two letters of the plaintext are H and E.
So you know that under the affine encryption, E(4) -> B(1) and H(7) ->A (0).
So (4a + b) mod 26 = 1
and (7a + b) mod 26 = 0
Subtracting these, you get 3a mod 26 = -1 = 25.
So we're hunting for a value of a for which 3a mod 26 = 25.
3a = 25 is no good, 'cause a needs to be an integer.
3a = 51 gives a = 17, which is a viable solution.
3a = 77 doesn't have an integer solution, and then there aren't any other valid solutions, because you know a<26.
So with a=17, the first equation becomes
(68 + b) mod 26 = 1
or equivalently
(16 + b) mod 26 = 1
And so b = 11.
Now you have determined a and b, you can compute the mappings.
A(0) -> (b mod 26) = 11 = L
B(1) -> (a + b) mod 26 = 2 = C
C(2) -> (2a + b) mod 26 = 19 = T
D(3) -> (3a + b) mod 26 = 10 = K.
And so on.
You might prefer to compute the mappings for the high frequency letters (etaoin shrdlu...) rather than doing them in alphabetical order. Finishing this off is left as an exercise for the reader![]()
-
Mythic
- Member

- Posts: 9
- Joined: December 19th, 2022, 9:35 am
- Division: B
- State: MI
- Pronouns: He/Him/His
- Has thanked: 2 times
- Been thanked: 0
Re: Codebusters B/C
I now understand thisMythic wrote: ↑March 27th, 2023, 2:25 pmThanks for the idea but I was wondering how you went from (68 + b) mod 26 = 1 --> (16 + b) mod 26 = 1knightmoves wrote: ↑March 16th, 2023, 10:28 amHere's a worked example for you. You are given the cyphertext
"ABOBRFLYBMLHGQBPSLYLSSRYBTODGWLYLQDFRF", and told that the first two letters of the plaintext are H and E.
So you know that under the affine encryption, E(4) -> B(1) and H(7) ->A (0).
So (4a + b) mod 26 = 1
and (7a + b) mod 26 = 0
Subtracting these, you get 3a mod 26 = -1 = 25.
So we're hunting for a value of a for which 3a mod 26 = 25.
3a = 25 is no good, 'cause a needs to be an integer.
3a = 51 gives a = 17, which is a viable solution.
3a = 77 doesn't have an integer solution, and then there aren't any other valid solutions, because you know a<26.
So with a=17, the first equation becomes
(68 + b) mod 26 = 1
or equivalently
(16 + b) mod 26 = 1
And so b = 11.
Now you have determined a and b, you can compute the mappings.
A(0) -> (b mod 26) = 11 = L
B(1) -> (a + b) mod 26 = 2 = C
C(2) -> (2a + b) mod 26 = 19 = T
D(3) -> (3a + b) mod 26 = 10 = K.
And so on.
You might prefer to compute the mappings for the high frequency letters (etaoin shrdlu...) rather than doing them in alphabetical order. Finishing this off is left as an exercise for the reader![]()
Decode this sentence which has been encoded with an Affine cipher that starts with TH
MWFPF IRXP, RKK DF WFRS ROBJM TP MWRM MWF TEIJPMSX. TP TE MSBJOKF. FGFSXOBIX TP PB PLRSFI, OJM BJS HTPPTBE PMRMFHFEM TP WRGTEZ EB CFRS.
Could you please help me solve this question?
-
knightmoves
- Member

- Posts: 678
- Joined: April 26th, 2018, 6:40 pm
- Has thanked: 4 times
- Been thanked: 122 times
Re: Codebusters B/C
Same principle. You know T(19) -> M(12)and H(7) -> W (22)
So (19a + b) mod 26 = 12
and (7a + b) mod 26 = 22
Subtract to get
12a mod 26 = (-10) = 16 [-10 is 16 because we're doing arithmetic in mod 26]
Now hunt for a solution
12a = 16 is no good (16/12 has remainder 4)
12a = 42 is no good (42/12 has remainder 6)
12a = 68 is no good (68/12 has remainder 8)
you can see the pattern now, right? we're going to want
12a = 120 -> a = 10
Are there other possibilities?
12a = 146 is no good (146/12 has remainder 2)
12a = 172 is no good (172/12 has remainder 4)
...
12a = 276 -> a = 23
So either a = 10 or a = 23.
If a = 10, (70 + b) mod 26 = 22
so b=4
If a = 23, (161+b)mod26 = 22
so (5+b) = 22
b = 17.
So you have two possibilities = (a,b) = (10,4) or (23,17).
But a=10 isn't a viable solution (10 is not coprime with 26), so (a,b) = (23,17) is the only possible solution.
Now you have a and b, you can build the mapping table as before.
Clue: the answer begins "THESE DAYS, ALL WE HEAR ABOUT".
So (19a + b) mod 26 = 12
and (7a + b) mod 26 = 22
Subtract to get
12a mod 26 = (-10) = 16 [-10 is 16 because we're doing arithmetic in mod 26]
Now hunt for a solution
12a = 16 is no good (16/12 has remainder 4)
12a = 42 is no good (42/12 has remainder 6)
12a = 68 is no good (68/12 has remainder 8)
you can see the pattern now, right? we're going to want
12a = 120 -> a = 10
Are there other possibilities?
12a = 146 is no good (146/12 has remainder 2)
12a = 172 is no good (172/12 has remainder 4)
...
12a = 276 -> a = 23
So either a = 10 or a = 23.
If a = 10, (70 + b) mod 26 = 22
so b=4
If a = 23, (161+b)mod26 = 22
so (5+b) = 22
b = 17.
So you have two possibilities = (a,b) = (10,4) or (23,17).
But a=10 isn't a viable solution (10 is not coprime with 26), so (a,b) = (23,17) is the only possible solution.
Now you have a and b, you can build the mapping table as before.
Clue: the answer begins "THESE DAYS, ALL WE HEAR ABOUT".
- These users thanked the author knightmoves for the post:
- Mythic (March 27th, 2023, 7:58 pm)
-
Mythic
- Member

- Posts: 9
- Joined: December 19th, 2022, 9:35 am
- Division: B
- State: MI
- Pronouns: He/Him/His
- Has thanked: 2 times
- Been thanked: 0
Re: Codebusters B/C
OMG Thanks I stopped at 10 I didn't realize I had to go further. Thanks againknightmoves wrote: ↑March 27th, 2023, 6:57 pm Same principle. You know T(19) -> M(12)and H(7) -> W (22)
So (19a + b) mod 26 = 12
and (7a + b) mod 26 = 22
Subtract to get
12a mod 26 = (-10) = 16 [-10 is 16 because we're doing arithmetic in mod 26]
Now hunt for a solution
12a = 16 is no good (16/12 has remainder 4)
12a = 42 is no good (42/12 has remainder 6)
12a = 68 is no good (68/12 has remainder 8)
you can see the pattern now, right? we're going to want
12a = 120 -> a = 10
Are there other possibilities?
12a = 146 is no good (146/12 has remainder 2)
12a = 172 is no good (172/12 has remainder 4)
...
12a = 276 -> a = 23
So either a = 10 or a = 23.
If a = 10, (70 + b) mod 26 = 22
so b=4
If a = 23, (161+b)mod26 = 22
so (5+b) = 22
b = 17.
So you have two possibilities = (a,b) = (10,4) or (23,17).
But a=10 isn't a viable solution (10 is not coprime with 26), so (a,b) = (23,17) is the only possible solution.
Now you have a and b, you can build the mapping table as before.
Clue: the answer begins "THESE DAYS, ALL WE HEAR ABOUT".
-
Sorrow2
- Member

- Posts: 32
- Joined: December 8th, 2022, 3:05 pm
- Division: B
- State: KS
- Pronouns: He/Him/His
- Has thanked: 5 times
- Been thanked: 1 time
- Contact:
Re: Codebusters B/C
Affine Cipher looks confusing ;-;knightmoves wrote: ↑March 16th, 2023, 10:28 amHere's a worked example for you. You are given the cyphertext
"ABOBRFLYBMLHGQBPSLYLSSRYBTODGWLYLQDFRF", and told that the first two letters of the plaintext are H and E.
So you know that under the affine encryption, E(4) -> B(1) and H(7) ->A (0).
So (4a + b) mod 26 = 1
and (7a + b) mod 26 = 0
Subtracting these, you get 3a mod 26 = -1 = 25.
So we're hunting for a value of a for which 3a mod 26 = 25.
3a = 25 is no good, 'cause a needs to be an integer.
3a = 51 gives a = 17, which is a viable solution.
3a = 77 doesn't have an integer solution, and then there aren't any other valid solutions, because you know a<26.
So with a=17, the first equation becomes
(68 + b) mod 26 = 1
or equivalently
(16 + b) mod 26 = 1
And so b = 11.
Now you have determined a and b, you can compute the mappings.
A(0) -> (b mod 26) = 11 = L
B(1) -> (a + b) mod 26 = 2 = C
C(2) -> (2a + b) mod 26 = 19 = T
D(3) -> (3a + b) mod 26 = 10 = K.
And so on.
You might prefer to compute the mappings for the high frequency letters (etaoin shrdlu...) rather than doing them in alphabetical order. Finishing this off is left as an exercise for the reader![]()
"I have blessed you with my absolute definitions of good and evil, so that you may join my crew with unhesitating, UNWAVERING tenacity."
-
knightmoves
- Member

- Posts: 678
- Joined: April 26th, 2018, 6:40 pm
- Has thanked: 4 times
- Been thanked: 122 times
Re: Codebusters B/C
Modular arithmetic takes a bit of getting used to. Once that makes sense, the affine cypher really isn't too bad. This is cryptanalysis of the affine cypher, which is the most complicated affine problem you might see, and even then, it's an almost completely mechanical process. There's no guessing letter combinations required: it's a small amount of arithmetic, plus a large amount of turning the handle.
-
knightmoves
- Member

- Posts: 678
- Joined: April 26th, 2018, 6:40 pm
- Has thanked: 4 times
- Been thanked: 122 times
Who is online
Users browsing this forum: No registered users and 0 guests