comp.lang.ada
 help / color / mirror / Atom feed
* Constrained or Unconstrained Arrays or just my my Ignorance.
@ 2012-02-27 22:20 adacrypt
  2012-02-27 23:46 ` Adam Beneschan
  2012-02-27 23:46 ` Adam Beneschan
  0 siblings, 2 replies; 6+ messages in thread
From: adacrypt @ 2012-02-27 22:20 UTC (permalink / raw)


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.

I do a lot of crypto work in Ada-95.

I use  agnat 311.p compiler in Windows XP.

- adacrypt



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

* Re: Constrained or Unconstrained Arrays or just my my Ignorance.
  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
  2012-02-27 23:46 ` Adam Beneschan
  1 sibling, 2 replies; 6+ messages in thread
From: Adam Beneschan @ 2012-02-27 23:46 UTC (permalink / raw)


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



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

* Re: Constrained or Unconstrained Arrays or just my my Ignorance.
  2012-02-27 22:20 Constrained or Unconstrained Arrays or just my my Ignorance adacrypt
  2012-02-27 23:46 ` Adam Beneschan
@ 2012-02-27 23:46 ` Adam Beneschan
  2012-02-28  1:36   ` adacrypt
  1 sibling, 1 reply; 6+ messages in thread
From: Adam Beneschan @ 2012-02-27 23:46 UTC (permalink / raw)


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



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

* Re: Constrained or Unconstrained Arrays or just my my Ignorance.
  2012-02-27 23:46 ` Adam Beneschan
@ 2012-02-28  0:52   ` adacrypt
  2012-02-28  1:16   ` adacrypt
  1 sibling, 0 replies; 6+ messages in thread
From: adacrypt @ 2012-02-28  0:52 UTC (permalink / raw)


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 -

<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.


I have addressed the very large array issue and worked around that.

When I say "it definitely does not work" I mean the program just gives
wild spurious out puts and folloows with an error message "Constrained
Error".

I am quite happy if this is not merely some friendly bug that works
now but shouldn't really and is not quite right and dependable for
future.

You say it appears ok to you so that's helpful.

Once I am not doing anything that is syntactically wrong then it's ok.

Question: The text books dont initialise the array as you suggest ?
any comment on this please? I intend doing it as you suggest of course
to see if it work.

Many thanks for your help - adacrypt



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

* Re: Constrained or Unconstrained Arrays or just my my Ignorance.
  2012-02-27 23:46 ` Adam Beneschan
  2012-02-28  0:52   ` adacrypt
@ 2012-02-28  1:16   ` adacrypt
  1 sibling, 0 replies; 6+ messages in thread
From: adacrypt @ 2012-02-28  1:16 UTC (permalink / raw)


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



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

* Re: Constrained or Unconstrained Arrays or just my my Ignorance.
  2012-02-27 23:46 ` Adam Beneschan
@ 2012-02-28  1:36   ` adacrypt
  0 siblings, 0 replies; 6+ messages in thread
From: adacrypt @ 2012-02-28  1:36 UTC (permalink / raw)


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 -

Have done that now - works like a charm - many, many thanks - each bit
of new Ada is a cultural bonanza when you really need it - I am very
pleased.and grateful. - Austin O' Byrne



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

end of thread, other threads:[~2012-02-28  1:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2012-02-27 23:46 ` Adam Beneschan
2012-02-28  1:36   ` adacrypt

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