From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Noob dumb question (extending emacs) Date: Sun, 24 Oct 2021 21:03:33 +0300 Message-ID: References: <87o87hnrpt.fsf@zoho.eu> <87y26kkuag.fsf@web.de> <87cznusu79.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23047"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0.7+183 (3d24855) (2021-05-28) Cc: help-gnu-emacs@gnu.org To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 24 20:06:51 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mehtT-0005lg-4D for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 20:06:51 +0200 Original-Received: from localhost ([::1]:51226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mehtR-0002K2-GC for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 14:06:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mehsW-0002FD-Ix for help-gnu-emacs@gnu.org; Sun, 24 Oct 2021 14:05:52 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:39925) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mehsU-0005Mu-MX for help-gnu-emacs@gnu.org; Sun, 24 Oct 2021 14:05:52 -0400 Original-Received: from localhost ([::ffff:41.75.191.219]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 0000000000027EFC.000000006175A07B.000043A0; Sun, 24 Oct 2021 11:05:46 -0700 Mail-Followup-To: Michael Heerdegen , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <87cznusu79.fsf@web.de> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:134120 Archived-At: * Michael Heerdegen [2021-10-24 11:29]: > Jean Louis 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/