comp.lang.ada
 help / color / mirror / Atom feed
From: Austin Obyrne <austin.obyrne@hotmail.com>
Subject: Question: Ordered Loading of an Array.
Date: Sat, 4 Feb 2017 01:55:27 -0800 (PST)
Date: 2017-02-04T01:55:27-08:00	[thread overview]
Message-ID: <0fa9d98c-891f-4d18-b1ac-e6274d97dcfa@googlegroups.com> (raw)

My interest is in cryptography programming and I have a particular one-off problem that readers may be able to shed some light on.  I have invented a solution that works very well but it needs to be ratified by more knowledgeable people before I would go public in a cipher program with it.

Basically it involves loading on-going fallout elements as they occur in a running program procedure (say) at run time into specifically selected cells of an array in a pre-ordained order, this could be the natural order of each named elemnet or anything other order that is required.

This discussion model here is meant to be simplistic in the extreme and it simulates loading casually inputted code-points of ASCII(say)into a program array in a stipulated correct order and read back later - this is just a short demo being used as a discussion model.

What I am doing is not normal because data is most often assigned to an array just as it occurs in consecutive order.

Please take this simple model with a pinch of salt.

Declarations:

This_Num : Integer;

SUBTYPE Index_1 IS Integer RANGE 32 .. 126;
TYPE This_NumArray IS ARRAY(Index)_1 OF Integer;
Cell_Num : This_NumArray:= (others =>0);

Input Program:

For I in  1 .. 95 Loop ;
Ada.Text_IO. Put(Item => "Please enter any integer in the range 32 to 126");
Ada.Integer_Text_IO.Get (Item => This_Num);
Cell_Num := This_Num;
Cell_Num(This_Num) := Cell_Num(This_Num) +1;

This short loop puts each integer(This_Num) into its specifically correct cell and not just the next consecutive empty cell i.e. it places each integer into its named cell in strict order and not just any order.  It will increment a cell with an extra (error) element in the case of a repeat.  The errant cell can then be trimmed correctly against the empty cell it must inevitably leave.

This is a personally devised ploy that I would like to use with impunity in the future but I hesitate to do so because I cannot find anything in the language RM that supports it.  It is a very useful tool in cryptography but I am not prepared to use without some proof that it is reliable.  I have other options that I will use instead if needs be but it would be very convenient as a general tool if I could use this one.

My gut feeling is NO.

Although this ploy has never let me down I fear that it could and since I am not a language expert I will wait for some advice from language orientated people who know more about it before I use it indiscriminately.

I would be very grateful to anybody who can say with conviction that it is safe to use or not.

It strikes me that the custodians of the Ada language (back at the ranch) might consider adding an array loading package along such lines if it does not already exist.

Scríofa ag adacrypt


             reply	other threads:[~2017-02-04  9:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-04  9:55 Austin Obyrne [this message]
2017-02-04 12:41 ` Question: Ordered Loading of an Array AdaMagica
2017-02-04 15:34   ` Austin Obyrne
2017-02-04 16:22   ` Rich
replies disabled

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