A simple encryption and encoding in JavaScript