Encrypts an input, generates a key