  Hash algorithms are fundamental tools in cryptography, offering irreversible
and sensitive transformations of input data for various security purposes. As
computing architectures evolve towards heterogeneous systems, efficiently
harnessing diverse computing resources for hash encryption algorithms becomes
crucial. This paper presents HETOCompiler, a novel cryptography compilation
framework designed for heterogeneous systems. Leveraging Multi-Level
Intermediate Representation (MLIR), HETOCompiler abstracts syntax and semantics
for cryptographic primitives and heterogeneous computing models, facilitating
efficient compilation of high-level hash encryption algorithms into executable
programs compatible with diverse devices. Experimental results demonstrate
significant performance improvements over existing OpenSSL library, with
average enhancements of 49.3x, 1.5x, and 23.4x for SHA-1, MD5, and SM3
algorithms respectively.
