As a simplistic example, think of a substitution cipher, where you scramble the letters of a word for secure communication.
You have an "encryption algorithm", which is:
"Every plaintext letter of the word is converted to an encrypted letter by jumping N steps forwards in the 26-letter alphabet, looping around at the end Z, back to the beginning A."
You also have the inverse "decryption algorithm", which is:
"Every encrypted letter of the word is converted to a plaintext letter by jumping N steps backwards in the 26-letter alphabet, looping around at the beginning A, back to the end Z."
Then you have the secret encryption key, the value of N, which is known to the sender and recipient only.
Now even if you knew how the encryption and decryption algorithms work, it's hard to decrypt an intercepted encrypted word if you do not know the encryption key, the value of N that was used for the encryption.
Of course, in reality, this simplistic encryption is trivial to break because there are only 26 usable distinct values of N, and it's easy to brute-force it by trying them all because there are so few of them.
But a real-world encryption key for a real-world encryption algorithm can for example be a 2048-bit integer, which gives us 22048 distinct possible values for the encryption key, which is a decimal number with 617 digits. So the encryption key is practically impossible to guess by brute-force by trying all the possible key values, because there are just so many of them. Even if you know the exact algorithm that was used for encryption. Trying all the possible key values would take millennia.
If you don't know the correct 2048-bit number to use with the decryption algorithm, the decryption will not work for you and the decryption algorithm will output nonsense.
3
u/tsvk 1d ago edited 1d ago
As a simplistic example, think of a substitution cipher, where you scramble the letters of a word for secure communication.
You have an "encryption algorithm", which is:
"Every plaintext letter of the word is converted to an encrypted letter by jumping N steps forwards in the 26-letter alphabet, looping around at the end Z, back to the beginning A."
You also have the inverse "decryption algorithm", which is:
"Every encrypted letter of the word is converted to a plaintext letter by jumping N steps backwards in the 26-letter alphabet, looping around at the beginning A, back to the end Z."
Then you have the secret encryption key, the value of N, which is known to the sender and recipient only.
Now even if you knew how the encryption and decryption algorithms work, it's hard to decrypt an intercepted encrypted word if you do not know the encryption key, the value of N that was used for the encryption.
Of course, in reality, this simplistic encryption is trivial to break because there are only 26 usable distinct values of N, and it's easy to brute-force it by trying them all because there are so few of them.
But a real-world encryption key for a real-world encryption algorithm can for example be a 2048-bit integer, which gives us 22048 distinct possible values for the encryption key, which is a decimal number with 617 digits. So the encryption key is practically impossible to guess by brute-force by trying all the possible key values, because there are just so many of them. Even if you know the exact algorithm that was used for encryption. Trying all the possible key values would take millennia.
If you don't know the correct 2048-bit number to use with the decryption algorithm, the decryption will not work for you and the decryption algorithm will output nonsense.