[Top][All Lists]

[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: Mon, 25 Oct 2021 22:22:21 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

Yuri and Michael H., you are very right, too simple password
generation without enough entropy produces duplicate passwords.

The way to go is to create some entropy. Reading /dev/urandom is not a
portable solution. At this moment I would not know if it works on
DragonflyBSD which I use on some computers, I will check later.

But that does not mean that anybody may guess the password produced on
this computer.

If somebody knows how to read slice of a file like /dev/urandom, let
me know, otherwise I have to use external command.

(defun rcd-read-urandom (&optional length)
  "I am also free to modify the Emacs Lisp unlimited times."
  (shell-command-to-string "head -n 1 /dev/urandom"))

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

(rcd-password) ⇒ "5l}tAl9hvk^ofQkqbSWh" --- I am now more random...


Take action in Free Software Foundation campaigns:

In support of Richard M. Stallman

reply via email to

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