Fix KDF
Use scratch buffer to build plaintext