Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.programming Subject: Re: string encryption Date: Thu, 29 Apr 2021 22:33:48 +0100 Organization: A noiseless patient Spider Lines: 41 Message-ID: <87sg38ixmr.fsf@bsb.me.uk> References: <1ba37dc7-803d-40ba-9e83-c4bd0b5f1394n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="07d3fdbd2cbb43ab082db46a70b6f71a"; logging-data="6063"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GB8P+Uj4n4pEgwBN1r6T8r5kr6/3rY3o=" Cancel-Lock: sha1:bFIcq3us+01LzEHb92HrCqlgiZY= sha1:/1fD3cIc2yMsMnYUy+JsPnxQ94M= X-BSB-Auth: 1.40f3f1db5ae46cf0cf30.20210429223348BST.87sg38ixmr.fsf@bsb.me.uk Xref: csiph.com comp.programming:12529 David Brown writes: > On 29/04/2021 08:06, Dmitry A. Kazakov wrote: >> On 2021-04-28 23:33, Malcolm McLean wrote: >>> On Wednesday, 28 April 2021 at 20:55:38 UTC+1, Dmitry A. Kazakov wrote: >>>> On 2021-04-28 16:27, Malcolm McLean wrote: >>>>> What's the best method for cheap and cheerful string encryption, >>>>> which takes a plaintext string and a short string as a key, and >>>>> returns a crypted string? The encrypted text must be a string, so >>>>> the encryption must never create a nul character. It might also be >>>>> best not to create ascii control characters, or non-ascii characters. >>>> Looks like a symmetric encryption to me. Any method would do. E.g. >>>> ChaCha20 cipher. Hash the key to initialize. There are plenty >>>> implementations of. It is cryptographically strong, computationally >>>> fast, needs no padding. >>>> >>> CHaCha20. Hadn't heard of that. That's the sort of idea I'm looking for. >> >> https://www.cryptopp.com/wiki/ChaCha20 >> >>> I can't change our entire development language just to support a >>> little encryption >>> routine. It will be a problem to me if the encrypted data is not >>> representable as >>> a C string. >> >> Well, even in C you can pass the length along instead of using NUL as a >> terminator. >> >> It is amazing how things like Base64 and uuencoding are still alive when >> teletypes and modems for which they made sense are long dead. > > We still have email attachments, which is the prime use of these > encodings. (I don't remember using them with modems, but maybe others did.) Yes. The "uu" in uuencode and uudecode comes from "Unix to Unix copy" that was used to distribute email and netnews in the old days. uucp was used over modems, some of which needed 7-bit transfers. -- Ben.