Function: emerge-hash-string-into-string

emerge-hash-string-into-string is a byte-compiled function defined in emerge.el.gz.

Signature

(emerge-hash-string-into-string S)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/emerge.el.gz
;; Hash a string into five characters more-or-less suitable for use in a file
;; name.  (Allowed characters are ! through ~, except /.)
(defun emerge-hash-string-into-string (s)
  (let ((bins (vector 0 0 0 0 0))
	(i 0))
    (while (< i (length s))
      (aset bins (% i 5) (% (+ (* (aref bins (% i 5)) 35)
			       (aref s i))
			    65536))
      (setq i (1+ i)))
    (mapconcat (lambda (b)
		 (setq b (+ (% b 93) ?!))
		 (if (>= b ?/)
		     (setq b (1+ b)))
		 (char-to-string b))
	       bins "")))