[Top][All Lists]

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

Re: Noob dumb question (extending emacs)

From: Emanuel Berg
Subject: Re: Noob dumb question (extending emacs)
Date: Fri, 05 Nov 2021 22:50:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Jean Louis wrote:

>> (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)
> I think the above is not portable.

It uses Emacs, head(1) and the, as we have seen, non-regular
/dev/urandom file ...

> And finally, if you use external program, then you could
> call `pwgen' directly.

Well, that code is focused on extracting data from
/dev/urandom ...

But yes, if you want to use pwgen(1), you are encouraged to do
just that - and if you choose not to do that, beware that any
inferior solution - portable or not portable (whatever that
means BTW) external program or not - regardless of whatever,
that doesn't matter, because if pwgen is superior for its
particular purpose then pwgen will still be superior.

And I think that's where it stands now.

But cheer up Jean, a silver medal at the Olympics isn't that

underground experts united

reply via email to

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