Mercurial > core / lisp/lib/cry/totp.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
2596311106ae
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 ;;; crypto/totp.lisp --- Time-Based One-Time Passwords 3 ;; see https://github.com/bhyde/cl-one-time-passwords/totp.lisp 10 (defconstant .unix-epoch-zero. 2208988800) 11 ;; 00:00:00 UTC on 1 January 1970 12 ;; (encode-universal-time 0 0 0 1 1 1970 0) 15 (defvar *time-zero* 0) ; aka the unix epoch zero 16 (defvar *time-step-in-seconds* 30) 18 (defmacro time-step (unix-time) 19 `(floor (- ,unix-time *time-zero*) *time-step-in-seconds*)) 21 (defun totp (key-hexstring &optional (offset 0) (time (- (get-universal-time) .unix-epoch-zero. offset))) 22 (hotp key-hexstring (time-step time)))