# Extremely large numbers

We are developing a RSA-crypto-application for a school project.
We need to us extremely large numbers (integers/real:s about 64bytes big, about 100numbers long...).
Is there a way to implent that in delphi 4/5? If so - how?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
try the long or unsigned types..
long real
etc..
0
Commented:
Listening
0
Commented:
If you're keen, you could translate the library contained in bnc.zip (look for multiple precision on the search engine at http://sunsite.icm.edu.pl/delphi).

Its in C++, but is worth a look at anyway.

Cheers,

Raymond.
0
Author Commented:
RBertora >> i think these are too small, we'll be dealing with prime numbers consisting of about 100 digitas

0
Commented:
There's the INT64 type, that'll give you about 20 digits.  Beyond that, I have a suggestion - the Delphi string type is for all intents and purposes of an 'infinite' length.  Implementing "string arithmetics" is simple.  For a quick example:

function strmult(s1,s2 : string) : string;
var
carry : string;
tempval,i,lim : integer;

begin
lim := length(s1);
if length(s2) > lim
lim := s2;
result := '';
carry := 0;
for i:=1 to lim do
begin
tempval := (ord(s1[i])-ord('0')) *  (ord(s2[i])-ord('0')) + carry;
result := chr(tempval mod 10) + result;
carry := carry div 10;
end;
while (carry > 0) do
begin
result := char(carry mod 10) + result;
carry := carry div 10;
end;
end;

Addition and subtraction are simple, division you do like long division.  Other functions you do like power series.

The advantage here is pretty much infinite accuracy.  The disadvantage - speed.  If you really want speed for something like this, a similar multibyte approach can be done in assember, and then the new routines linked in.

0
Commented:
can also look at www.crypto-central.com
there is free rsa component there which i have copy of and comes with good demo.
doesnt come with source though :-(
0
Commented:

Alex
0
Commented:
0
Commented:
Longword give 9 1/2 digits. You will need an array of about 12 words to do this. You can make up your own math routines. It may be easier to use strings to hold values.

or

0
Commented:
Listening
0
Commented:
Create your own class that's working internally with arrays of 64-Bit integers.
0
Commented:
Here you go:

Fast Gigantic Integers (GINT):

Since your work is RSA-related, this site will also be interesting:

Yours,

Alex

0

Experts Exchange Solution brought to you by