From cae99f70652312a19e0e19bf4bda63c091c268f9 Mon Sep 17 00:00:00 2001 From: Vineet Kumar Date: Fri, 22 May 2026 18:33:47 -0400 Subject: reindent files --- kasi-totp.el | 4 ++-- kasi.el | 32 ++++++++++++++++---------------- 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." (setq string (upcase string)) (let* ((trimmed-array (append (string-trim-right string "=+") nil)) (hex (format "%X" (seq-reduce - (lambda (acc char) (+ (ash acc 5) (aref base32-alphabet char))) - trimmed-array 0)))) + (lambda (acc char) (+ (ash acc 5) (aref base32-alphabet char))) + trimmed-array 0)))) (if (cl-oddp (length hex)) (concat "0" hex) 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.") (kasi--filename-short file))))) (defun kasi--random-string (length charset) - "Generate a random string of LENGTH using characters from CHARSET. + "Generate a random string of LENGTH using characters from CHARSET. Uses /dev/urandom for cryptographic security." - ;; I have not seen any other built-in way to get cryptographically - ;; random outputs in Emacs. - (let* ((bytes (with-temp-buffer - (call-process "dd" nil (current-buffer) nil - "if=/dev/urandom" "bs=1" (format "count=%d" (* length 4))) - (buffer-string))) - (charset-len (length charset)) - (result "")) - (dotimes (i length) - (setq result (concat result - (char-to-string - (aref charset - (% (aref bytes i) - charset-len)))))) - result)) + ;; I have not seen any other built-in way to get cryptographically + ;; random outputs in Emacs. + (let* ((bytes (with-temp-buffer + (call-process "dd" nil (current-buffer) nil + "if=/dev/urandom" "bs=1" (format "count=%d" (* length 4))) + (buffer-string))) + (charset-len (length charset)) + (result "")) + (dotimes (i length) + (setq result (concat result + (char-to-string + (aref charset + (% (aref bytes i) + charset-len)))))) + result)) ;; TODO implement some kind of validation of the sexp when saving (defun kasi--edit (file) -- cgit v1.2.3