Preface to the First Edition

Team-Fly

Mathematics is the queen of the sciences, and number theory is the queen of mathematics. Frequently, she deigns to assist astronomy and other of the natural sciences, but primacy is due her under all circumstances.

Carl Friedrich Gauss

WHY DO WE NEED a book on cryptography whose principal focus is the arithmetic of whole numbers—the integers—and its application to computer programming? Is this not a rather insignificant subject in comparison to the important problems with which computer science generally involves itself? So long as one confines oneself to the range of numbers that can be represented by the standard numerical types of a programming language, arithmetic is a rather simple affair, and the familiar arithmetic operations make their traditional appearances in programs accompanied by the familiar symbols +, , /, *.

But if one requires results whose length far exceeds what can be expressed in 16 or 32 bits, then the situation begins to get interesting. Even the basic arithmetic operations are no longer available for such numbers, and one gets nowhere without first investing considerable effort in solving problems that never even seemed like problems before. Anyone who investigates problems in number theory, whether professionally or as a hobby, in particular the topic of contemporary cryptography, is familiar with such issues: The techniques of doing arithmetic that we learned in school now demand renewed attention, and we find ourselves sometimes dealing with incredibly involved processes.

The reader who wishes to develop programs in these areas and is not inclined to reinvent the wheel will find included with this book a suite of functions that will serve as an extension of C and C++ for calculating with large integers. We are not talking about "toy" examples that say, "this is how it works in principle," but a complete collection of functions and methods that satisfy the professional requirements of stability, performance, and a sound theoretical basis.

Making the connection between theory and practice is the goal of this book, that is, to close the gap between the theoretical literature and practical programming problems. In the chapters ahead we shall develop step by step the fundamental calculational principles for large natural numbers, arithmetic in finite rings and fields, and the more complex functions of elementary number theory, and we shall elucidate the many and various possibilities for applying these principles to modern cryptography. The mathematical fundamentals will be explained to the extent necessary for understanding the programs that are presented here, and for those interested in pursuing these matters further there are extensive references to the literature. The functions that we develop will then be brought together and extensively tested, resulting in a useful and comprehensive programming interface.

Beginning with the representation of large numbers, in the following chapters we shall first deal with the fundamentals of computation. For addition, subtraction, multiplication, and division of large numbers we shall create powerful basic functions. Building on these, we shall explain modular arithmetic in residue classes and implement the relevant operations in library functions. A separate chapter is devoted to the time-intensive process of exponentiation, where we develop and program various specialized algorithms for a number of applications in modular arithmetic.

After extensive preparation, which includes input and output of large numbers and their conversion into various bases, we study algorithms of elementary number theory using the basic arithmetic functions, and we then develop programs, beginning with the calculation of the greatest common divisor of large numbers. We shall then move on to such problems as calculating the Legendre and Jacobi symbols, and inverses and square roots in finite rings, and we shall also become familiar with the Chinese remainder theorem and its applications.

In connection with this we shall go into some detail about the principles of identifying large prime numbers, and we shall program a powerful multistage primality test.

A further chapter is devoted to the generation of large random numbers, in which a cryptographically useful bit generator is developed and tested with respect to its statistical properties.

To end the first part we shall concern ourselves with testing arithmetic and other functions. To do this we shall derive special test methods from the mathematical rules of arithmetic, and we shall consider the implementation of efficient external tools.

The subject of the second part is the step-by-step construction of the C++ class LINT (Large INTegers), in the course of which we shall embed the C functions of the first part into the syntax and semantics of the object-oriented programming language C++. We shall put particular weight on formatted input and output of LINT objects with flexible stream functions and manipulators, as well as error handling with exceptions. The elegance with which algorithms can be formulated in C++ is particularly impressive when the boundaries between standard types and large numbers as LINT objects begin to dissolve, resulting in the syntactic closeness to the implemented algorithms and in great clarity and transparency.

Finally, we shall demonstrate the application of the methods we have developed by implementing an extensive RSA cryptosystem for encryption and the creation of digital signatures. In the process we shall explain the theory of the RSA procedure and its operation as the most prominent representative of asymmetric cryptosystems, and in a self-contained example we shall develop an extensible kernel for applications of this ultramodern cryptographic process according to the object-oriented principles of the programming language C++.

We shall round all of this off with a glimpse of further possible extensions of the software library. As a small highlight at the end we shall present four functions in 80×86 assembly language for multiplication and division, which will improve the performance of our software. Appendix D contains a table of typical calculation times with and without the assembler supplement.

All readers of this book are heartily invited to join me on this path, or perhaps—depending on individual interest—to focus on particular sections or chapters and try out the functions presented there. The author hopes that it will not be taken amiss that he refers to his readers, together with himself, as "we." He hopes thereby to encourage them to take an active role in this journey through a cutting-edge area of mathematics and computer science, to figure things out for themselves and take from this book what is of greatest benefit. As for the software, let the reader not be lacking in ambition to extend the scope or speed of one or more functions through new implementations.

I wish to thank Springer-Verlag and particularly Hermann Engesser, Dorothea Glaunsinger, and Ulrike Stricker for their interest in the publication of this book and for their friendly and active collaboration. The manuscript was reviewed by Jörn Garbers, Josef von Helden, Brigitte Nebelung, Johannes Ueberberg, and Helga Welschenbach. I offer them my heartfelt thanks for their critical suggestions and improvements, and above all for their care and patience. If despite all of our efforts some errors remain in the text or in the software, the author alone bears the responsibility. I am extremely grateful to my friends and colleagues Robert Hammelrath, Franz-Peter Heider, Detlef Kraus, and Brigitte Nebelung for their insights into the connections between mathematics and computer science over many years of collaboration that have meant a great deal to me.


Team-Fly


Cryptography in C and C++
Cryptography in C and C++
ISBN: 189311595X
EAN: 2147483647
Year: 2001
Pages: 127

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net