Added extra finish condition to manage last input buffer sizes < 32 bytes