Comment

Comment by TazeTSchnitzel

Mapping each base64 char to one word seems rather inefficient. If you have a longer list of N swears (say 256 because it's the size of a byte, making encoding easier), you could produce a more efficient base-N encoding, e.g.:

  var bytes = atob(base64msg),
      swearsMsg = '';
  for (var i = 0; i < bytes.length; i++) {
      newMsg += swears[bytes[i].charAt(0)] + ' ';
  }
Of course, it's still less efficient than base64, but it's an improvement. :)

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton