diff options
Diffstat (limited to 'utilities.lisp')
-rw-r--r-- | utilities.lisp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/utilities.lisp b/utilities.lisp new file mode 100644 index 0000000..dd4455c --- /dev/null +++ b/utilities.lisp @@ -0,0 +1,25 @@ +;;;; utilities -- nuff said + +(in-package :dungeons-and-deadlines) + + +(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)) + |