DI Management Home > Cryptography > Modular Arithmetic Freeware

# Modular Arithmetic Freeware

These freeware command line programs will let you do modular arithmetic calculations with large integers. They carry out modular exponentiation, multiplication and inversion computations on large natural numbers, and can convert a large number between decimal and hexadecimal representations.

• bd_ModExp computes the modular exponentiation `ae mod m`
• bd_ModInv computes the modular inversion `a-1 mod m`
• bd_ModMult computes the modular multiplication `a * b mod m`
• bd_Convert converts a decimal number into hexadecimal and vice versa

You use these utilities from the command line prompt. They work in either decimal or hexadecimal format, and can cope with positive numbers of unlimited size (well, in theory anyway, but your command line interpreter will limit the number of digits you can type).

To use, copy the EXE files into a directory that will be searched when you are in the command prompt, such as `C:\WINDOWS`.

Some simple examples of their use are

```C:\>bd_convert -x deadbeef
3735928559

C:\>bd_modexp 14313 3 17947
14313^3 mod 17947 = 13366

C:\>bd_modinv 3 17680
(1/3) mod 17680 = 11787

C:\>bd_modexp 13366 11787 17947
13366^11787 mod 17947 = 14313

C:\>bd_modexp -x 3436 2e0b 461b
3436^2e0b mod 461b = 37e9
```

Note that the last calculation was just the previous one but in hex.

There are more examples in the readme file.