How to hash data with Java MessageDigest

Let’s have a look at the Java Security MessageDigest class that provides one-way hash functions and how to get individual MessageDigest instances without using Strings for the algorithm names everywhere in our code.

Cleaner if-statements: Indentation hell & failing fast

Let’s have a look at two common issues with if statements: Indentation hell aka too deeply nested if statements and fail fast if statements at the beginning of a certain code block instead of wrapping the whole code block with an if statement.