Function: rmail-encode-string
rmail-encode-string is a byte-compiled function defined in
rmail.el.gz.
Signature
(rmail-encode-string STRING MASK)
Documentation
Encode STRING with integer MASK, by taking the exclusive OR of the lowest byte in the mask with the first character of string, the second-lowest-byte with the second character of the string, etc., restarting at the lowest byte of the mask whenever it runs out. Returns the encoded string. Calling the function again with an encoded string (and the same mask) will decode the string.
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
(defun rmail-encode-string (string mask)
"Encode STRING with integer MASK, by taking the exclusive OR of the
lowest byte in the mask with the first character of string, the
second-lowest-byte with the second character of the string, etc.,
restarting at the lowest byte of the mask whenever it runs out.
Returns the encoded string. Calling the function again with an
encoded string (and the same mask) will decode the string."
(setq mask (abs mask)) ; doesn't work if negative
(let* ((string-vector (string-to-vector string)) (i 0)
(len (length string-vector)) (curmask mask) charmask)
(while (< i len)
(if (= curmask 0)
(setq curmask mask))
(setq charmask (% curmask 256))
(setq curmask (ash curmask -8))
(aset string-vector i (logxor charmask (aref string-vector i)))
(setq i (1+ i)))
(concat string-vector)))