[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Let us see how to encrypt with Emacs?
From: |
Jean Louis |
Subject: |
Re: Let us see how to encrypt with Emacs? |
Date: |
Fri, 9 Jul 2021 15:35:21 +0300 |
User-agent: |
Mutt/2.0.7+183 (3d24855) (2021-05-28) |
* tomas@tuxteam.de <tomas@tuxteam.de> [2021-07-09 14:53]:
> On Fri, Jul 09, 2021 at 02:32:10PM +0300, Jean Louis wrote:
> > * Eli Zaretskii <eliz@gnu.org> [2021-07-09 13:40]:
>
> [...]
>
> > > No, you don't need to chunk, you just need to pad to a multiple of 64
> > > bytes.
> >
> > I guess something like this unless I am making an error:
> >
> > (defun pad-to-multiple-bytes (string max)
> > "Return string padded to multiple of MAX bytes."
> > (let* ((bytes (string-bytes string))
> > (multiple (truncate (/ bytes max)))
> > (multiple (if (zerop multiple) max (* (1+ multiple) max))))
> > (string-pad string multiple)))
>
> small critiques
>
> - see the `ceiling' function: it does what you want (perhaps
> except at zero.
Thanks, now I know for that:
(defun pad-to-multiple-bytes (string length)
"Return string padded to multiple of MAX bytes."
(let* ((bytes (string-bytes string))
(multiple (* (ceiling bytes length) length)))
(string-pad string multiple)))
> I'm not sure you want to encrypt a zero bytes string at all, but
> this might get philosophical)
There may be problems which I will never encounter practically. I know.
> MAX is an unfortunate variable name for that.
Now is length.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
Re: Let us see how to encrypt with Emacs?, Jean Louis, 2021/07/09