# Would this be considered secure?

Assume an algorithm that encrypts each letter in a string into a different one, using a key, but in such a way that if you were to change a single letter from the clean text, the encrypted text would look completely different.

Also assuming each letter doesn't get encrypted to the same letter.

Here is an example (not generated by an actual algorithm)

Clean:

Foo Bar Foo Bar

Encrypted:

GjhetvbawmgYerujkgry

And another example

Foe Bar Foo Bar

Encrypted, looks completely different from changing just one letter (and maybe even has a different length):

HjengaieyHgnAuYehkawTGn

Would that be considered a strong algorithm?

My thoughts:

Statistical analysis can't happen (right?) because there is no symmetry in the encryption (for example, the two "o"s in "Foo" turn into different letters).

So how would a cryptanalyst find the key from such an algorithm?

(To clarify, I'm not asking if an algorithm is powerful, just how a cryptanalyst would look at it, assuming he knows the algorithm (and knows the key length) and has the ciphertext)

• It looks like you have re-discovered the avalanche effect. Oct 25, 2016 at 22:11
• Oh, I was thinking about hashes when I was writing this question, since they look very different with the small change of a letter. Are there any cryptanalysis methods for public-key encryption functions that use the avalanche effect? Oct 25, 2016 at 22:14
• What you're describing sounds very much like the Enigma code. If a letter can never be encrypted as itself, this leaks information about the plaintext. Oct 25, 2016 at 22:48
• Haven't thought of that, indeed. But there is no such restriction in the algorithm in question, we just assume an algorithm that seems to turn letters into "random" (generated by an algorithm and a key) letters (this doesn't mean that the letter "e" for example can't turn into "e" (itself)). Assuming the cryptanalyst knows the algorithm and the cypher, can he find the plaintext and/or key? Oct 25, 2016 at 22:54

..., but in such a way that if you were to change a single letter from the clean text, the encrypted text would look completely different.

...

So how would a cryptanalyst find the key from such an algorithm?

(To clarify, I'm not asking if an algorithm is powerful, just how a cryptanalyst would look at it, assuming he knows the algorithm (and knows the key length) and has the ciphertext)

There are two issues with those questions, concerning the understading of cryptography:

• "would look completely different" is not a useful security property. There are countless ways how a ciphertext can leak information about the plaintext, despite "looking different". If you consider classical ciphers, where frequency analysis is used in some way quite often, this is just one possible example. It is not measureable or provable, if "looks different" is actually an effective encryption scheme.
• In the very last sentence you assumed the attacker (or cryptanalyst) knows the algorithm, keylength and has the ciphertext. First, there are different attack models, and your assumption is exactly a ciphertext only attack. And they are considered the weakest form of attack - we give the attacker the absolute minimum of information. From today's point of view however, these ciphertext-only attacks are irrelevant. In order to call any encryption scheme secure, most commonly we require resistance to chosen plaintext attacks as absolute minimum.

As a previous commenter pointed out, you're describing the avalanche effect. In a block cipher, every output bit should be dependent on every input bit. Changing a single bit of the key or a block of plaintext should, on average, cause half of the bits in the ciphertext block to change.

A cipher that exhibits the avalanche effect is not necessarily secure. It can still have statistical biases or be vulnerable to attacks such as differential or linear cryptanalysis.