Automatic Synthesis of Specialized Hash Functions
This paper introduces a technique for synthesizing hash functions specialized to particular byte formats. This code generation method leverages three prevalent patterns: (i) fixed-length keys, (ii) keys with common subsequences, and (iii) keys ranging on predetermined sequences of bytes. Code generation involves two algorithms: one identifies relevant regular expressions within key examples, and the other generates specialized hash functions based on these expressions. Comparative analysis demonstrates that the synthetic functions outperform the general-purpose hashes in the C++ Standard Template Library and the Google Abseil Library when keys are given in ascending, normal or uniform distribution. In applications where low-mixing hashes are acceptable, the synthetic functions achieve speedups ranging from 2% to 11% on full benchmarks, and speedups of almost 50x once only hashing speed is considered.
Authors
- Renato B. Hoffmann (ORCID: https://orcid.org/0000-0002-1039-1290)
- Leonardo G. Faé (ORCID: https://orcid.org/0009-0008-0323-8950)
- Fernando Magno Quintão Pereira (ORCID: https://orcid.org/0000-0002-0375-1657)
- Dalvan Griebler (ORCID: https://orcid.org/0000-0002-4690-3964)
- Xinliang Li (ORCID: https://orcid.org/0000-0002-4223-2796)
Institutions
- Universidade Federal de Minas Gerais (BR)
- Google (United States) (US)
- Pontifícia Universidade Católica do Rio Grande do Sul (BR)
Publication Details
- Published
- 2025-02-22
- DOI
- https://doi.org/10.1145/3696443.3708940
- Primary Topic
- Cryptographic Implementations and Security
- Type
- article
- Field-Weighted Citation Impact
- 0.00