Boolean SHA256 with TFHE-rs
Blog post from Zama
The blog post outlines the transformation of a standard SHA256 hash algorithm into its homomorphic version using TFHE-rs, as part of the Zama Bounty Program, based on the contribution by a GitHub user. It begins by explaining the standard SHA256 function, which processes input data in 512-bit chunks, and details the operations involved, including bitwise AND, XOR, NOT, and others. The post then explores the conversion of these operations into homomorphic versions, which allow computations on encrypted data, emphasizing the need for performance optimization due to the high cost of homomorphic operations. Techniques such as using the Rayon crate for parallel processing and optimizing addition operations with Carry Lookahead Adders are discussed. The tutorial also covers methods to further improve performance through parallel processing and the usage of different parallel prefix algorithms like Brent-Kung and Ladner-Fischer, which are suitable for different computational environments. Finally, the blog post provides guidance on using the homomorphic SHA256 function, illustrating the encryption and decryption processes, and highlights the importance of client-side padding to maintain data privacy.