Big integer algorithm [00] overview, integer algorithm 00 Overview

Source: Internet
Author: User
Tags gmp

Big integer algorithm [00] overview, integer algorithm 00 Overview

★Why?

As early as my freshman year, I became interested in cryptography. At that time, I saw the Computing Principle of RSA encryption in the background of the introduction to computers and found it very interesting. So I really wanted to implement an RSA encryption myself, but I soon gave up, because it is impossible to calculate the super-long integer. The longest Integer type in C is 64-bit. For 1024-bit RSA keys, there is no zero header. To achieve this goal, I began to figure out a library for calculating large integers. I originally planned to use a large data library that someone else has already written, but I decided to do it myself, because all large data libraries with high efficiency (OpenSSL, Crypto ++, GMP ), either the data structure used is very complicated, or the encoding style is very strange. For me who just learned programming, the level and patience are really limited, so that I cannot fully understand these things, there are some codes that I can understand. The implementation method is naive, and the efficiency is very low and slow. Finally, let's think about how to implement big integer computation, it also improves the encoding capability. Why not?

 

★Purpose

It is necessary to clearly identify a project. Otherwise, it is easy to deviate from your original intention. For this big integer library, I am positioning it to be used in cryptography (specifically, public key cryptography), only for integer calculation, not for floating point computing (that is for scientific computing, encryption is completely unavailable)

 

★Requirements

Although the computing overhead of the big integer algorithm is greater than that of other algorithms, most of the overhead can be kept at a small level through careful optimization. As long as the efficiency of the self-built library is close to that of OpenSSL, I am satisfied, but the code should be as concise and easy to understand as possible, not as complicated as OpenSSL or GMP. The C language is used for programming. For some key points, consider using inline assembly for optimization.

 

★Content of this series of blog posts

This series of blog posts mainly introduces the implementation of the big integer algorithm, shares some programming experiences, and introduces a little theory behind the algorithm.

 

★References

Handbook of Applied Cryptography (HAC)

BigNum Math-Implementing Cryptographic Multiple Precision Arithmetic

OpenSSL

PolarSSL

LibTomMath

 

★End

This big integer database started construction in early 2014 and took about half a year to complete. It is now complete, although it may be somewhat inadequate compared with other databases, however, I spent a lot of effort on it, so I decided to write some blogs to share some of my experiences.

 

To facilitate reading, sort out the following directories of this series of blog posts:

01. Expression of large integers and related definitions

02. Basic operations (maintaining algorithms)

03. Comparison

04. Bit setting operation

05. Shift operation

06. Absolute value addition

07. Absolute Value Subtraction

08. Signed addition and subtraction

09. Comba Multiplication

10. Karatsuba Multiplication

11. Signed Multiplication

12. Comba Square

13. Karatsuba Square

14. Signed Square

15. Division with Remainder

To be continued ........

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.