a circuit for implementing elliptic curve and hyperelliptic curve encryption and decryption operations , having a read only memory with no more than about two kilobytes of accessible memory , containing first programming instructions . an arithmetic logic unit has access to second programming instructions that are resident in a gate - level program disposed in the arithmetic logic unit , and is operable to receive data from no more than one input fifo register . a microcontroller has no more than about two thousand gates , and is adapted to read the first programming instructions from the read only memory , send control signals to the arithmetic logic unit , and receive flags from the arithmetic logic unit . the arithmetic unit reads the third programming instructions , selectively performs elliptic curve and hyperelliptic curve encryption and decryption operations on the data according to the second programming instructions and the microcontroller , and sends output to no more than one output fifo register .