Function: ntlm-smb-hash

ntlm-smb-hash is a byte-compiled function defined in ntlm.el.gz.

Signature

(ntlm-smb-hash IN KEY FORW)

Documentation

Return hash string of length 8 for IN of length 8 and KEY of length 8.

FORW is t or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/net/ntlm.el.gz
(defun ntlm-smb-hash (in key forw)
  "Return hash string of length 8 for IN of length 8 and KEY of length 8.
FORW is t or nil."
  (let ((out (make-string 8 0))
	(inb (make-string 64 0))
	(keyb (make-string 64 0))
	(key2 (ntlm-smb-str-to-key key))
	(i 0))
    (while (< i 64)
      (unless (zerop (logand (aref in (/ i 8)) (ash 1 (- 7 (% i 8)))))
	(aset inb i 1))
      (unless (zerop (logand (aref key2 (/ i 8)) (ash 1 (- 7 (% i 8)))))
	(aset keyb i 1))
      (setq i (1+ i)))
    (let ((outb (ntlm-smb-dohash inb keyb forw))
          aa)
      (setq i 0)
      (while (< i 64)
        (unless (zerop (aref outb i))
	  (setq aa (aref out (/ i 8)))
	  (aset out (/ i 8)
                (logior aa (ash 1 (- 7 (% i 8))))))
        (setq i (1+ i)))
      out)))