summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVineet Kumar <git@vineetk.net>2026-05-22 18:33:47 -0400
committerVineet Kumar <git@vineetk.net>2026-05-23 19:30:28 -0400
commitcae99f70652312a19e0e19bf4bda63c091c268f9 (patch)
tree21e445b3ac284b53c696fb8c55bd3dde06f1e960
parent4ae6441547afd94eb8826cb2b4f13bc569dd9d56 (diff)
reindent files
-rw-r--r--kasi-totp.el4
-rw-r--r--kasi.el32
2 files changed, 18 insertions, 18 deletions
diff --git a/kasi-totp.el b/kasi-totp.el
index f22c30c..5a54397 100644
--- a/kasi-totp.el
+++ b/kasi-totp.el
@@ -86,8 +86,8 @@ concept of encoding partial quanta is not implemented fully."
86 (setq string (upcase string)) 86 (setq string (upcase string))
87 (let* ((trimmed-array (append (string-trim-right string "=+") nil)) 87 (let* ((trimmed-array (append (string-trim-right string "=+") nil))
88 (hex (format "%X" (seq-reduce 88 (hex (format "%X" (seq-reduce
89 (lambda (acc char) (+ (ash acc 5) (aref base32-alphabet char))) 89 (lambda (acc char) (+ (ash acc 5) (aref base32-alphabet char)))
90 trimmed-array 0)))) 90 trimmed-array 0))))
91 (if (cl-oddp (length hex)) 91 (if (cl-oddp (length hex))
92 (concat "0" hex) 92 (concat "0" hex)
93 hex))) 93 hex)))
diff --git a/kasi.el b/kasi.el
index 9f899e8..1efd02b 100644
--- a/kasi.el
+++ b/kasi.el
@@ -91,23 +91,23 @@ Two %s are needed for password and username for now.")
91 (kasi--filename-short file))))) 91 (kasi--filename-short file)))))
92 92
93(defun kasi--random-string (length charset) 93(defun kasi--random-string (length charset)
94 "Generate a random string of LENGTH using characters from CHARSET. 94 "Generate a random string of LENGTH using characters from CHARSET.
95Uses /dev/urandom for cryptographic security." 95Uses /dev/urandom for cryptographic security."
96 ;; I have not seen any other built-in way to get cryptographically 96 ;; I have not seen any other built-in way to get cryptographically
97 ;; random outputs in Emacs. 97 ;; random outputs in Emacs.
98 (let* ((bytes (with-temp-buffer 98 (let* ((bytes (with-temp-buffer
99 (call-process "dd" nil (current-buffer) nil 99 (call-process "dd" nil (current-buffer) nil
100 "if=/dev/urandom" "bs=1" (format "count=%d" (* length 4))) 100 "if=/dev/urandom" "bs=1" (format "count=%d" (* length 4)))
101 (buffer-string))) 101 (buffer-string)))
102 (charset-len (length charset)) 102 (charset-len (length charset))
103 (result "")) 103 (result ""))
104 (dotimes (i length) 104 (dotimes (i length)
105 (setq result (concat result 105 (setq result (concat result
106 (char-to-string 106 (char-to-string
107 (aref charset 107 (aref charset
108 (% (aref bytes i) 108 (% (aref bytes i)
109 charset-len)))))) 109 charset-len))))))
110 result)) 110 result))
111 111
112;; TODO implement some kind of validation of the sexp when saving 112;; TODO implement some kind of validation of the sexp when saving
113(defun kasi--edit (file) 113(defun kasi--edit (file)