djcb comments on Reforming rot13 - Less Wrong

2 Post author: DanielVarga 04 November 2011 11:41PM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (35)

You are viewing a single comment's thread.

Comment author: djcb 05 November 2011 02:04:52PM *  0 points [-]

People using emacs to edit text boxes, for example when using It's all text! or org-protocol can use M-x rot13-region (after the text-to-be-rot13'ed is marked/selected).

Interestingly, there's also M-x toggle-rot13-mode, which, when enabled, translates the current window to rot13, including your input.

For non-ascii encoding, maybe base64 would be useful? M-x base64-encode-region and M-x base64-decode-region are your friends here. If people find substitution cyphers to easy tor read, the text could simply be reverted (M-x reverse-region). That should work well enough for most people...

Edit: quick hack for reversed base64:

(defun toggle-reverse-base64-region (b e)
"Instead of rot13, we can use reversed base64 to hide text. The
encoded text is prefixed with \"rb64:\"."
(interactive "r")
(let*
((str (buffer-substring b e))
(match (string-match "^rb64:\\(.*\\)" str))
(revstr (lambda (str) (concat (reverse (string-to-list str)))))
(code
(if match
(funcall revstr (base64-decode-string (match-string 1 str)))
(concat "rb64:" (base64-encode-string (funcall revstr str))))))
(kill-region b e)
(insert code)))