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.