summaryrefslogtreecommitdiff
path: root/utilities.lisp
blob: b6cf16ad194ddf1971b059d61d6d61f388f4a87e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
;;;; utilities -- nuff said

(in-package :dnd)


(let ((host (uiop:hostname))
      (count 0))
  (defun nuid ()
    "Generates a Nearly Universal ID"
    (format nil "~36r"
            (sxhash
             (list
              (incf count)
              host
              (get-universal-time))))))

(defun hash-string (plaintext salt)
  "Hash plaintext using SALT"
  (flexi-streams:octets-to-string 
   (ironclad:digest-sequence
    :sha3
    (flexi-streams:string-to-octets (concatenate 'string salt plaintext)
                                    :external-format :utf-8))
   :external-format :latin1))