iadd Fowler Noll Vo hash function - reed-alert - Lightweight agentless alerting system for server Err bitreich.org 70
hgit clone git://bitreich.org/reed-alert/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/reed-alert/ URL:git://bitreich.org/reed-alert/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/reed-alert/ bitreich.org 70
1Log /scm/reed-alert/log.gph bitreich.org 70
1Files /scm/reed-alert/files.gph bitreich.org 70
1Refs /scm/reed-alert/refs.gph bitreich.org 70
1Tags /scm/reed-alert/tag bitreich.org 70
1README /scm/reed-alert/file/README.gph bitreich.org 70
1LICENSE /scm/reed-alert/file/LICENSE.gph bitreich.org 70
i--- Err bitreich.org 70
1commit 1b2f15bf2974f893f7dd55ff6b4742dd0c0430d2 /scm/reed-alert/commit/1b2f15bf2974f893f7dd55ff6b4742dd0c0430d2.gph bitreich.org 70
1parent 3f03224030fd0b48e2de384f56c78834da14643b /scm/reed-alert/commit/3f03224030fd0b48e2de384f56c78834da14643b.gph bitreich.org 70
hAuthor: Solene Rapenne <solene@perso.pw> URL:mailto:solene@perso.pw bitreich.org 70
iDate: Wed, 17 Jan 2018 07:57:38 +0100 Err bitreich.org 70
i Err bitreich.org 70
iadd Fowler Noll Vo hash function Err bitreich.org 70
i Err bitreich.org 70
iDiffstat: Err bitreich.org 70
i M functions.lisp | 17 +++++++++++++++-- Err bitreich.org 70
i Err bitreich.org 70
i1 file changed, 15 insertions(+), 2 deletions(-) Err bitreich.org 70
i--- Err bitreich.org 70
1diff --git a/functions.lisp b/functions.lisp /scm/reed-alert/file/functions.lisp.gph bitreich.org 70
i@@ -10,6 +10,18 @@ Err bitreich.org 70
i (defparameter *green* (color 1 32)) Err bitreich.org 70
i (defparameter *yellow* (color 0 33)) Err bitreich.org 70
i Err bitreich.org 70
i+;; simple hash function (Fowler Noll Vo) Err bitreich.org 70
i+;; https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function Err bitreich.org 70
i+(defun fnv-hash(string) Err bitreich.org 70
i+ "return a hash from a string" Err bitreich.org 70
i+ (let ((FNV_prime 2) Err bitreich.org 70
i+ (hash 26123230013)) Err bitreich.org 70
i+ (loop for octet-of-data across string Err bitreich.org 70
i+ do Err bitreich.org 70
i+ (setf hash (* FNV_prime Err bitreich.org 70
i+ (logxor hash (char-code octet-of-data))))) Err bitreich.org 70
i+ hash)) Err bitreich.org 70
i+ Err bitreich.org 70
i ;; common-lisp don't have a split string function natively Err bitreich.org 70
i (defun replace-all (string part replacement &key (test #'char=)) Err bitreich.org 70
i (with-output-to-string (out) Err bitreich.org 70
i@@ -72,8 +84,9 @@ Err bitreich.org 70
i (or ,@body))) Err bitreich.org 70
i Err bitreich.org 70
i (defun =>(level fonction &rest params) Err bitreich.org 70
i- (format t "[~a~a ~20A~a] ~35A" *yellow* level fonction *white* (getf params :desc params)) Err bitreich.org 70
i- (let ((result (funcall fonction params))) Err bitreich.org 70
i+ (format t "[~a~a ~20A~a] ~45A" *yellow* level fonction *white* (getf params :desc params)) Err bitreich.org 70
i+ (let ((hash (fnv-hash (format nil "~{~a~}" (nconc (list level fonction) (remove-if #'symbolp params))))) Err bitreich.org 70
i+ (result (funcall fonction params))) Err bitreich.org 70
i (if (not (listp result)) Err bitreich.org 70
i (progn Err bitreich.org 70
i (format t " => ~asuccess~a~%" *green* *white*) Err bitreich.org 70
.
Response:
text/plain