[Verse-dev] v_bignum.c and 64-bit processors
Emil Brink
emil at obsession.se
Fri May 6 22:12:53 CEST 2005
On Fri, 6 May 2005 13:01:14 +0300 (EEST)
Samuel Siltanen <saasilta at cc.hut.fi> wrote:
> I found a bug in v_bignum.c, which causes the encryption key generation to
> last extremely long on 64-bit architecture (such as AMD Athlon64). In such
> architectures long ints and addresses are 64 bits long instead of 32 bits.
> That is why the encryption key generation times are orders of magnitude
> longer than on 32-bit architecture (I guess exactly 2^32 times longer),
> which is too long.
>
> I fixed the problem by substituting the longs (64-bit) by ints (32-bit)
> in v_bignum.c.
Oh, that's really interesting. Too bad that (I assume, feel free to
correct me) you won't be bringing any 64-bit hardware to the meeting
next week, I would love to get my hands on some.
I don't currently understand why it takes more time, I would have expected
it to "just work" but I guess I'm sometimes overly optimistic. One thing
you could try if you feel up to it is to make the definition of the
VBigDig type in v_bignum.h "unsigned int" instead of "unsigned short",
that should make the computations work on "digits" of 32 bits rather than
16 bits, and thus be faster. I haven't ever tried that out though, so I
don't know if it works or not.
Also, there *should* be a "VBigDigs" or something type, that can hold
two digits. The current code uses "unsigned long" for that case, as you
noticed. This shouldn't be too hard to add.
Regards,
/Emil
More information about the Verse-dev
mailing list