comp.lang.ada
 help / color / mirror / Atom feed
* Integer Overflow Question.
@ 2014-08-25 11:21 austin.obyrne769
  2014-08-25 11:46 ` G.B.
  2014-08-25 12:20 ` gautier_niouzes
  0 siblings, 2 replies; 16+ messages in thread
From: austin.obyrne769 @ 2014-08-25 11:21 UTC (permalink / raw)


I have written two Ada driven ciphers that are complete and have been tweaked for the last time.

I have used an early Ada compiler - a Gnat311.p - of about 1995 vintage  <= Ada-95.

In order that the ciphers can run in 32-bit computers which are still going to be around for some time despite the availability of the 64-bit operating system in Windows 8.1 which I also use, I have had to put a bound on the maximum integer size output of computations at 2^31 which of course is the maximum positive integer that 32-bit computers can handle.

Running the same software that was written for 32-bit computers in the  64-bit environment of 8.1 and raising the bar on integer size I thought I should be able to do this ok but no - the cipher will still crash if the integer size is greater than 2^31 when I thought I could go up to 2^63.

As it happens this is not a problem crypto wise because the cipher is independent of the integer size but I am intrigued that this overflow should still happen.

I am coming to the conclusion that the max integer size than can be used without integer overflow occurring in any computer is a function of the Ada compiler being used and not the computer operating system???

Could anybody throw some light on this conjecture?

Thanking you in anticipation of your usual help,

adacrypt

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

* Re: Integer Overflow Question.
  2014-08-25 11:21 Integer Overflow Question austin.obyrne769
@ 2014-08-25 11:46 ` G.B.
  2014-08-25 12:58   ` austin.obyrne769
  2014-08-25 12:20 ` gautier_niouzes
  1 sibling, 1 reply; 16+ messages in thread
From: G.B. @ 2014-08-25 11:46 UTC (permalink / raw)


On 25.08.14 13:21, austin.obyrne769@btinternet.com wrote:
> I have had to put a bound on the maximum integer size output of computations at 2^31  which of course is the maximum positive integer that 32-bit computers can handle.

Would this not be 2^31 - 1?

Also, how does your program respond when translated with -gnato?



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

* Re: Integer Overflow Question.
  2014-08-25 11:21 Integer Overflow Question austin.obyrne769
  2014-08-25 11:46 ` G.B.
@ 2014-08-25 12:20 ` gautier_niouzes
  2014-08-25 12:54   ` austin.obyrne769
  1 sibling, 1 reply; 16+ messages in thread
From: gautier_niouzes @ 2014-08-25 12:20 UTC (permalink / raw)


Le lundi 25 août 2014 13:21:33 UTC+2, austin.o...@btinternet.com a écrit :
> I have written two Ada driven ciphers that are complete and have been tweaked for the last time.
> 
> 
> 
> I have used an early Ada compiler - a Gnat311.p - of about 1995 vintage  <= Ada-95.
> 
> 
> 
> In order that the ciphers can run in 32-bit computers which are still going to be around for some time despite the availability of the 64-bit operating system in Windows 8.1 which I also use, I have had to put a bound on the maximum integer size output of computations at 2^31 which of course is the maximum positive integer that 32-bit computers can handle.
> 
> 
> 
> Running the same software that was written for 32-bit computers in the  64-bit environment of 8.1 and raising the bar on integer size I thought I should be able to do this ok but no - the cipher will still crash if the integer size is greater than 2^31 when I thought I could go up to 2^63.
> 
> 
> 
> As it happens this is not a problem crypto wise because the cipher is independent of the integer size but I am intrigued that this overflow should still happen.
> 
> 
> 
> I am coming to the conclusion that the max integer size than can be used without integer overflow occurring in any computer is a function of the Ada compiler being used and not the computer operating system???

