SHA256 vs SHA224

Was looking for a SHA256 library for Elm and came across elm-sha256, and found two methods, sha256 and sha224.

Have used sha256 a lot in past, but was curious as to why sha224. One obvious difference between them is the size of output: 256 bits vs 224 bits, so 32bits less.

Reduced size has a few implications: less space to store hashes, in memory and on disc, could be useful if you have lots of hashes to store. Fewer bits means slightly higher chances of hash collisions.

One thing that stuck me, why another algorithm? If space saving was the concern, why not just compute sha256 and then truncate the last 4 bytes? While it works, it’s wasteful as you are now doing more work, and then throwing some of it away.

Table Of Content

Immobile v2


Rust: Or Type

Link Log

August 2020

July 2020

June 2020

May 2020

April 2020

March 2020

February 2020

January 2020


Books Have Read / Recommend

Product Management Books

Badass: Making Users Awesome


Five Cs of An Organisation

Success and failure of encryption

Open Source

Observer: Observability for Rust

Realm: Web Development Framework Using Rust and Elm

MartD: Server To Browser Messages

On Writing And Formats Of Written Communications

Rust Stuff

Rust feature flags

Why is diesel not compatible with async?

Making Postgres Only Diesel Code To Also Support Sqlite

Rust Git2’s Concepts

Git Hash And Build Date In Rust Build

Systray Only Native App In Rust

Software and Tools I Use Often


DNS Over HTTPS Controversy

The Patel Motel Cartel

Standalone Complex


January 2020

Word Of The Day





Nix On OSX Catalina

Postgres: WAL / Logical Decoding

Postgres: Listen-Notify



Go All The Way

SSH Commands



Nu Shell

SHA256 vs SHA224

Pronouns Bad


Web Components

Early Return