The Fourier plane encryption algorithm is subjected to a heuristic known-plaintext attack. The simulated annealing algorithm is used to estimate the key using a known plaintext-ciphertext pair which decrypts the ciphertext with arbitrarily low error. The strength of the algorithm is tested by using the key to decrypt a different ciphertext encrypted using the same original key. The Fourier plane encryption algorithm is found to be susceptible to a known-plaintext heuristic attack. It is found that phase only encryption, a variation of Fourier plane encoding algorithm, successfully defends against this attack. Â© 2006 American Institute of Physics.