We propose a new optical image encryption technique based on exclusive-OR (XOR) operations for a security system that controls the entrance of authorized persons. The basic idea is that we convert a gray-level image to eight bit planes for image encryption. We use the XOR operation that is commonly used such as the well-known encryption method. The input image is encrypted by performing optical XOR operations with the key bit stream that are generated by digital encryption algorithms. The gray level input image is converted to eight bit planes, which are represented on a liquid crystal device (LCD). The key data represented on different LCDs is reproduced to eight bit planes by a lenslet array. The optical XOR operations between the key data and the bit planes are performed by the polarization encoding method. The results of XOR operations, which are detected by a CCD camera, are converted to an encrypted gray-level image and the image is used as an input to the binary phase extraction joint transform correlator for comparison with reference images. We present some simulation results that verify the proposed method.