This is the case. This is also the case for most software installed (Word, Excel,...) which appear in a "C:\Program Files x86" folder. They all run in a 32-bit subsystem of your 64-bit system.
If you want to know metrics of your Ada numeric types, just display T'Last, T'Size.
Now, even on GNAT 32-bit, there are Integer_64 and Unsigned_64 in the Interfaces package. Use them!
HTH
_________________________ 
Gautier's Ada programming 
http://sf.net/users/gdemont

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

* Re: Integer Overflow Question.
  2014-08-25 12:20 ` gautier_niouzes
@ 2014-08-25 12:54   ` austin.obyrne769
  0 siblings, 0 replies; 16+ messages in thread
From: austin.obyrne769 @ 2014-08-25 12:54 UTC (permalink / raw)


On Monday, August 25, 2014 1:20:02 PM UTC+1, gautier...@hotmail.com wrote:
> Le lundi 25 août 2014 13:21:33 UTC+2, austin.o...@btinternet.com a écrit :
> 
> > I have written two Ada driven ciphers that are complete and have been tweaked for the last time.
> 
> > 
> 
> > 
> 
> > 
> 
> > I have used an early Ada compiler - a Gnat311.p - of about 1995 vintage  <= Ada-95.
> 
> > 
> 
> > 
> 
> > 
> 
> > In order that the ciphers can run in 32-bit computers which are still going to be around for some time despite the availability of the 64-bit operating system in Windows 8.1 which I also use, I have had to put a bound on the maximum integer size output of computations at 2^31 which of course is the maximum positive integer that 32-bit computers can handle.
> 
> > 
> 
> > 
> 
> > 
> 
> > Running the same software that was written for 32-bit computers in the  64-bit environment of 8.1 and raising the bar on integer size I thought I should be able to do this ok but no - the cipher will still crash if the integer size is greater than 2^31 when I thought I could go up to 2^63.
> 
> > 
> 
> > 
> 
> > 
> 
> > As it happens this is not a problem crypto wise because the cipher is independent of the integer size but I am intrigued that this overflow should still happen.
> 
> > 
> 
> > 
> 
> > 
> 
> > I am coming to the conclusion that the max integer size than can be used without integer overflow occurring in any computer is a function of the Ada compiler being used and not the computer operating system???
> 
> 
> 
> This is the case. This is also the case for most software installed (Word, Excel,...) which appear in a "C:\Program Files x86" folder. They all run in a 32-bit subsystem of your 64-bit system.
> 
> If you want to know metrics of your Ada numeric types, just display T'Last, T'Size.
> 
> Now, even on GNAT 32-bit, there are Integer_64 and Unsigned_64 in the Interfaces package. Use them!
> 
> HTH
> 
> _________________________ 
> 
> Gautier's Ada programming 
> 
> http://sf.net/users/gdemont

Many,many thanks.  That is very educational to know.  It suits me fine not to go any further. My crypto doesn't need it.  It is useful to me to know however that I have unwittingly used a standard that I can promote with full confidence to users.

Austin O'Byrne

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

* Re: Integer Overflow Question.
  2014-08-25 11:46 ` G.B.
@ 2014-08-25 12:58   ` austin.obyrne769
  2014-08-25 13:09     ` Simon Clubley
  2014-08-25 13:34     ` Aay Jay Chan
  0 siblings, 2 replies; 16+ messages in thread
From: austin.obyrne769 @ 2014-08-25 12:58 UTC (permalink / raw)


On Monday, August 25, 2014 12:46:01 PM UTC+1, G.B. wrote:
> On 25.08.14 13:21, austin.obyrne769@btinternet.com wrote:
> 
> > I have had to put a bound on the maximum integer size output of computations at 2^31  which of course is the maximum positive integer that 32-bit computers can handle.
> 
> 
> 
> Would this not be 2^31 - 1?
> 
> 
> 
> Also, how does your program respond when translated with -gnato?

>Would this not be 2^31 - 1? - NO

The max, POS integer is 2^(32-1)

I understand the the max NEG integer is -[2^32-1)+1]

Thanks for your help - Austin O Byrne


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

