From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Tasking and Concurrent Programming Using Multiple Ada Programs. Date: Sat, 29 Apr 2017 14:56:35 +0100 Organization: A noiseless patient Spider Message-ID: References: <7edc0e62-80fe-4a91-9015-69c781207fc8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="03ed067c7aec6ac0ed172109ce567f5f"; logging-data="28143"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193ZMr8KeZ4JOsbjN8+4Ckp+KAPVUwrgyU=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Cancel-Lock: sha1:E4rr2KF7eLlkGAP6OpljsSaYLTw= sha1:uA+zxWRRxkeUWzMOLF4DjI1QjJg= Xref: news.eternal-september.org comp.lang.ada:46644 Date: 2017-04-29T14:56:35+01:00 List-Id: Austin Obyrne 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.