comp.lang.ada
 help / color / mirror / Atom feed
From: adacrypt <austin.obyrne@hotmail.com>
Subject: Re: Constrained or Unconstrained Arrays or just my my Ignorance.
Date: Mon, 27 Feb 2012 17:16:11 -0800 (PST)
Date: 2012-02-27T17:16:11-08:00	[thread overview]
Message-ID: <12d7e1fb-8a2e-4648-8a93-a3272e957e71@w4g2000vbc.googlegroups.com> (raw)
In-Reply-To: 73ed7d3b-3afe-4f9c-bf31-e18fe4578183@y17g2000yqg.googlegroups.com

On Feb 27, 11:46 pm, Adam Beneschan <a...@irvine.com> wrote:
> On Feb 27, 2:20 pm, adacrypt <austin.oby...@hotmail.com> wrote:
>
>
>
>
>
> > In my Ada-95 driven crypto program I want to capture the frequency
> > spread of the ciphertext.
>
> > I am not sure if I am right or not in what I am doing – a ‘ploy’ I
> > use  works under certain conditions and then not at all at other times
> > in a different application.
>
> > This is my method and the source code of my method.
>
> > CipherText item := 4675432 (say)
>
> > Q := CipherText;
> > I_Num(Q) := I_Num(Q)+1;
>
> > SUBTYPE Index_32 IS Integer RANGE MinValue  .. MaxValue;
> > TYPE I_CoefficientsNumArray IS ARRAY(Index_32) OF Integer;
> >  I_Num : I_CoefficientsNumArray;
> > -- counts the coefficients of the ciphertext.
> > -- Max Value and MinValue are the expected values of any ciphertext as
> > positive integers
>
> > *I use the value of the current ciphertext element to index the
> > (subscript) corresponding numerically to the array  element where it
> > will be stored and I later print out the contents of all the array
> > elements to get the frequency spread of an entire encryption session..
>
> > 1) Is this action legit in terms of Ada-95 Reference Manual?  I am not
> > experienced enough to know myself.
>
> > I suspect it might not be quite proper but it works fine!  I fear it
> > might just be bug that is working more by good luck than good design
> > by me - I hope this is kosher because I want to go on using it in the
> > future.  It works as a procedure in a much larger program ok but does
> > not work at all in a second case 2) below..
>
> > 2) When I try using this in a standalone program i.e. as the sole
> > purpose of a dedicated program that is meant to find the frequency
> > spread of any file that is read in experimentally, it definitely does
> > not work.
>
> > Your advice would be greatly appreciated.
>
> Did you initialize I_Num?  The way you declared it, the initial values
> of the elements of I_Num could be anything.
>
> I'm just guessing at what the problem might be.  The code looks fine
> (I don't know what MinValue and MaxValue are, so if the difference
> between them is very large, you could be creating a very large array.
> If that's what you want, fine).  You don't give us any details about
> what's going wrong except for "it definitely does not work".  So I'm
> stabbing blindly here.
>
> If the problem is that the I_Num values don't get initialized, change
> your declaration to something like
>
>   I_Num : I_CoefficientsNumArray := (others => 0);
>
> which gives the array an initial value.
>
>                      -- Adam- Hide quoted text -
>
> - Show quoted text -

Okay -  got it now - I have found it in a text book and will try that
soon - many thanks for your great help. - adacrypt



  parent reply	other threads:[~2012-02-28  1:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 22:20 Constrained or Unconstrained Arrays or just my my Ignorance adacrypt
2012-02-27 23:46 ` Adam Beneschan
2012-02-28  0:52   ` adacrypt
2012-02-28  1:16   ` adacrypt [this message]
2012-02-27 23:46 ` Adam Beneschan
2012-02-28  1:36   ` adacrypt
replies disabled

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