Encryption is a cryptographic primitive: it transforms a plaintext message into a ciphertext using a cryptographic algorithm called a cipher . Encryption in modern ciphers is performed using a specific algorithm and a secret, called the key . Since the algorithm is often public, the key must stay secret if the encryption stays secure.
Without knowing the secret, the reverse operation, decryption , is mathematically hard to perform. How hard depends on the security of the cryptographic algorithm chosen and evolves with the progress of cryptanalysis .