comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Tasking and Concurrent Programming Using Multiple Ada Programs.
Date: Sat, 29 Apr 2017 14:56:35 +0100
Date: 2017-04-29T14:56:35+01:00	[thread overview]
Message-ID: <lyy3ujjp0s.fsf@pushface.org> (raw)
In-Reply-To: 7edc0e62-80fe-4a91-9015-69c781207fc8@googlegroups.com

Austin Obyrne <austin.obyrne@hotmail.com> writes:

> I have come over from sci crypt group to ask your advice on an
> encryption concept.  The concept is a design plan to use a possible 36
> ciphers (variants of the same basic cipoher and compatible to each
> other)in an Ada tasking program.
>
> The hoped for plan is to write a program that will cater for 36 (or
> less if needs be ) ciphers all reading in and immediately encrypting,
> in rotation from the same file of plaintext and writing out the
> resulting ciphertext to the same ciphertext file (the encrypted
> plaintext file).  They would of course be written in Ada.

I dont know why you want to do this, but - if you want to get a speed-up
- you won't. The problem isn't so much the reading of each successive
plaintext character and sending it to the encrypting task; the problem
is that the part of the program that writes the output must successively
wait for each of the encrypting tasks to provide its latest output
before writing it to the output medium. So the whole process is bounded
by the output.

On the other hand, the effect of using tasks would be that each task
would see only every Nth character, so perhaps this is actually your
intent. If I was doing this I would look into using an abstract data
type (say, Encryption_State) to encapsulate the state needed to encrypt
the next character; arrange a procedure

   procedure Encrypt (State : in out Encryption_State;
                      Plain : Plain_Text_Character;
                      Result : out Encrypted_Text_Character);


and then arrange

   type State_Index is mod 36;
   States : array (State_Index) of Encryption_State;

so that as you pick the next input character you cycle round States to
pick the state to encrypt it with.

  parent reply	other threads:[~2017-04-29 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-29  8:13 Tasking and Concurrent Programming Using Multiple Ada Programs Austin Obyrne
2017-04-29 13:55 ` Dennis Lee Bieber
2017-04-29 14:08   ` Dennis Lee Bieber
2017-04-29 13:56 ` Simon Wright [this message]
2017-04-29 16:08   ` Austin Obyrne
2017-05-07 19:32     ` Robert Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox