| |
 |
|
|
Science Forum Index » Cryptography Forum » Big Integer: How Many Base-10 Digits Enough?
Page 1 of 1
|
| Author |
Message |
| Le Chaud Lapin |
Posted: Wed Apr 30, 2008 1:12 pm |
|
|
|
Guest
|
Hi All,
I am optimizing in space a C++ Big Integer class.
Like most big integer classes, I must keep track within the class of
the effective number of base-10 digits of an object of the class,
which can be determined from the number of (8*2^x)-bit segments that
comprise the big integer (GMP calls them limbs).
Using a full unsigned int on a 32-bit machine to keep track of such
segments yields a maxium of 4,294,967,295 segments, which would be a
massive base-10 number.
I would like to consolidate multiple fields of my class so that only 1
32-bit bit-field is use to represent several fields, including the
segment count. At present, I have 28-bits avalable, which is plenty
for a count, but I want to reserve some bits for just-in-case.
What is a reasonable number of base-10 digits in a big integer class
for operations beyond crypto?
-Le Chaud Lapin- |
|
|
| Back to top |
|
| robertwessel2@yahoo.com |
Posted: Wed Apr 30, 2008 2:36 pm |
|
|
|
Guest
|
On Apr 30, 6:12 pm, Le Chaud Lapin <jaibudu...@gmail.com> wrote:
Quote: Hi All,
I am optimizing in space a C++ Big Integer class.
Like most big integer classes, I must keep track within the class of
the effective number of base-10 digits of an object of the class,
which can be determined from the number of (8*2^x)-bit segments that
comprise the big integer (GMP calls them limbs).
Using a full unsigned int on a 32-bit machine to keep track of such
segments yields a maxium of 4,294,967,295 segments, which would be a
massive base-10 number.
I would like to consolidate multiple fields of my class so that only 1
32-bit bit-field is use to represent several fields, including the
segment count. At present, I have 28-bits avalable, which is plenty
for a count, but I want to reserve some bits for just-in-case.
What is a reasonable number of base-10 digits in a big integer class
for operations beyond crypto?
The biggest RSA key size I've ever heard discussed was about 15k bits,
which was what NIST suggests is equivalent to a 256 bit symmetric
key. Of course I've never seen anyone actually try to use one bigger
that 8192 bits (and even that is rather silly). To implement modular
exponentiation, you'll need intermediates of twice that length, so for
the bigger limit you'd need around 10k decimal digits. So 16 bits, if
a nice round number helps, sounds like a reasonable choice.
OTOH, what's the point here? Even for short RSA keys you're talking
about needing 1024 bits of storage for the number and saving what? 16
bits, or a small multiple thereof? Two or three percent? Is that
really worth it?
Perhaps if you were expecting a large number of small(ish) numbers, a
compressed format (with automatic conversions to and from the normal
larger format) might be worthwhile. Not to mention that you'd
eliminate all that bit field manipulation in the main part of your
processing. |
|
|
| Back to top |
|
| David Eather |
Posted: Thu May 01, 2008 4:44 am |
|
|
|
Guest
|
Le Chaud Lapin wrote:
Quote: Hi All,
I am optimizing in space a C++ Big Integer class.
Like most big integer classes, I must keep track within the class of
the effective number of base-10 digits of an object of the class,
which can be determined from the number of (8*2^x)-bit segments that
comprise the big integer (GMP calls them limbs).
Using a full unsigned int on a 32-bit machine to keep track of such
segments yields a maxium of 4,294,967,295 segments, which would be a
massive base-10 number.
I would like to consolidate multiple fields of my class so that only 1
32-bit bit-field is use to represent several fields, including the
segment count. At present, I have 28-bits avalable, which is plenty
for a count, but I want to reserve some bits for just-in-case.
What is a reasonable number of base-10 digits in a big integer class
for operations beyond crypto?
-Le Chaud Lapin-
a base ten digit requires 3.3219280948873623478703194294894 bits approx |
|
|
| Back to top |
|
| Le Chaud Lapin |
Posted: Thu May 01, 2008 9:02 am |
|
|
|
Guest
|
On Apr 30, 7:36 pm, "robertwess...@yahoo.com"
<robertwess...@yahoo.com> wrote:
Quote: On Apr 30, 6:12 pm, Le Chaud Lapin <jaibudu...@gmail.com> wrote:
Hi All,
I am optimizing in space a C++BigIntegerclass.
Like mostbigintegerclasses, I must keep track within the class of
the effective number of base-10 digits of an object of the class,
which can be determined from the number of (8*2^x)-bit segments that
comprise thebiginteger(GMP calls them limbs).
Using a full unsigned int on a 32-bit machine to keep track of such
segments yields a maxium of 4,294,967,295 segments, which would be a
massive base-10 number.
I would like to consolidate multiple fields of my class so that only 1
32-bit bit-field is use to represent several fields, including the
segment count. At present, I have 28-bits avalable, which is plenty
for a count, but I want to reserve some bits for just-in-case.
What is a reasonable number of base-10 digits in abigintegerclass
for operations beyond crypto?
The biggest RSA key size I've ever heard discussed was about 15k bits,
which was what NIST suggests is equivalent to a 256 bit symmetric
key. Of course I've never seen anyone actually try to use one bigger
that 8192 bits (and even that is rather silly). To implement modular
exponentiation, you'll need intermediates of twice that length, so for
the bigger limit you'd need around 10k decimal digits. So 16 bits, if
a nice round number helps, sounds like a reasonable choice.
I was thinking more about the people who use 10-million-digit numbers.
Quote: OTOH, what's the point here? Even for short RSA keys you're talking
about needing 1024 bits of storage for the number and saving what? 16
bits, or a small multiple thereof? Two or three percent? Is that
really worth it?
Perhaps if you were expecting a large number of small(ish) numbers, a
compressed format (with automatic conversions to and from the normal
larger format) might be worthwhile. Not to mention that you'd
eliminate all that bit field manipulation in the main part of your
processing.- Hide quoted text -
Zero values of my big integer objects, on 32-bit machine, can take up
either 64-bits using bit fields or 160 bits without. It is
conceivable that someone somewhere will have a container of say, 10
million of these, and wonder why I did not take the opportunity to
save them 40MB of space for their container, since it costs me
virtually nothing to do so.
I am leaning heavily toward using 27 bits to represent number of
segments in big integer representation. That will allow decimal
integers of up to 1.3 billion decimal digits on 32-bit machine, which
should be plenty, while leaving 5 bits for whatever. ;)
-Le Chaud Lapin- |
|
|
| Back to top |
|
| |
|
Page 1 of 1
All times are GMT - 5 Hours
The time now is Sun Sep 07, 2008 9:12 am
|
|