If you want to encrypt integer values, then you're going to need to store the result as a string. If you're also going to roundtrip those values from the server to the browser, you'll need this code.