comp.lang.ada
 help / color / mirror / Atom feed
* Question: Ordered Loading of an Array.
@ 2017-02-04  9:55 Austin Obyrne
  2017-02-04 12:41 ` AdaMagica
  0 siblings, 1 reply; 4+ messages in thread
From: Austin Obyrne @ 2017-02-04  9:55 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question: Ordered Loading of an Array.
  2017-02-04  9:55 Question: Ordered Loading of an Array Austin Obyrne
@ 2017-02-04 12:41 ` AdaMagica
  2017-02-04 15:34   ` Austin Obyrne
  2017-02-04 16:22   ` Rich
  0 siblings, 2 replies; 4+ messages in thread
From: AdaMagica @ 2017-02-04 12:41 UTC (permalink / raw)


Am Samstag, 4. Februar 2017 10:55:29 UTC+1 schrieb Austin Obyrne:

Not mentioning typos.

> This_Num : Integer;  -- Why isn't this of subtype Index_1?

> 
> 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");
No range check here! Why?

> Ada.Integer_Text_IO.Get (Item => This_Num);
> Cell_Num := This_Num;  -- What's this line?

> Cell_Num(This_Num) := Cell_Num(This_Num) +1;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question: Ordered Loading of an Array.
  2017-02-04 12:41 ` AdaMagica
@ 2017-02-04 15:34   ` Austin Obyrne
  2017-02-04 16:22   ` Rich
  1 sibling, 0 replies; 4+ messages in thread
From: Austin Obyrne @ 2017-02-04 15:34 UTC (permalink / raw)


On Saturday, February 4, 2017 at 12:41:05 PM UTC, AdaMagica wrote:
> Am Samstag, 4. Februar 2017 10:55:29 UTC+1 schrieb Austin Obyrne:
> 
> Not mentioning typos.
> 
> > This_Num : Integer;  -- Why isn't this of subtype Index_1?
> 
> > 
> > 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");
> No range check here! Why?
> 
> > Ada.Integer_Text_IO.Get (Item => This_Num);
> > Cell_Num := This_Num;  -- What's this line?
> 
> > Cell_Num(This_Num) := Cell_Num(This_Num) +1;
Hi,

<This_Num : Integer;  -- Why isn't this of subtype Index_1? 

This is extraneous - careless of me

As It happens I think I have resolved my problem at home - many thanks - Austin.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question: Ordered Loading of an Array.
  2017-02-04 12:41 ` AdaMagica
  2017-02-04 15:34   ` Austin Obyrne
@ 2017-02-04 16:22   ` Rich
  1 sibling, 0 replies; 4+ messages in thread
From: Rich @ 2017-02-04 16:22 UTC (permalink / raw)


AdaMagica <christ-usch.grein@t-online.de> wrote:
> Am Samstag, 4. Februar 2017 10:55:29 UTC+1 schrieb Austin Obyrne:
> 
> Not mentioning typos.
> [snip]

The OP is a regular crank [1] poster to sci.crypt.  The crank knows
neither how to properly program in Ada [2] nor anything of value in
regards to cryptology.

Attempting to engage the crank will result in either ignoring the
questions posed (as you got here) or incomprehensible gibberish in
return attempting to argue that the crank is always right and no one
should ever question the crank.

It is best to add the crank's email address to your killfile because
thankfully the crank also has no understanding of how to nymshift, so a
one time add will mean you never need be bothered with his crap again.



[1] https://en.wikipedia.org/wiki/Crank_(person)

[2] For examples of how badly the crank fails to understand how to
program, see some of the Ada source the crank posts on his website
here: http://www.adacrypt.co.uk/.  You'll be agast at the awfulness of
the code.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-04 16:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-04  9:55 Question: Ordered Loading of an Array Austin Obyrne
2017-02-04 12:41 ` AdaMagica
2017-02-04 15:34   ` Austin Obyrne
2017-02-04 16:22   ` Rich

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