Score:0

How to break Random Subsitution Cipher that changes key every 16 characters?

lb flag

Monoalphabhatic Random Subsitution Cipher is pretty hard to crack compared to Ceasar Cipher especially through brute force but using frequency analysis, provided enough cipher text is easy.

But what if key for the subsitution changes lets say every 16 characters. Then there wouldn't be enough cipher text for frequency analysis. So what should be done to crack such cipher?

Steps of encryption

  1. All characters of string are lowercased.
  2. Password is interpreted:
  • First 3 characters of password are taken as radix 64 number (number in base 64) so it creates a number which is used as seed in a PRNG.
  • Last 3 characters are interpreted in the same way to produce another number which is used as multiplier in PRNG. This multiplier is incremented by 1 every 16 characters of plain text are encrypted.
  • Middle most characters are also converted to a number used to increment seed after every 16 characters of plain text are encrypted.
  1. Main Encryption starts by suffling a array that contains 26 characters of English using Fisher Yates Suffle algorithm.
  2. Fisher Yates uses a modified version of Linear Congruent Generator in which xn = xn * multiplier + n (mod 2^32) where n is index of seed. Because of changing increment, it makes it hard to determine previous seed.
  3. To substitute individual characters, first alphabet is located on unshuffled array so A = 0, B = 1 and so on... Then they are subsituted by character on that index in shuffled array. For example, in shuffled array, T is located at 0, so in plain text every A will be subsituted with T.
  4. Any other characters like space, full stop, etc. are ignored.
  5. Go back to step 3 untill all text is encrypted.

Note that, though it encrypts text in blocks for 16 characters, it does not add any padding in text. Cipher text is always same to plain text in length.

Also what would happen if instead of encrypting 26 characters of English, I encrypt all 256 characters of a single byte?

I hope I have explained question as clearly as possible.

fgrieu avatar
ng flag
It seems to be CTF season, so I'll only give a hint: assume `z` is odd. What's bound to happen sooner or later?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.