help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Noob dumb question (extending emacs)


From: Jean Louis
Subject: Re: Noob dumb question (extending emacs)
Date: Sun, 24 Oct 2021 21:03:33 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* Michael Heerdegen <michael_heerdegen@web.de> [2021-10-24 11:29]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > How I see it, it is very easy to set random seed by providing some
> > automatically generated, random string to `random', such as those from
> > the system's /proc directory.
> 
> Then you just consult a second source of entropy.  Which is more or less
> the conclusion: don't rely on the entropy of Emacs' `random' function.
> 
> If that other source is a reliable source of more entropy, you don't
> need Emacs' `random' at all.  If it is not, you have gained nothing.
> 
> And there is another problem which would make things much worse: when
> Emacs `random' number generator operates with 48 bit numbers (which
> seems to be the case, but I didn't check the sources), each algorithm
> calling `random' can only generate passwords with an entropy of
> maximally 48 bit, no matter what the entropy of the seed is.

This is my basic function, practical, useful, used almost daily in
other functions to generate passwords. It replaces my needs for
`pwgen' and it was made not to be dependent on some outside system
software. 

(defvar rcd-password-alpha "ABCDEFGHIJKLMNOPQRSTUVWHYZ")
(defvar rcd-password-special-characters "!@#$%^&*()-=+_[]{}|")

(defun rcd-password-generate-1 (string)
  "Return capitalized or downcased single symbol from a string"
  (random (format "%s" (random)))
  (let* ((max (length string))
         (rnd (random max))
         (single (substring string rnd (+ rnd 1))))
    single))

(rcd-password-generate-1 rcd-password-alpha) ⇒ "M"

Unless you or Yuri can predict the outcome of this function, any
hypothesis is pretty much useless.

And the function remain useful.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]