I have an object that has pairs of replacement values used for simple encoding / decoding (not for security, just for a convenience; too complicated to explain it all here).
You can create a reversed version of the mapping programmatically (instead of by hand) and use it instead.
var rev = {} for (key in obj) rev[obj[key]] = key