* Re: Integer Overflow Question.
  2014-08-25 12:58   ` austin.obyrne769
@ 2014-08-25 13:09     ` Simon Clubley
  2014-08-25 13:29       ` austin.obyrne769
  2014-08-25 13:34     ` Aay Jay Chan
  1 sibling, 1 reply; 16+ messages in thread
From: Simon Clubley @ 2014-08-25 13:09 UTC (permalink / raw)


On 2014-08-25, austin.obyrne769@btinternet.com <austin.obyrne769@btinternet.com> wrote:
> On Monday, August 25, 2014 12:46:01 PM UTC+1, G.B. wrote:
>> On 25.08.14 13:21, austin.obyrne769@btinternet.com wrote:
>> 
>> > I have had to put a bound on the maximum integer size output of computations at 2^31  which of course is the maximum positive integer that 32-bit computers can handle.
>> 
>> 
>> 
>> Would this not be 2^31 - 1?
>> 
>> 
>> 
>> Also, how does your program respond when translated with -gnato?
>
>>Would this not be 2^31 - 1? - NO
>
> The max, POS integer is 2^(32-1)
>

Signed or unsigned integers ?

> I understand the the max NEG integer is -[2^32-1)+1]
>

I think you understand incorrectly. The sign bit is a part of the
32 bit value so the range you can express is cut approx in half.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


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

* Re: Integer Overflow Question.
  2014-08-25 13:09     ` Simon Clubley
@ 2014-08-25 13:29       ` austin.obyrne769
  2014-08-25 13:44         ` Simon Clubley
  0 siblings, 1 reply; 16+ messages in thread
From: austin.obyrne769 @ 2014-08-25 13:29 UTC (permalink / raw)


On Monday, August 25, 2014 2:09:35 PM UTC+1, Simon Clubley wrote:
> On 2014-08-25, austin.obyrne769@btinternet.com <austin.obyrne769@btinternet.com> wrote:
> 
> > On Monday, August 25, 2014 12:46:01 PM UTC+1, G.B. wrote:
> 
> >> On 25.08.14 13:21, austin.obyrne769@btinternet.com wrote:
> 
> >> 
> 
> >> > I have had to put a bound on the maximum integer size output of computations at 2^31  which of course is the maximum positive integer that 32-bit computers can handle.
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> Would this not be 2^31 - 1?
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> Also, how does your program respond when translated with -gnato?
> 
> >
> 
> >>Would this not be 2^31 - 1? - NO
> 
> >
> 
> > The max, POS integer is 2^(32-1)
> 
> >
> 
> 
> 
> Signed or unsigned integers ?
> 
> 
> 
> > I understand the the max NEG integer is -[2^32-1)+1]
> 
> >
> 
> 
> 
> I think you understand incorrectly. The sign bit is a part of the
> 
> 32 bit value so the range you can express is cut approx in half.
> 
> 
> 
> Simon.
> 
> 
> 
> -- 
> 
> Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
> 
> Microsoft: Bringing you 1980s technology to a 21st century world

Thanks - I usually remember it in denary as,

Max Pos. Int = 2147483647
Max Neg. Int = -2147483648

The important thing to me is in knowing what to put in my exception handler.

Many thanks - Austin

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

* Re: Integer Overflow Question.
  2014-08-25 12:58   ` austin.obyrne769
  2014-08-25 13:09     ` Simon Clubley
@ 2014-08-25 13:34     ` Aay Jay Chan
  2014-08-25 15:09       ` austin.obyrne769
  2014-08-25 17:02       ` austin.obyrne769
  1 sibling, 2 replies; 16+ messages in thread
From: Aay Jay Chan @ 2014-08-25 13:34 UTC (permalink / raw)


From the fact that you don't know how big your types are, it sounds like you are using pre-defined types. In Ada, the prefered way is to define your own types with the range that matches your requirements. That way, you will know, at compile time, whether the compiler can implement those types on the target platform.

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

