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

* Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> [2021-10-25 22:48]:
> Jean Louis wrote:
> 
> > (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"))
> 
> So you had one as well ...
> 
> Check how head does it then ... that's how to get aHEAD in
> software piracy ...
> 
> (defun urandom (bits)
>   (interactive "nbits: ")
>   (let*((bytes     (/ bits 8))
>         (bytes-opt (format "--bytes=%s" bytes)) )
>     (with-temp-buffer
>       (set-buffer-multibyte nil)
>       (call-process "head" "/dev/urandom" t nil bytes-opt)
>       (string-to-list
>        (buffer-substring-no-properties (point-min) (point-max)) ))))
> ;; (urandom 100)

Really great, though complicated.

I expect in future to run only GNU Emacs on computer, so external
commands I wish to eradicate.

I think that description of nano, micro and milliseconds from
`format-time-string' plus Emcas uptime, create enough randomity for my
needs.

%N is the nanosecond, %6N the microsecond, %3N the millisecond, etc.

(md5 (concat (emacs-uptime) (format-time-string "%N %6N %3N"))) ⇒ 
"ed542b20ba78029ceda9a3a3824e7154"

With or without md5 is enough random.

Can anybody predict my Emacs uptime concatenated with the current
nanoseconds, microseconds and milliseconds?

--  
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]