added encryption utility function