* Re: Integer Overflow Question.
  2014-08-25 13:29       ` austin.obyrne769
@ 2014-08-25 13:44         ` Simon Clubley
  0 siblings, 0 replies; 16+ messages in thread
From: Simon Clubley @ 2014-08-25 13:44 UTC (permalink / raw)


On 2014-08-25, austin.obyrne769@btinternet.com <austin.obyrne769@btinternet.com> wrote:
> On Monday, August 25, 2014 2:09:35 PM UTC+1, Simon Clubley wrote:
>> On 2014-08-25, austin.obyrne769@btinternet.com <austin.obyrne769@btinternet.com> wrote:
>> 
>> > On Monday, August 25, 2014 12:46:01 PM UTC+1, G.B. wrote:
>> 
>> >> On 25.08.14 13:21, austin.obyrne769@btinternet.com wrote:
>> >> 
>> >> > I have had to put a bound on the maximum integer size output of computations at 2^31  which of course is the maximum positive integer that 32-bit computers can handle.
>> >> 
>> >> Would this not be 2^31 - 1?
>> >> 
>> >> Also, how does your program respond when translated with -gnato?
>> >
>> >>Would this not be 2^31 - 1? - NO
>> >
>> > The max, POS integer is 2^(32-1)
>> >
>> 
>> Signed or unsigned integers ?
>> 
>> > I understand the the max NEG integer is -[2^32-1)+1]
>> >
>> 
>> I think you understand incorrectly. The sign bit is a part of the
>> 32 bit value so the range you can express is cut approx in half.
>
> Thanks - I usually remember it in denary as,
>
> Max Pos. Int = 2147483647

Which is, for a signed 32 bit integer, (2^31) - 1 as G.B. wrote.

> Max Neg. Int = -2147483648
>

Looking at your original posting, it's now not clear to me if you
meant (2^32)-1 or meant 2^(32-1) in your negative example. I took
it to be the former, hence my correction.

And BTW, there's no +1 there either. From bc:

-(2^(32-1))
-2147483648

(The first line is my input to bc; the second line is the answer from bc.)

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


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

* Re: Integer Overflow Question.
  2014-08-25 13:34     ` Aay Jay Chan
@ 2014-08-25 15:09       ` austin.obyrne769
  2014-08-25 17:02       ` austin.obyrne769
  1 sibling, 0 replies; 16+ messages in thread
From: austin.obyrne769 @ 2014-08-25 15:09 UTC (permalink / raw)


On Monday, August 25, 2014 2:34:29 PM UTC+1, Aay Jay Chan wrote:
> From the fact that you don't know how big your types are, it sounds like you are using pre-defined types. In Ada, the prefered way is to define your own types with the range that matches your requirements. That way, you will know, at compile time, whether the compiler can implement those types on the target platform.

That has been done in a Validation program - many thanks

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

* Re: Integer Overflow Question.
  2014-08-25 13:34     ` Aay Jay Chan
  2014-08-25 15:09       ` austin.obyrne769
@ 2014-08-25 17:02       ` austin.obyrne769
  2014-08-25 17:21         ` Simon Wright
  2014-08-25 17:40         ` Simon Clubley
  1 sibling, 2 replies; 16+ messages in thread
From: austin.obyrne769 @ 2014-08-25 17:02 UTC (permalink / raw)


On Monday, August 25, 2014 2:34:29 PM UTC+1, Aay Jay Chan wrote:
> From the fact that you don't know how big your types are, it sounds like you are using pre-defined types. In Ada, the prefered way is to define your own types with the range that matches your requirements. That way, you will know, at compile time, whether the compiler can implement those types on the target platform.

Apologies

I haven't just learned that I can do that.

I have indeed been using pre-defined integers and was quite unaware that I could define my own types with a suitable range - I have only just learned that from another source.  

You see, I am not a well informed programmer and I am also pre-occupied with the maths and the cryptography as well as The Ada side of things.

Please Mr Chan, 

Could you please set out the Ada-95 sourcecode for defining an integer variable called "CipherText" in the range say of 8 decimal digits to 12 decimal digits. I can do the others myself once I know what to do.

