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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fa32bfdf0265cf3e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,CP1252 Received: by 10.68.224.230 with SMTP id rf6mr1506157pbc.4.1330386469325; Mon, 27 Feb 2012 15:47:49 -0800 (PST) Path: h9ni16908pbe.0!nntp.google.com!news2.google.com!postnews.google.com!y17g2000yqg.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Constrained or Unconstrained Arrays or just my my Ignorance. Date: Mon, 27 Feb 2012 15:46:03 -0800 (PST) Organization: http://groups.google.com Message-ID: <73ed7d3b-3afe-4f9c-bf31-e18fe4578183@y17g2000yqg.googlegroups.com> References: <45dc4817-e418-4f2d-96cf-02eaa630064c@s7g2000vby.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1330386469 11026 127.0.0.1 (27 Feb 2012 23:47:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 27 Feb 2012 23:47:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y17g2000yqg.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Date: 2012-02-27T15:46:03-08:00 List-Id: On Feb 27, 2:20=A0pm, adacrypt 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 =96 a =91ploy=92 I > use =A0works 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 :=3D 4675432 (say) > > Q :=3D CipherText; > I_Num(Q) :=3D I_Num(Q)+1; > > SUBTYPE Index_32 IS Integer RANGE MinValue =A0.. MaxValue; > TYPE I_CoefficientsNumArray IS ARRAY(Index_32) OF Integer; > =A0I_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 =A0element 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? =A0I am not > experienced enough to know myself. > > I suspect it might not be quite proper but it works fine! =A0I 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. =A0It 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 :=3D (others =3D> 0); which gives the array an initial value. -- Adam