In recent years, heterogeneous machine learning accelerators have become of significant interest to science, engineering, and industry. At the same time, the looming post-quantum encryption era instigates the demand for increased data security. From a hardware processing point of view, electronic computing hardware is challenged by electronic capacitive interconnect delay and associated energy consumption. In heterogeneous systems, such as electronic–photonic accelerators, parasitic domain crossings limit throughput and speed. With analog optical accelerators exhibiting a strong potential for high throughput (up to petaoperations per second) and operation efficiency, their ability to perform machine learning classification tasks on encrypted data has not been broadly recognized. This work is a significant step in that direction. Here, we present an optical hashing and compression scheme that is inspired by SWIFFT, a post-quantum hashing family of algorithms. High degree optical hardware-to-algorithm homomorphism allows one to optimally harvest the potential of free-space data processing: innate parallelism, low latency tensor by-element multiplication, and zero-energy Fourier transformation operations. The algorithm can provide several orders of magnitude increase in processing speed as compared to optical machine learning accelerators with non-compressed input. This is achieved by replacing slow, high-resolution CMOS cameras with ultra-fast and signal-triggered CMOS detector arrays. Additionally, information acquired in this way will require much lower transmission throughput, less in silico processing power, storage, and will be pre-hashed, facilitating optical information security. This concept has the potential to allow heterogeneous convolutional Fourier classifiers to approach the performance of their fully electronic counterparts and enables data classification on hashed data.