PageRenderTime 21ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/src/core/crypto.lisp

http://github.com/skypher/cl-oauth
Lisp | 15 lines | 11 code | 4 blank | 0 comment | 0 complexity | 55d7bb1740ad59ddcb49ad2049b32881 MD5 | raw file
Possible License(s): LGPL-3.0
  1. (in-package :oauth)
  2. (defun string-or-octets->octets (x)
  3. (etypecase x
  4. (string (babel:string-to-octets x))
  5. ((simple-array (unsigned-byte 8)) x)))
  6. (defun hmac-sha1 (s key)
  7. (let* ((s (string-or-octets->octets s))
  8. (key (string-or-octets->octets key))
  9. (hmac (ironclad:make-hmac key 'ironclad:sha1)))
  10. (ironclad:update-hmac hmac s)
  11. (ironclad:hmac-digest hmac)))