Minor optimisation to KDF algorithm.