Intel 4004

The Integers We Use In Programs Are Just So Small …

--

Our microprocessors started off with 4-bit registers (the mighty 4004 processor), and where we organised our memory in address with 8 bits in each. We then saw the development of 8-bit (8080), 16-bit (8086), 32-bit (80386) and 64-bit (Pentium) processors. Each of these processes could deal with larger integer values. Thus we end up with integers represented by 8-bit (byte), 16-bit (short), 32-bit (int) and 64-bit (long) values. These can be signed or unsigned.

Within cryptography, we often deal with integers which are greater than 64 bits. This means that we cannot use our normal integer values within programs. For this we normally use Big Integers to perform our calculations, and where we use a string value to represent the values (or as bytes) and then convert to a Big Integer. In this example, we will use the normal arithmetic operations for Big Integers, along with using the Mod operation with a prime number.

So let’s implement some Golang code for using Big Integers [here]:

package mainimport (
"fmt"
"math/big"
"os"
"strings"
)
func isHexString(s string) bool {
return strings.ContainsAny(s, "abc")
}
func toBigInt(s string) *big.Int {
x, _ := new(big.Int).SetString("0", 16)
if…

--

--

Prof Bill Buchanan OBE FRSE
ASecuritySite: When Bob Met Alice

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.