This is brilliant - wish I had known earlier.

Austin O'Byrne

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

* Re: Integer Overflow Question.
  2014-08-25 17:02       ` austin.obyrne769
@ 2014-08-25 17:21         ` Simon Wright
  2014-08-25 17:56           ` austin.obyrne769
  2014-08-25 19:38           ` austin.obyrne769
  2014-08-25 17:40         ` Simon Clubley
  1 sibling, 2 replies; 16+ messages in thread
From: Simon Wright @ 2014-08-25 17:21 UTC (permalink / raw)


austin.obyrne769@btinternet.com writes:

> Could you please set out the Ada-95 sourcecode for defining an integer
> variable called "CipherText" in the range say of 8 decimal digits to
> 12 decimal digits. I can do the others myself once I know what to do.

This may help:

with Ada.Text_IO;
procedure Obyrne is
   type Ciphertext_Integer is range -10 ** 12 .. 10 ** 12;
begin
   Ada.Text_IO.Put_Line
     ("first is " & Ciphertext_Integer'Image (Ciphertext_Integer'First)
        & ", last is " & Ciphertext_Integer'Image (Ciphertext_Integer'Last));
end Obyrne;

With up-to-date GNAT, this outputs

first is -1000000000000, last is  1000000000000

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

* Re: Integer Overflow Question.
  2014-08-25 17:02       ` austin.obyrne769
  2014-08-25 17:21         ` Simon Wright
@ 2014-08-25 17:40         ` Simon Clubley
  2014-08-25 18:09           ` austin.obyrne769
  1 sibling, 1 reply; 16+ messages in thread
From: Simon Clubley @ 2014-08-25 17:40 UTC (permalink / raw)


On 2014-08-25, austin.obyrne769@btinternet.com <austin.obyrne769@btinternet.com> wrote:
> On Monday, August 25, 2014 2:34:29 PM UTC+1, Aay Jay Chan wrote:
>> From the fact that you don't know how big your types are, it sounds like you are using pre-defined types. In Ada, the prefered way is to define your own types with the range that matches your requirements. That way, you will know, at compile time, whether the compiler can implement those types on the target platform.
>
> Apologies
>
> I haven't just learned that I can do that.
>
> I have indeed been using pre-defined integers and was quite unaware
> that I could define my own types with a suitable range - I have only
> just learned that from another source.
>

Austin, the following is a polite and well intentioned suggestion.

User defined data types with user defined ranges are a core capability
within Ada's range of features.

Although I am a professional programmer, my interest in Ada is only
personal, and not work related. However, that doesn't change the fact
I found out about this capability within Ada very shortly after
starting to explore Ada years ago.

My suggestion is for you to pick up an Ada book or maybe look at an
online resource and learn about the other things Ada can do.

When I was beginning Ada I found things like Ada Distilled to be of
interest and I see it is still online in various forms. I also have
paper books such as the Barnes "Programming in Ada 95", second edition
and "Ada as a second language" by Cohen in my library.

I would recommend you start with Ada Distilled and see how you get on
with that before buying any books. Also, before buying any books, I
recommend you ask here for advice on what the current recommended books
are.

The Ada reference manual is also available online and for downloading.

> You see, I am not a well informed programmer and I am also pre-occupied with the maths and the cryptography as well as The Ada side of things.
>

If you are creating crypto schemes, you _really_ need to be skilled in
your implementation language of choice.

> Please Mr Chan, 
>
> Could you please set out the Ada-95 sourcecode for defining an integer variable called "CipherText" in the range say of 8 decimal digits to 12 decimal digits. I can do the others myself once I know what to do.
>

If you don't know this about Ada, it's not something which should be
done by rote. However, if you work through an Ada introduction, this
basic capability is something you should be able to do yourself.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


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

* Re: Integer Overflow Question.
  2014-08-25 17:21         ` Simon Wright
