BigNum Math: Implementing Cryptographic Multiple Precision Arithmetic

In the previous chapter, a series of low-level algorithms was established that dealt with initializing and maintaining mp_int structures. This chapter will discuss another set of seemingly non-algebraic algorithms that will form the low-level basis of the entire library. While these algorithms are relatively trivial, it is important to understand how they work before proceeding since these algorithms will be used almost intrinsically in the following chapters.
The algorithms in this chapter deal primarily with more "programmer" related tasks such as creating copies of mp_int structures, assigning small values to mp_int structures and comparisons of the values mp_int structures represent.
Assigning the value that a given mp_int structure represents to another mp_int structure shall be known as making a copy for the purposes of this text. The copy of the mp_int will be a separate entity that represents the same value as the mp_int it was copied from. The mp_copy algorithm provides this functionality (Figure 3.1).
| Algorithm mp_copy. Input. An mp_int a and b. Output. Store a copy of a in b. |
|