[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bignums

> From: Hallam-Baker <hallam@ai.mit.edu>
> This is not a routing problem, it is a computation problem. Byte alignment 
> is a necessary procedure. Little endian is the most efficient form of
> presentation.
> One of the points made in the holy wars RFC is that endianness is 
> religion except when it matters. This is a case where it does actually
> matter for a change!

Note: I don't have any religious preference for either byte order.  But
it's hard to see how "it does actually matter".

If you are talking about binary data, it will have to be word-aligned
after receipt, regardless of whether it also has to be byte-swapped.
(Unless you are suggesting that all bignum fields in the SPKI binary
representation be 64-bit aligned, like IPv6.  That restriction would be
a bit unusual for an application-layer data structure.)

If you are talking about hex data, you have to process the input 4 bits
at a time, regardless of whether you store the binary result high-to-low
or low-to-high.

If you are doing only comparisons between bignums, you might as well
compare the transfer strings (I disagree that a hex or binary SPKI
structure on the wire is "presentation" data) instead of converting
to native bignum format before comparison.  No conversions, no difference
in conversion times :-).

And if you are doing computations, I suspect that any difference in time
between hex-to-binary and hex-to-binary-with-byteswap, or between
word-align and word-align-with-byteswap would be completely swamped
by the multiplication or exponentiation time.

Flip a coin, pick one, and move on.