Rewrote encrypt_apikey for better security