From what has been taught to me, to me it means that a 64bit computer would have a 64 bit register , but if it is so, how does one handle encryption etc which would need 128 bit keys or more to be processed or some other operation that requires higher bits than the processor register can handle?
-
2Just like they can handle strings with hundred of characters. You have to program an algorithm that will split the computation in elemental steps doable on the architecture. – Alain Merigot Mar 11 '19 at 17:53
-
Remember that even an old 8 bit CPU without floating point unit could do floating point operations, even when terribly slow. So your question is quite unspecific. – U. Windl Mar 11 '19 at 19:18
-
See gnu gmp library. – kelalaka Mar 11 '19 at 19:22
1 Answers
Read this Q/A to see how to deal with arbitrarily sized (unsigned) integers.
However, for simply 2 or 4 times the size, it is more likely to have a more simple combination. For instance, for 128 bit (modular) addition Z = X + Y (mod 2^128)
:
lowZ = lowX + lowY (mod 2 ^ 64)
;lowC = lowZ < lowX ? 1 : 0
(in other words: if the carry is not directly available, you need to calculate it);hiZ = hiX + hiY + lowC
(mod 2 ^ 64);hiC = hiZ < hiX ? 1 : 0
(but usually the carry is simply discarded).
The lowX
, lowY
and lowZ
are just the 64 least significant bits of the value X
, Y
and Z
. The hiX
, hiY
and hiZ
are then just the 64 most significant bits of the value X
, Y
and Z
.
You can do this for other operations as well. Things like bit operations, shifts etc. are rather simple. Multiplication is harder and division / remainder is a bitch. How do I know? Well, here is an example of 32 bit calculations for Java Card, a system that basically assumes 16 bit operations. That one was a bit harder to program because Java doesn't use unsigned calculations.
Funny enough, Java Card itself is usually running on 8 bit CPU's (although this is changing rapidly). So actually, there is a double conversion 8 bit to 16 bit and 16 bit to 32 bit going on. The 8 bit processor architecture, appropriately enough, is a direct predecessor of CPU's used in pocket calculators. This kind of conversion has been known since the dawn of IT and probably before.

- 90,524
- 13
- 150
- 263
-
Well, the CPU's are 8 bit with 16 bits extensions usually, which means that the calculations need to be done in microcode instead. Which usually allows some more tricks to be available, but it won't be significantly different otherwise. In the end, the gates on a CPU only perform ops bits, of course. – Maarten Bodewes Mar 12 '19 at 01:37