Created
June 20, 2021 19:02
-
-
Save ppsdatta/c71a5be1661d7ae838e951977278c548 to your computer and use it in GitHub Desktop.
Generate hmac with sha256 in Common Lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ql:quickload :ironclad) | |
(defpackage :test (:use :cl :ironclad)) | |
(in-package :test) | |
(defun hmac-sha256 (secret data) | |
(let* ((secret-bytes (ascii-string-to-byte-array secret)) | |
(data-bytes (ascii-string-to-byte-array data)) | |
(h (make-hmac secret-bytes :sha256))) | |
(update-hmac h data-bytes) | |
(byte-array-to-hex-string (hmac-digest h)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment