Untitled

Run Settings
LanguageJavaScript
Language Version
Run Command
const rnd = (p) => Math.floor(Math.random() * (p - 1)) + 1 // our secret, there are maximum `p*p` equivalent ways of representing any number by this obfuscation method const p = 7 const start = 27182; // obfuscate i const enc = i => { const r = rnd(p) return r * (i + start) * p + r } // deobfuscate e const dec = e => { const r = e % p const ri = (e - r) / p return (ri / r) - start } var cid = 500 console.log(enc(cid), enc(cid).toString(24)) module.exports = {enc, dec}
Editor Settings
Theme
Key bindings
Full width
Lines