Home / Learn Verilog / Project 19: Simple Hash Core (Checksum and Mixer)
Project 19: Simple Hash Core (Checksum and Mixer)
A mixing round and a Fletcher-style checksum, with the real SHA idea.
Breaking it down
Definition
Build a small hash-like mixing core with rotates, XOR and additions, and a Fletcher checksum. Learn how the real SHA-256 round functions are built from the same pieces.
Why you need this
Projects turn knowledge into skill: you design, simulate, debug and finally see real hardware react.
How it works
Simulate in the browser, then build for your board following the steps.
Where you'll see this
- Portfolio
- Interviews
- Learning by doing
What you will build
Build a small hash-like mixing core with rotates, XOR and additions, and a Fletcher checksum. Learn how the real SHA-256 round functions are built from the same pieces.
| Level | Time | Works in simulation only? |
|---|---|---|
| Advanced | 6 hours | Simulation; this is a teaching hash, not secure |
What you need (equipment and tools)
Read this table once and you will know exactly what to buy or prepare. You can do the simulation part with only a computer and the free tools.
| Item | What it is (in simple words) | Why you need it | Approx. cost |
|---|---|---|---|
| Computer (Windows, Linux or macOS) | Your normal laptop or desktop. You write Verilog here and run the free tools. | Simulator, synthesis and programmer all run on it. | you have it |
| Free software: Icarus Verilog + GTKWave (simulation), Yosys + nextpnr or the vendor IDE (build), openFPGALoader (program) | The programs that compile and simulate your design. | Everything in this course can be simulated with only these free tools. | free |
| FPGA development board (e.g. Tang Nano 9K, Basys 3, iCEBreaker, Arty A7) | A small circuit board with an FPGA chip, an oscillator (clock), LEDs, buttons and a USB port. The FPGA is the "blank hardware" that your Verilog turns into a real circuit. | This is where your design actually runs. Without it you can only simulate. | about $15 (Tang Nano 9K) to $150 (Arty A7) |
| USB-to-serial adapter (CP2102, CH340 or FT232, 3.3 V level) | A small dongle that turns USB into TX/RX pins that a UART design can talk to. | Lets the PC send/receive bytes with your design in a terminal program. | $3 |
Connections
| Signal | Direction | Goes to | Note |
|---|---|---|---|
| uart_rx | input | bytes to hash | |
| uart_tx | output | result bytes |
Step 1: simulate the design
The exact value matters less than the idea: small changes in input flip many output bits.
Step by step
- Run the mixer and change one letter; compare outputs.
- Count how many bits differ between the two hashes.
- Convert the loop into a one-round-per-clock FSM.
- Read the SHA-256 spec and implement the sigma functions.
- Add UART input and output.
If it does not work
| Symptom | Likely cause | Fix |
|---|---|---|
| Board not detected | Charge-only cable or no driver | Use a data cable, install the vendor driver |
| Nothing happens | Wrong pin constraints | Recheck every pin against the board manual |
| Different result each run | Uninitialized state | Set the initial value |
| Rotate wrong | Shift amount | Use (v << n) | (v >> (32-n)) |
Test what you just read
1. Avalanche effect means...
Good mixing.