Skip to content

Commit

Permalink
Fix for older Erlangs.
Browse files Browse the repository at this point in the history
  • Loading branch information
oubiwann committed Aug 11, 2021
1 parent d6e348b commit ea09698
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lutil-uuid.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
(export all))

(defun v4 ()
(v4 (rand:bytes 16)))
;; XXX rand:bytes is Erlang 24+ only; when that's the oldest version we
;; support, we can turn this back on
;;(v4 (rand:bytes 16)))
(v4 (crypto:strong_rand_bytes 16)))

(defun v4
((type) (when (== type 'strong))
(v4 (crypto:strong_rand_bytes 16)))
((type) (when (is_atom type))
(v4 (rand:bytes 16)))
;; XXX rand:bytes is Erlang 24+ only; when that's the oldest version we
;; support, we can turn this back on
;;(v4 (rand:bytes 16)))
(v4 (crypto:strong_rand_bytes 16)))
((in-bytes)
(let (((binary (r1 (size 48))
(_ (size 4))
Expand Down

0 comments on commit ea09698

Please sign in to comment.