From 04ab68b09d906091f49ad63938b7a5f42b201358 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Mon, 20 Nov 2017 19:52:39 +0100 Subject: [PATCH] [Utils] Dual converter for ascii to hex --- site-lisp/db-utils.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index 112ce51..d13ea2d 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -179,6 +179,14 @@ major mode MODE." concat message)) +(defun db/ascii-to-hex (ascii-string) + "Convert ASCII-STRING to its hexadecimal representation." + (interactive "sString (ascii): ") + (->> (string-to-list ascii-string) ; redundant + (--map (format "%2X" it)) + (apply #'concat) + message)) + (defun db/ntp-to-time (high low &optional format-string) "Format NTP time given by HIGH and LOW (both integer) to time as given by FORMAT-STRING. If not given, FORMAT-STRING defaults to some ISO 8601-like format."