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?
PsychoFoxAsked:
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.

RBertoraCommented:
try the long or unsigned types..
long real
etc..
0
rwilson032697Commented:
Listening
0
rwilson032697Commented:
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
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

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

rwilson >> I'll check out your link.
0
sburckCommented:
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
intheCommented:
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
simonetCommented:
How about TLargeInteger (64-bit) ?

Alex
0
KECommented:
0
CalvinDayCommented:
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.

function SuperLongAdd(x,y:SuperLong): SuperLong;

or

function SuperLongAdd(x,y:String): String;
0
SlavakCommented:
Listening
0
ptmcompCommented:
Create your own class that's working internally with arrays of 64-Bit integers.
0
simonetCommented:
Here you go:

Fast Gigantic Integers (GINT):

http://ace.ulyssis.student.kuleuven.ac.be/~triade/GInt/gint.html

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

http://ace.ulyssis.student.kuleuven.ac.be/~triade/GInt/

Yours,

Alex

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PsychoFoxAuthor Commented:
simonet>> Your answer was the best solution for our purposes, thansk everyone else for you're help!
0
simonetCommented:
Thanks! Good luck.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.