@ 2014-08-25 17:56           ` austin.obyrne769
  2014-08-25 19:38           ` austin.obyrne769
  1 sibling, 0 replies; 16+ messages in thread
From: austin.obyrne769 @ 2014-08-25 17:56 UTC (permalink / raw)


On Monday, August 25, 2014 6:21:43 PM UTC+1, Simon Wright wrote:
> austin.obyrne769@btinternet.com writes:
> 
> 
> 
> > Could you please set out the Ada-95 sourcecode for defining an integer
> 
> > variable called "CipherText" in the range say of 8 decimal digits to
> 
> > 12 decimal digits. I can do the others myself once I know what to do.
> 
> 
> 
> This may help:
> 
> 
> 
> with Ada.Text_IO;
> 
> procedure Obyrne is
> 
>    type Ciphertext_Integer is range -10 ** 12 .. 10 ** 12;
> 
> begin
> 
>    Ada.Text_IO.Put_Line
> 
>      ("first is " & Ciphertext_Integer'Image (Ciphertext_Integer'First)
> 
>         & ", last is " & Ciphertext_Integer'Image (Ciphertext_Integer'Last));
> 
> end Obyrne;
> 
> 
> 
> With up-to-date GNAT, this outputs
> 
> 
> 
> first is -1000000000000, last is  1000000000000

Many thanks Simon

Can I go ahead and use 'Ciphertext' eg. CipherText := residue + N.N any where in a program after that so long as I stay in the declared range? - I shall experiment with this - Thanks Austin


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

* Re: Integer Overflow Question.
  2014-08-25 17:40         ` Simon Clubley
@ 2014-08-25 18:09           ` austin.obyrne769
  0 siblings, 0 replies; 16+ messages in thread
From: austin.obyrne769 @ 2014-08-25 18:09 UTC (permalink / raw)


On Monday, August 25, 2014 6:40:58 PM UTC+1, Simon Clubley wrote:
> On 2014-08-25, austin.obyrne769@btinternet.com <austin.obyrne769@btinternet.com> wrote:
> 
> > On Monday, August 25, 2014 2:34:29 PM UTC+1, Aay Jay Chan wrote:
> 
> >> From the fact that you don't know how big your types are, it sounds like you are using pre-defined types. In Ada, the prefered way is to define your own types with the range that matches your requirements. That way, you will know, at compile time, whether the compiler can implement those types on the target platform.
> 
> >
> 
> > Apologies
> 
> >
> 
> > I haven't just learned that I can do that.
> 
> >
> 
> > I have indeed been using pre-defined integers and was quite unaware
> 
> > that I could define my own types with a suitable range - I have only
> 
> > just learned that from another source.
> 
> >
> 
> 
> 
> Austin, the following is a polite and well intentioned suggestion.
> 
> 
> 
> User defined data types with user defined ranges are a core capability
> 
> within Ada's range of features.
> 
> 
> 
> Although I am a professional programmer, my interest in Ada is only
> 
> personal, and not work related. However, that doesn't change the fact
> 
> I found out about this capability within Ada very shortly after
> 
> starting to explore Ada years ago.
> 
> 
> 
> My suggestion is for you to pick up an Ada book or maybe look at an
> 
> online resource and learn about the other things Ada can do.
> 
> 
> 
> When I was beginning Ada I found things like Ada Distilled to be of
> 
> interest and I see it is still online in various forms. I also have
> 
> paper books such as the Barnes "Programming in Ada 95", second edition
> 
> and "Ada as a second language" by Cohen in my library.
> 
> 
> 
> I would recommend you start with Ada Distilled and see how you get on
> 
> with that before buying any books. Also, before buying any books, I
> 
> recommend you ask here for advice on what the current recommended books
> 
> are.
> 
> 
> 
> The Ada reference manual is also available online and for downloading.
> 
> 
> 
> > You see, I am not a well informed programmer and I am also pre-occupied with the maths and the cryptography as well as The Ada side of things.
> 
> >
> 
> 
> 
> If you are creating crypto schemes, you _really_ need to be skilled in
> 
> your implementation language of choice.
> 
> 
> 
> > Please Mr Chan, 
> 
> >
> 
> > Could you please set out the Ada-95 sourcecode for defining an integer variable called "CipherText" in the range say of 8 decimal digits to 12 decimal digits. I can do the others myself once I know what to do.
> 
> >
> 
> 
> 
> If you don't know this about Ada, it's not something which should be
> 
> done by rote. However, if you work through an Ada introduction, this
> 
> basic capability is something you should be able to do yourself.
> 
> 
> 
> Simon.
> 
> 
> 
> -- 
> 
> Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
> 
> Microsoft: Bringing you 1980s technology to a 21st century world

