loading...

re: A unicode substitution cipher algorithm VIEW POST

FULL DISCUSSION
 

I like this approach in node:

big = str => {
  const out = Buffer.from(str, "ucs2"),
    len = out.length
  for (let i = 0; i < len; i += 2) {
    const ascii = out[i]
    if (ascii < 0x21 || ascii > 0x7E) continue
    out[i] = ascii - 0x20
    out[i + 1] = 0xff
  }
  return out.toString("ucs2")
}
big("Big Chungus")

Could probably do similar with TextEncoder in web.

code of conduct - report abuse