Hacker News new | ask | show | jobs
by masklinn 1116 days ago
You can just drop the end of the hash. That is essentially what sha-224, sha-384 , and sha-512/256 are.

Or you can use a hash where the internal state is larger than the output, which is the case of SHA3.

Note that this just protects against length extension, these are not MACs.

1 comments

SHA3 KMAC is almost just this (a keyed hash) --- with a length appended, and some domain separation. You can make a MAC out of a truncated keyed SHA2 hash (but don't).