Yes, I agree with everything you say.

The cipher is complete and there is no fear of it being broken.   It's a question more of refinement now that I get this matter right in my understanding whether I take it into this cipher or not later.  The cipher does not require large integers for its operation and it is more a question of me saying the right things about it in the user-guide that I am currently writing.

Your advice is appreciated and I will look for the books you recommend.

Austin.

Ada is the perfect language for cryptography in my view

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

* Re: Integer Overflow Question.
  2014-08-25 17:21         ` Simon Wright
  2014-08-25 17:56           ` austin.obyrne769
@ 2014-08-25 19:38           ` austin.obyrne769
  1 sibling, 0 replies; 16+ messages in thread
From: austin.obyrne769 @ 2014-08-25 19:38 UTC (permalink / raw)


On Monday, August 25, 2014 6:21:43 PM UTC+1, Simon Wright wrote:
> austin.obyrne769@btinternet.com writes:
> 
> 
> 
> > Could you please set out the Ada-95 sourcecode for defining an integer
> 
> > variable called "CipherText" in the range say of 8 decimal digits to
> 
> > 12 decimal digits. I can do the others myself once I know what to do.
> 
> 
> 
> This may help:
> 
> 
> 
> with Ada.Text_IO;
> 
> procedure Obyrne is
> 
>    type Ciphertext_Integer is range -10 ** 12 .. 10 ** 12;
> 
> begin
> 
>    Ada.Text_IO.Put_Line
> 
>      ("first is " & Ciphertext_Integer'Image (Ciphertext_Integer'First)
> 
>         & ", last is " & Ciphertext_Integer'Image (Ciphertext_Integer'Last));
> 
> end Obyrne;
> 
> 
> 
> With up-to-date GNAT, this outputs
> 
> 
> 
> first is -1000000000000, last is  1000000000000

One last question that may have been taken for granted by the various people who helped me re-define integers.

If I define integers in a range that is outside of 2^31 - 1 (2147483647) will it be possible to use these in a 32-bit computer or is the advice and methodology re user defined integers given to me earlier related to 64-bit environment only - I forgot to ask.  This is important because I must cater for both sizes of home owners' computers.

If defining integers larger than the scope of the 32-bit computer means using 64-bit as an inevitable consequence then I cannot do it.

Would some body comment on this please.

Sorry to be such a nuisance.


adacrypt

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

end of thread, other threads:[~2014-08-25 19:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-25 11:21 Integer Overflow Question austin.obyrne769
2014-08-25 11:46 ` G.B.
2014-08-25 12:58   ` austin.obyrne769
2014-08-25 13:09     ` Simon Clubley
2014-08-25 13:29       ` austin.obyrne769
2014-08-25 13:44         ` Simon Clubley
2014-08-25 13:34     ` Aay Jay Chan
2014-08-25 15:09       ` austin.obyrne769
2014-08-25 17:02       ` austin.obyrne769
2014-08-25 17:21         ` Simon Wright
2014-08-25 17:56           ` austin.obyrne769
2014-08-25 19:38           ` austin.obyrne769
2014-08-25 17:40         ` Simon Clubley
2014-08-25 18:09           ` austin.obyrne769
2014-08-25 12:20 ` gautier_niouzes
2014-08-25 12:54   ` austin.obyrne769

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