83Plus:OS:Big Integers

From WikiTI
Jump to: navigation, search

Big integers are used by the internal cryptographic functions, for which ordinary fixed- or floating-point numbers would be inadequate.

A big integer takes the following form:

  • The first byte holds the length of the number in bytes.
  • Subsequent bytes are the digits of the number, represented in base 256. They are in "little-endian" order, which means that the least significant digit comes first.
  • The most significant byte is usually required to be nonzero.

For example, an approximation of Avogadro's number could be represented by:

0A 00 00 27 FE AF 45 30 18 86 7F

(In other words, the above represents the hexadecimal number 7F86183045AFFE270000.)

Big integers are generally limited to 64 digits -- 512 bits -- because of the fixed sizes of the registers used to operate on them.

Big integers are often stored in app or certificate fields, both with and without the length byte included in the field data. For example, the usual app header includes a signature of the date stamp, which is a "raw" 64-byte field. In contrast, Rabin moduli given in certificates are stored as 65-byte fields, the first byte of which is the length.