BigNum Math: Implementing Cryptographic Multiple Precision Arithmetic
By Tom St Denis
3/5
()
About this ebook
Bignum math is the backbone of modern computer security algorithms. It is the ability to work with hundred-digit numbers efficiently using techniques that are both elegant and occasionally bizarre. This book introduces the reader to the concept of bignum algorithms and proceeds to build an entire library of functionality from the ground up. Through the use of theory, pseudo-code and actual fielded C source code the book explains each and every algorithm that goes into a modern bignum library. Excellent for the student as a learning tool and practitioner as a reference alike BigNum Math is for anyone with a background in computer science who has taken introductory level mathematic courses. The text is for students learning mathematics and cryptography as well as the practioner who needs a reference for any of the algorithms documented within.
* Complete coverage of Karatsuba Multiplication, the Barrett Algorithm, Toom-Cook 3-Way Multiplication, and More
* Tom St Denis is the developer of the industry standard cryptographic suite of tools called LibTom.
* This book provides step-by-step exercises to enforce concepts
Tom St Denis
Tom St Denis is the author of the industry standard LibTom series of projects. Tom is a senior software developer and cryptographer for the Advanced Micro Devices Corporation. He has been engaged in various international development contracts and speaking engagements since 2004. He is at work on his next book, Cryptography for Developers.
Related to BigNum Math
Related ebooks
Communication Nets: Stochastic Message Flow and Delay Rating: 3 out of 5 stars3/5Automated Theorem Proving: A Logical Basis Rating: 0 out of 5 stars0 ratingsThe Calculi of Lambda-Conversion (AM-6), Volume 6 Rating: 4 out of 5 stars4/5Numberama: Recreational Number Theory in the School System Rating: 0 out of 5 stars0 ratingsFoundations of Deductive Databases and Logic Programming Rating: 5 out of 5 stars5/5An Elementary Course in Synthetic Projective Geometry Rating: 0 out of 5 stars0 ratingsRadioastronomical Methods of Antenna Measurements Rating: 0 out of 5 stars0 ratingsError Coding for Arithmetic Processors Rating: 0 out of 5 stars0 ratingsThe Travelling Salesman's Problem Rating: 0 out of 5 stars0 ratingsAn Introduction to Matrices, Sets and Groups for Science Students Rating: 0 out of 5 stars0 ratingsWhat Is Random?: Chance and Order in Mathematics and Life Rating: 4 out of 5 stars4/5Pseudorandomness and Cryptographic Applications Rating: 0 out of 5 stars0 ratingsMathematical Experiments on the Computer Rating: 0 out of 5 stars0 ratingsExercises of Tensors Rating: 0 out of 5 stars0 ratingsBlondie24: Playing at the Edge of AI Rating: 4 out of 5 stars4/5DIFFERENTIAL CALCULUS: A Mathematical Analysis for Applied Sciences Rating: 0 out of 5 stars0 ratingsReasoning About Luck: Probability and Its Uses in Physics Rating: 4 out of 5 stars4/5Quantum Machine Learning with Python: Using Cirq from Google Research and IBM Qiskit Rating: 5 out of 5 stars5/5Studies in Mathematics and Mechanics Rating: 0 out of 5 stars0 ratingsFinite Automata: Behavior and Synthesis Rating: 5 out of 5 stars5/5Fascinating Mathematical People: Interviews and Memoirs Rating: 0 out of 5 stars0 ratingsDistributed Computing Through Combinatorial Topology Rating: 0 out of 5 stars0 ratingsThe Theory of Splines and Their Applications: Mathematics in Science and Engineering: A Series of Monographs and Textbooks, Vol. 38 Rating: 0 out of 5 stars0 ratingsTheoretical Mechanics for Sixth Forms: In Two Volumes Rating: 0 out of 5 stars0 ratingsCombinatorics 79. Part I Rating: 0 out of 5 stars0 ratingsSci-Fi Short Stories: Sci-Fi Shorts, #1 Rating: 0 out of 5 stars0 ratingsSymbolic Logic Rating: 0 out of 5 stars0 ratingsCantor, Russell, and ZFC Rating: 5 out of 5 stars5/5Recent Developments in Quantum Field Theory Rating: 0 out of 5 stars0 ratingsKalman Filtering and Neural Networks Rating: 0 out of 5 stars0 ratings
Computers For You
101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/5Slenderman: Online Obsession, Mental Illness, and the Violent Crime of Two Midwestern Girls Rating: 4 out of 5 stars4/5The ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 0 out of 5 stars0 ratingsElon Musk Rating: 4 out of 5 stars4/5The Invisible Rainbow: A History of Electricity and Life Rating: 4 out of 5 stars4/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 0 out of 5 stars0 ratingsUltimate Guide to Mastering Command Blocks!: Minecraft Keys to Unlocking Secret Commands Rating: 5 out of 5 stars5/5Master Builder Roblox: The Essential Guide Rating: 4 out of 5 stars4/5CompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsMastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5User Friendly: How the Hidden Rules of Design Are Changing the Way We Live, Work, and Play Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5GarageBand Basics: The Complete Guide to GarageBand: Music Rating: 0 out of 5 stars0 ratingsCompTIA Security+ Practice Questions Rating: 2 out of 5 stars2/5Alan Turing: The Enigma: The Book That Inspired the Film The Imitation Game - Updated Edition Rating: 4 out of 5 stars4/5Learning the Chess Openings Rating: 5 out of 5 stars5/5Storytelling with Data: Let's Practice! Rating: 4 out of 5 stars4/5CompTIA Security+ Get Certified Get Ahead: SY0-701 Study Guide Rating: 5 out of 5 stars5/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5AP® Computer Science Principles Crash Course Rating: 0 out of 5 stars0 ratings
Reviews for BigNum Math
1 rating0 reviews
Book preview
BigNum Math - Tom St Denis
rabin
Preface
The origins of this book are part of an interesting period of my life. A period that saw me move from a shy and disorganized young adult, into a software developer who has toured various parts of the world, and met countless new friends and colleagues. It all began in December of 2001, nearly five years ago. I started a project that would later become known as LibTomCrypt, and be used by developers throughout industry worldwide.
The LibTomCrypt project was originally started as a way to focus my energies on to something constructive, while also learning new skills. The first year of the project taught me quite a bit about how to organize a product, document and support it and maintain it over time. Around the winter of 2002 I was seeking another project to spread my time with. Realizing that the math performance of LibTomCrypt was lacking, I set out to develop a new math library.
Hence, the LibTomMath project was born. It was originally merely a set of patches against an existing project that quickly grew into a project of its own. Writing the math library from scratch was fundamental to producing a stable and independent product. It also taught me what sort of algorithms are available to do operations such as modular exponentiation. The library became fairly stable and reliable after only a couple of months of development and was immediately put to use.
In the summer of 2003, I was yet again looking for another project to grow into. Realizing that merely implementing the math routines is not enough to truly understand them, I set out to try and explain them myself. In doing so, I eventually mastered the concepts behind the algorithms. This knowledge is what I hope will be passed on to the reader. This text is actually derived from the public domain archives I maintain on my www.libtomcrypt.com Web site.
When I tell people about my LibTom projects (of which there are six) and that I release them as public domain, they are often puzzled. They ask why I did it, and especially why I continue to work on them for free. The best I can explain it is, Because I can
-which seems odd and perhaps too terse for adult conversation. I often qualify it with I am able, I am willing,
which perhaps explains it better. I am the first to admit there is nothing that special with what I have done. Perhaps others can see that, too, and then we would have a society to be proud of. My LibTom projects are what I am doing to give back to society in the form of tools and knowledge that can help others in their endeavors.
I started writing this book because it was the most logical task to further my goal of open academia. The LibTomMath source code itself was written to be easy to follow and learn from. There are times, however, where pure C source code does not explain the algorithms properly–hence this book. The book literally starts with the foundation of the library and works itself outward to the more complicated algorithms. The use of both pseudo-code and verbatim source code provides a duality of theory
and practice
the computer science students of the world shall appreciate. I never deviate too far from relatively straightforward algebra, and I hope this book can be a valuable learning asset.
This book, and indeed much of the LibTom projects, would not exist in its current form if it were not for a plethora of kind people donating their time, resources, and kind words to help support my work. Writing a text of significant length (along with the source code) is a tiresome and lengthy process. Currently, the LibTom project is five years old, composed of literally thousands of users and over 100,000 lines of source code, TEX, and other material. People like Mads Rassmussen and Greg Rose were there at the beginning to encourage me to work well. It is amazing how timely validation from others can boost morale to continue the project. Definitely, my parents were there for me by providing room and board during the many months of work in 2003.
Both Greg and Mads were invaluable sources of support in the early stages of this project. The initial draft of this text, released in August 2003, was the project of several months of dedicated work. Long hours and still going to school were a constant drain of energy that would not have lasted without support.
Of course this book would not be here if it were not for the success of the various LibTom projects. That success is not only the product of my hard work, but also the contribution of hundreds of other people. People like Colin Percival, Sky Schultz, Wayne Scott, J Harper, Dan Kaminsky, Lance James, Simon Johnson, Greg Rose, Clay Culver, Jochen Katz, Zhi Chen, Zed Shaw, Andrew Mann, Matt Johnston, Steven Dake, Richard Amacker, Stefan Arentz, Richard Outerbridge, Martin Carpenter, Craig Schlenter, John Kuhns, Bruce Guenter, Adam Miller, Wesley Shields, John Dirk, Jean–Luc Cooke, Michael Heyman, Nelson Bolyard, Jim Wigginton, Don Porter, Kevin Kenny, Peter LaDow, Neal Hamilton, David Hulton, Paul Schmidt, Wolfgang Ehrhardt, Johan Lindt, Henrik Goldman, Alex Polushin, Martin Marcel, Brian Gladman, Benjamin Goldberg, Tom Wu, and Pekka Riikonen took their time to contribute ideas, updates, fixes, or encouragement throughout the various project development phases. To my many friends whom I have met through the years, I thank you for the good times and the words of encouragement. I hope I honor your kind gestures with this project.
I′d like to thank the editing team at Syngress for poring over 300 pages of text and correcting it in the short span of a single week. I′d like to thank my friends whom I have not mentioned, who were always available for encouragement and a steady supply of fun. I′d like to thank my friends J Harper, Zed Shaw, and Simon Johnson for reviewing the text before submission. I′d like to thank Lance James of the Secure Science Corporation and the entire crew at Elliptic Semiconductor for sponsoring much of my later development time, for sending me to Toorcon, and introducing me to many of the people whom I know today.
Open Source. Open Academia. Open Minds.
Tom St Denis, Toronto, Canada
May 2006
It’s all because I broke my leg. That just happened to be about the same time Tom asked for someone to review the section of the book about Karatsuba multiplication. I was laid up, alone and immobile, and thought, Why not?
I vaguely knew what Karatsuba multiplication was, but not really, so I thought I could help, learn, and stop myself from watching daytime cable TV, all at once.
At the time of writing this, I′ve still not met Tom or Mads in meatspace. I′ve been following Tom’s progress since his first splash on the sci.crypt Usenet newsgroup. I watched him go from a clueless newbie, to the cryptographic equivalent of a reformed smoker, to a real contributor to the field, over a period of about two years. I′ve been impressed with his obvious intelligence, and astounded by his productivity. Of course, he’s young enough to be my own child, so he doesn′t have my problems with staying awake.
When I reviewed that single section of the book, in its earliest form, I was very pleasantly surprised. So I decided to collaborate more fully, and at least review all of it, and perhaps write some bits, too. There’s still a long way to go with it, and I have watched a number of close friends go through the mill of publication, so I think the way to go is longer than Tom thinks it is. Nevertheless, it’s a good effort, and I′m pleased to be involved with it.
Greg Rose, Sydney, Australia
June 2003
Chapter 1
Introduction