Generate random session tokens

This commit is contained in:
Jaidyn Ann 2023-08-08 18:42:52 -05:00
parent 7840e72e41
commit 0d2d99ed1d

View File

@ -19,6 +19,11 @@
(in-package #:kaptchapelo) (in-package #:kaptchapelo)
(defun random-string ()
"Create a random string consisting of at least 19 characters: Random numbers."
(apply #'str:concat
(mapcar (lambda (a) (format nil "~A" a))
(loop for i from 0 upto 19 collect (random 16)))))
(defun byte-array-to-hex-string (simple-array) (defun byte-array-to-hex-string (simple-array)
"Given an array of bytes (integers), return an equivalent string in hex." "Given an array of bytes (integers), return an equivalent string in hex."
@ -45,7 +50,7 @@
(list "md5" (byte-array-to-hex-string captcha-text-file) (list "md5" (byte-array-to-hex-string captcha-text-file)
"url" captcha-image-uri "url" captcha-image-uri
;; I dont know what Kocaptchas token does! :P ;; I dont know what Kocaptchas token does! :P
"token" "This_isnt_actually_used_lol")))) "token" (random-string)))))
(defun new-captcha-response (captcha-dir) (defun new-captcha-response (captcha-dir)