[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should Emacs provide a uuid function?
From: |
Chong Yidong |
Subject: |
Re: Should Emacs provide a uuid function? |
Date: |
Mon, 09 May 2011 11:09:24 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>>> (defun secure-random-bytes (n)
>>> (let ((file (cond
>>> ((file-exists-p "/dev/random") "/dev/random")
>>> ((file-exists-p "/dev/urandom") "/dev/urandom")
>>> (t (error "Secure random device not available")))))
>
>> Feh. Using platform-dependent interfaces in Lisp is not the Emacs
>> way, in my book. How about a primitive which would read from
>> /dev/random or /dev/urandom if they are available, or use other
>> methods if they are not?
>
> FWIW, I don't think there's anything wrong with writing the
> platform-dependent code in Elisp rather than in C. I generally prefer
> code to be written in Elisp when possible and when it's not introducing
> a performance problem.
I'm not sure we should introduce a separate function, though. It makes
more sense to improve the existing `random' primitive, making it return
a random number (via /dev/random or /dev/urandom or GnuTLS) rather than
a pseudo-random number when possible.
We could add an optional arg to `random' that says that if no secure
random source is available, signal an error instead of falling back on
the old method.
- Re: Should Emacs provide a uuid function?, (continued)
- Re: Should Emacs provide a uuid function?, Eli Zaretskii, 2011/05/09
- Re: Should Emacs provide a uuid function?, Stefan Monnier, 2011/05/09
- Re: Should Emacs provide a uuid function?, Eli Zaretskii, 2011/05/09
- Re: Should Emacs provide a uuid function?, Stefan Monnier, 2011/05/09
- Re: Should Emacs provide a uuid function?, Eli Zaretskii, 2011/05/09
- Re: Should Emacs provide a uuid function?, Stefan Monnier, 2011/05/09
- Re: Should Emacs provide a uuid function?, Eli Zaretskii, 2011/05/09
- Re: Should Emacs provide a uuid function?,
Chong Yidong <=
- Re: Should Emacs provide a uuid function?, Eli Zaretskii, 2011/05/09
- Re: Should Emacs provide a uuid function?, Ted Zlatanov, 2011/05/09
- Re: Should Emacs provide a uuid function?, Eli Zaretskii, 2011/05/09
- Re: Should Emacs provide a uuid function?, Ted Zlatanov, 2011/05/09
- Re: Should Emacs provide a uuid function?, Lars Magne Ingebrigtsen, 2011/05/09
- Re: Should Emacs provide a uuid function?, Stefan Monnier, 2011/05/09
- Re: Should Emacs provide a uuid function?, Lars Magne Ingebrigtsen, 2011/05/09
- Re: Should Emacs provide a uuid function?, Stefan Monnier, 2011/05/09
- Re: Should Emacs provide a uuid function?, joakim, 2011/05/09
- Re: Should Emacs provide a uuid function?, Lars Magne Ingebrigtsen, 2011/05/09