symbol representation based cipher? [closed]

so i had an idea recently for a cipher. the idea is as follows: for every ascii character in the input, replace it with a corresponding sequence of 25 binary digits that, when arranged into a 5x5 grid, make an image that relates to the character. take the output binary sequence, and convert it back to ascii. the benefits i think this cipher may have are: only the sender and recipient of the info know what images correspond to what characters, therefore making it harder to guess, since the 25 digits don't line up neatly with bytes, the data of some characters will overflow to the next byte, making it not as obvious whats going on, and lastly, it can easily be combined with other ciphers to make even the decrypted binary arrange properly still look like meaningless gibberish. my question is, does it provide any real level of security to a message transferred between two people, assuming those trying to decipher it have no prior knowledge about the cipher? thank you. by the way this is as a followup to my previous question about the vigenere cipher, as something else to add security to it. link to the question here: trying to identify the key of a vigenere cipher via brute force

• Hmm, please expand upon "a corresponding sequence of 25 binary digits..." And where do they come from? Commented May 12, 2021 at 14:32
• @PaulUszak please look at what follows the comma, the sequence is decided by having a corresponding 5x5 image for each character, and these images are chosen by the people using the cipher Commented May 12, 2021 at 14:34
• So it's an exact and fixed 1:1 mapping as char$\to$image? Commented May 12, 2021 at 15:00
• @PaulUszak a character is replaced with that binary sequence which is just the digits that make up the corresponding image. when translating back, you just convert the output ascii back to binary, and then each chunk of 25 digits is replaced with the corresponding character. Commented May 12, 2021 at 15:02

1 Answer

It sounds like a nice codebreaking puzzle, but little more than that.

If the encryption algorithm is known to the attacker, they can map each 5x5 binary grid to an arbitrarily chosen symbol (say, the number of distinct 5x5 grids seen in the message so far) and then solve it as a simple monoalphabetic substitution cipher e.g. using frequency analysis.

Note that this attack does not depend on the choice of the 5x5 pixel grid patterns in any way. In practice, if the patterns are not chosen at random, the pattern chosen to represent each plaintext character might provide additional clues to the attacker. But the generic attack described above works even if they don't.

(Using multiple grids per character and choosing between them at random would turn your scheme into a homophonic substitution cipher, which can be somewhat harder to break than simple substitution especially if the amount of available ciphertext is low. But even homophonic substitution can be broken via statistical analysis if enough ciphertext is available, and even more easily if the attacker has access to at least some known plaintext.)

If the encryption method is not known to the attacker, it may take them some time and effort to figure out that the ciphertext should be converted to binary, laid out on (a multiple of) five lines and then each 5x5 grid of bits should be treated as one character.

However, assuming that the ciphertext is long enough to contain at least some repeated grids, the method you describe will leave statistical patterns that will be very obvious if the ciphertext is analyzed in binary (e.g. an unexpectedly low number of distinct groups and an unexpectedly high serial autocorrelation when the ciphertext is divided into 5-bit groups) and still apparent to some extent even if it's analyzed e.g. as 8-bit bytes (since e.g. the number of distinct 5-byte / 40-bit groups will still be lower than expected of a random byte sequence).

Also, assuming that the attacker doesn't know the encryption algorithm violates Kerckhoffs' principle, and is considered an unsafe assumption in modern cryptography, as it's hard to prevent such secrets from leaking (you've just leaked your algorithm by posting it here!) and even harder to restore the security of a system after a leak (since a completely new and unrelated algorithm would have to be devised, analyzed and communicated to all parties). Instead, secure encryption schemes in the modern sense all feature a key of some kind, such that the system remains secure even if the attacker knows everything about it except the key, and such that the key can be easily changed if it's compromised.

While your scheme does have a "key" of sorts, in the choice of 5x5 bit grids to represent each character, this key does not offer much security since, as noted above, there are efficient generic attacks on monoalphabetic substitution ciphers (which yours effectively is, once the obfuscation layers are removed) that an attacker can use to find the key. Thus, any additional security your cipher offers beyond that of a simple substitution cipher is based entirely on its non-keyed obfuscation elements, and would thus be considered worthless in a modern security analysis.

• something i forgot to mention originally but have now edited in is that those attempting to decipher it do not have any prior knowledge about the cipher or how it works. Commented May 13, 2021 at 12:36
• @zackit: See the second part of my answer, then. Basically, that's not a safe assumption to make, especially since you've just posted a description of your cipher for everyone to see here. But even if you're right about that, a good codebreaker with access to enough ciphertext can probably still figure out the 5x5 bit structure just based on statistical examination of the ciphertext. Commented May 13, 2021 at 12:42
• I got excited when I saw "only the sender and recipient of the info know what images correspond to what characters". If the mapping was assigned per character in accordance with a separate and truly random control sequence (key) equivalent to the plaintext length, this would be an ertzas (and fancy) one time pad. I must calm down... Commented May 13, 2021 at 13:29