/src/core/crypto.lisp
Lisp | 15 lines | 11 code | 4 blank | 0 comment | 0 complexity | 55d7bb1740ad59ddcb49ad2049b32881 MD5 | raw file
1 2(in-package :oauth) 3 4(defun string-or-octets->octets (x) 5 (etypecase x 6 (string (babel:string-to-octets x)) 7 ((simple-array (unsigned-byte 8)) x))) 8 9(defun hmac-sha1 (s key) 10 (let* ((s (string-or-octets->octets s)) 11 (key (string-or-octets->octets key)) 12 (hmac (ironclad:make-hmac key 'ironclad:sha1))) 13 (ironclad:update-hmac hmac s) 14 (ironclad:hmac-digest hmac))) 15