Problem 44924. Create State Array for initiating SHA-3-224 Hash
Solution Stats
Problem Comments
-
3 Comments
this looks like a very cool problem, perhaps a bit of a summary description of the standard (c.f. 27-page doc) may help make it a bit more enticing for curious but non-crypto-oriented people like myself?
Added some references to the problem description.
I worked many hours on this problem and then eventually gave up and cheated. This challenge isn’t about writing lots of code, it’s about getting the conventions exactly right. Pay close attention to how bits are ordered within each byte (MSB vs. LSB), how the 1600‑bit state is divided into 25 lanes of 64 bits, and how MATLAB’s reshape and transpose affect the mapping. The padding rule (“pad10*1” with the domain suffix) must be applied at the bit level so the final 1 lands in the correct place. If your output looks close but not exact, instrument the first few slices and the last slice — those usually reveal whether your bit order, lane order, or padding is off. Once those three align, everything else falls into place.
Think in bits, not bytes: The harness is checking individual bits, so be very clear about whether you’re treating bytes as MSB‑first or LSB‑first. A single flipped convention will cascade into dozens of mismatches.
Lane mapping matters: The 1600‑bit state is arranged as 25 lanes of 64 bits. Pay attention to how those lanes are ordered (column‑major vs row‑major) and how MATLAB’s reshape fills arrays.
Reshape is your friend: Instead of manually looping over x, y, and z, consider how a clever combination of reshape and transpose can map a flat bitstream into the 5×5×64 state. The harness itself uses reshape tricks, so aligning with that logic is key.
Padding is subtle: The “pad10*1” rule plus the domain separation suffix must be applied at the bit level. Double‑check that the final 1 lands in the correct slice.
Instrument (debugging tools) early: Print out the first few slices (1–4) and the last slice (64). If those line up, the rest usually will too.
Don’t over‑correct: If Case 1 passes but Case 2 fails (or vice versa), resist the urge to swap axes or flip conventions back and forth. The harness is consistent — the trick is to find the one mapping that satisfies both.
Solution Comments
Show commentsProblem Recent Solvers3
Suggested Problems
-
Project Euler: Problem 7, Nth prime
1606 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
857 Solvers
-
Output any real number that is neither positive nor negative
401 Solvers
-
Area of an equilateral triangle
6615 Solvers
-
9911 Solvers
More from this Author57
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!