Tamper encoder in JavaScript