Skip to content

   We secure embedded systems

All posts

Embedded Security explained: Cryptographic Hash Functions

Embedded_Security-explained-Crypto-Hash-Functions


1. What Cryptographic hash functions are

2. Common Hashing Algorithms

3. What to choose in practice


 


Get started with SHA-2 or SHA-3 today

Our evaluation package for FPGA provides anything required to build a demo on your board. 

 


1. What Cryptographic hash functions are

Cryptographic hash functions are a key building block in embedded security. They take input data of any size and convert it into a fixed-length value, called a hash or message digest. This hash acts as a digital fingerprint of the data and is used to verify data integrity, detect modifications, and, when combined with a secret key, enable authentication in secure systems.

In embedded systems, hash functions are used in several critical areas:

  • Firmware integrity (secure boot): The system verifies firmware before execution
  • FPGA bitstream protection: Ensures only trusted configurations are loaded
  • Data integrity in memory: Detects corruption or manipulation
  • Message integrity in protocols: Used in TLS, IPsec, and similar protocols
  • Authentication (via HMAC): Adds authenticity to data using a secret key

A secure hash function has several core properties:

  • Preimage resistance: Given a hash, it is infeasible to find the original input.
  • Second preimage resistance: It is infeasible to find a different input with the same hash
  • Collision resistance: It is hard to find two inputs hashing to the same value.
  • Deterministic: The same input always produces the same hash
  • Avalanche effect: Small input changes lead to large output changes

 


2. Common Hashing Algorithms

Two common hash function families are widely used in practice.

  • SHA-2 (e.g., SHA-256, SHA-512) is the established standard in many systems. It is based on the Merkle–Damgård construction, which processes data in fixed-size blocks using a compression function. From a hardware perspective, SHA-2 has a regular structure, predictable control flow, and supports efficient pipelining, making it easy to integrate and suitable for high-throughput designs.

  • SHA-3 (Keccak) follows a different design approach using a sponge construction. Data is absorbed into a larger internal state (1600 bits), and the output is generated by extracting data from this state. SHA-3 is naturally resistant to length extension attacks and supports flexible output lengths.

For FPGA implementations, an important practical difference emerges: SHA3-256 processes significantly more data per round than SHA-256. In hardware architectures, this can result in higher throughput at the same clock frequency. FPGAs handle wide datapaths and bitwise operations efficiently, which makes SHA-3 a strong candidate for hardware-based designs.

Hash functions alone only provide integrity. For authentication, HMAC (Hash-Based Message Authentication Code) is used. HMAC combines a hash function with a secret key to generate a message authentication code (MAC). This ensures that only authorized parties can create or verify the message.


3. What to choose in practice

For FPGA-based systems:

  • SHA-2: best for compatibility and mature ecosystems
  • SHA-3: strong option for new, hardware-oriented designs
  • HMAC: required whenever authenticity is needed

The choice depends on system constraints such as area, throughput, integration effort, and long-term maintainability.