Skip to content

Instantly share code, notes, and snippets.

@miyamuko
Created May 9, 2013 05:50
Show Gist options
  • Save miyamuko/5545801 to your computer and use it in GitHub Desktop.
Save miyamuko/5545801 to your computer and use it in GitHub Desktop.
サービスごとに異なるパスワードを使い分ける方法 for #xyzzy
;; http://d.hatena.ne.jp/kazuhooku/20130509/1368071543
(defvar *ore-password-length* 12)
(defvar *ore-password-master* nil)
(defun ore-password (domain password)
(let ((pass (delete #\LFD (si:base64-encode (si:hmac-sha-1 password domain :binary t)))))
(if (and *ore-password-length*
(< 0 *ore-password-length*))
(substring pass 0 *ore-password-length*)
pass)))
(defun ore-password-to-clipboard (domain)
(interactive "sDomain: ")
(unless *ore-password-master*
(setf *ore-password-master* (read-string "Master Password: ")))
(copy-to-clipboard (ore-password domain *ore-password-master*))
(message "Copy password to clipboard"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment