In general terms, the invention provides a finite field engine and methods
for operating on elements in a finite field. The finite field engine
provides finite field sub-engines suitable for any finite field size
requiring a fixed number of machine words. The engine reuses these
engines, along with some general purpose component or specific component
providing modular reduction associated with the exact reduction
(polynomial or prime) of a specific finite field. The engine has
wordsized suitable code capable of adding, subtracting, multiplying,
squaring, or inverting finite field elements, as long as the elements are
representable in no more than the given number of words. The wordsized
code produces unreduced values. Specific reduction is then applied to the
unreduced value, as is suitable for the specific finite field. In this
way, fast engines can be produced for many specific finite fields,
without duplicating the bulk of the engine instructions (program).