I am just curious about whether it is safe or not to use this encryptiong method showed below. Assume we have a list of keys to be used in the encrypt process, for example, ['apple','coco','piano']. For each key in the list, we use this key and the Vigenere cipher method to encrypt the text. So in this example here, we will first use 'apple' to encrypt the target text, then use 'coco' to encrypt again, finally use 'piano' to encrypt. So, is it safe to use this kind of method? Thanks.
If you apply the Vigenere cipher severel times with different keys, a (common) key can be constructed that will give the same result.
When encrypting with Vigenere you would repeate the key to match the data you want to encrypt. If you want to encrypt the text the secret message is we attack a dawn
with the key apple
you would set it up like this:
Text: the secret message is we attack a dawn
Key: appleappleappleappleappleappleappleapp
--------------------------------------
Encrypted: uxu xfshqy cuexbwu nt mq bjjmhl q ibmd
If you then were to encrypt that again with coco
you would have:
Text: uxu xfshqy cuexbwu nt mq bjjmhl q ibmd
Key: cococococococococococococococococococo
--------------------------------------
Encrypted: xmx auvwtn rxtaqzj cw pf qmypwo t lqps
Also notice how coco
is actually a "weak" key that give the same result at just co
! Anyway .. in this case a combined key of apple
& coco
is desahpseot
so you have:
Text: the secret message is we attack a dawn
Key: desahpseotdesahpseotdesahpseotdesahpse
--------------------------------------
Encrypted: xmx auvwtn rxtaqzj cw pf qmypwo t lqps
Notice how the key desahpseot
is just combined like this:
key 1: appleapple
key 2: cococococo
----------
Combined key: desahpseot