Function: encode-hex-string
encode-hex-string is a byte-compiled function defined in
hex-util.el.gz.
Signature
(encode-hex-string STRING)
Documentation
Encode octet STRING to hexadecimal string.
Source Code
;; Defined in /usr/src/emacs/lisp/hex-util.el.gz
(defun encode-hex-string (string)
"Encode octet STRING to hexadecimal string."
(let* ((len (length string))
(dst (make-string (* len 2) 0))
(idx 0)(pos 0))
(while (< pos len)
;; logand and ash are not byte-coded.
;; (aset dst idx (num-to-hex-char (logand (ash (aref string pos) -4) 15)))
(aset dst idx (num-to-hex-char (/ (aref string pos) 16)))
(setq idx (1+ idx))
;; (aset dst idx (num-to-hex-char (logand (aref string pos) 15)))
(aset dst idx (num-to-hex-char (% (aref string pos) 16)))
(setq idx (1+ idx)
pos (1+ pos)))
dst))