Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #12512

Re: string encryption

From "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Newsgroups comp.programming
Subject Re: string encryption
Date 2021-04-28 21:55 +0200
Organization Aioe.org NNTP Server
Message-ID <s6cejg$p5h$1@gioia.aioe.org> (permalink)
References <1ba37dc7-803d-40ba-9e83-c4bd0b5f1394n@googlegroups.com>

Show all headers | View raw


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.

If you do not care much about strength, simply use a random generator. 
Hash the key, use it as the seed. xor generated octets to the 
characters. Done.

To make it a C string [why do not you use a language where strings can 
contain anything?] use some re-coding procedure to printable characters, 
e.g. Base64.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

string encryption Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-04-28 07:27 -0700
  Re: string encryption Kristjan Robam <he12457@hotmail.com> - 2021-04-28 08:39 -0700
  Re: string encryption David Brown <david.brown@hesbynett.no> - 2021-04-28 19:58 +0200
    Re: string encryption David Spencer <spencer@panix.com> - 2021-04-28 18:00 +0000
      Re: string encryption David Brown <david.brown@hesbynett.no> - 2021-04-28 20:47 +0200
      Re: string encryption Kristjan Robam <rob999999999@yahoo.com> - 2021-04-29 02:26 -0700
    Re: string encryption Kristjan Robam <ya12983@mail.com> - 2021-04-28 12:14 -0700
    Re: string encryption Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-04-28 14:33 -0700
    Re: string encryption Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-04-28 14:39 -0700
  Re: string encryption "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2021-04-28 21:55 +0200
    Re: string encryption Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-04-28 14:33 -0700
      Re: string encryption "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2021-04-29 08:06 +0200
        Re: string encryption David Brown <david.brown@hesbynett.no> - 2021-04-29 09:38 +0200
          Re: string encryption "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2021-04-29 10:00 +0200
          Re: string encryption Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-29 22:33 +0100
      Re: string encryption David Brown <david.brown@hesbynett.no> - 2021-04-29 09:37 +0200
        Re: string encryption Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-04-29 06:40 -0700
          Re: string encryption David Brown <david.brown@hesbynett.no> - 2021-04-29 17:01 +0200

csiph-web