A large number decomposition method based on binary tree

Through the binary tree-based bit-by-bit discriminant traversal search strategy, the problem of insufficient speed and success of the existing large-number factor decomposition algorithm is solved, and the success and low complexity of factor decomposition in the RSA cryptographic system is realized, and it is suitable for RSA public keys. Security assessment of the cryptographic system.

CN115378596BActive Publication Date: 2024-12-06UNIT 63892 OF PLA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210994301.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-17
Publication Date
2024-12-06
Estimated Expiration
2042-08-17

AI Technical Summary

Technical Problem

The existing large number factor decomposition algorithms cannot meet actual needs in terms of speed and success, especially the security evaluation of RSA cryptographic algorithms, which leads to the gradual weakening of the difficulty of factor decomposition.

Method used

A bit-by-bit discriminant traversal search strategy based on binary tree is adopted, and the factor decomposition of large numbers T is constructed by constructing a binary tree, and the calculation amount is reduced to ensure the success of factor decomposition.

Benefits of technology

It realizes the success and low complexity of large-number factorization, and is suitable for security evaluation of RSA public key cryptography system, reducing the computing volume and storage requirements of traditional algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115378596B_ABST
    Figure CN115378596B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of information security and cryptography. The disclosed large number decomposition method based on a binary tree makes full use of the constraint relationship between the bits of the large number and the product factor, and adopts the method of binary tree path search to decompose the input large number into the product of two numbers, or judge whether the input large number is an odd prime number. The specific steps are as follows: 1: input the large number, 2: odd-even judgment, 3: odd number decomposition, 4: calculate and output the result. The present invention is different from the traditional large number decomposition method. It does not directly operate on the large number, and uses binary bits as operation units, which is more suitable for computer storage and operation. A binary tree is constructed from the lowest bit of the large number, and the product factor is traversed and searched through the growth, judgment, pruning and other operations of the binary tree. The method can significantly reduce the amount of operation and storage requirements, and can be used in the fields of public key system security assessment, cryptography technology research, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of information security and cryptography, and relates to a large number decomposition method based on a binary tree, which is suitable for scenarios requiring large number decomposition or prime number discrimination. Background Art

[0002] With the rapid development of communication technology, information exchange between people, people and machines, and machines and machines is becoming more and more frequent. More and more useful information is transmitted through communication networks, and the resulting information security issues such as eavesdropping and interference are becoming increasingly serious. In order to achieve confidential communication, various cryptographic algorithms based on cryptography have sprung up like mushrooms after a rain. The security of currently effective cryptographic algorithms is based on the assumption that some mathematical problems are difficult to solve, such as the RSA algorithm based on large number decomposition and the discrete logarithm algorithm. Among them, the RSA algorithm is the most widely used cryptographic algorithm and is also considered to be one of the best public key cryptographic algorithms.

[0003] The RSA cryptographic algorithm is a reversible public key cryptographic system. It is generally believed that the difficulty of cracking the RSA password is equivalent to the "factor decomposition of large numbers". At present, there is no effective mathematical method to completely solve the "factor decomposition of large numbers", so the RSA cryptographic algorithm is considered safe. In order to solve the "factor decomposition of large numbers", mathematicians have made many attempts. The more classic factor decomposition algorithms include trial division method, Fermat decomposition method, p-1 algorithm, Monte Carlo method, p+1 algorithm, Euler function method, continued fraction method, quadratic sieve method, number field sieve method, etc. Among them, some fast decomposition algorithms use the specific composition of large numbers to perform trial decomposition, which cannot guarantee the success of decomposition. Some algorithms can guarantee success, but the factor decomposition speed still cannot meet actual needs. However, it is undeniable that the difficulty of the "factor decomposition of large numbers" problem is becoming increasingly reduced due to the introduction of these algorithms, and the research on factor decomposition algorithms has extremely high research value and application value. Summary of the invention

[0004] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to propose a method for factoring large numbers, namely, a large number decomposition method based on a binary tree. The method adopts a traversal search strategy with bit-by-bit discrimination, which can ensure the success of factor decomposition and has low complexity. It can be used in fields such as security assessment of RSA public key cryptography system.

[0005] To achieve the above-mentioned purpose, the technical solution adopted by the present invention is:

[0006] A large number decomposition method based on a binary tree does not directly perform operations and judgments on the large number T. Instead, the large number T and factors X and Y are regarded as three bit sets with a constraint relationship between the bits. The bits are used as operation units, and a binary tree is constructed starting from the lowest bit of the large number T. Through operations such as growing, judging, and pruning the binary tree, the product factors X and Y of the large number T are traversed and searched, or whether the input large number is a prime number is judged;

[0007] The steps are as follows:

[0008] Step 1: Input a large number T: T must be a positive integer, expressed in binary;

[0009] Step 2: Odd-even determination: If the tail bit of the large number T is 0, T is an even number, and go to step (4); if the tail bit of the large number T is 1, T is an odd number, and go to step (3);

[0010] Step 3: Odd number decomposition: decompose the large number T into the product of two factors X and Y;

[0011] Step 3.1: Define the binary tree node parameters, including:

[0012] Last: records the pointer of the upper node;

[0013] t: records the remaining value of the large number T of the node at this level. The t of the lower node is equal to the t of the upper node shifted right by one position.

[0014] f0: process parameter when decomposing large numbers;

[0015] f1: process parameter when decomposing large numbers;

[0016] f2: process parameter when decomposing large numbers;

[0017] f3: process parameter when decomposing large numbers;

[0018] State: records the fork state of the node at this level. There are 8 states in total, which can be represented by a 3-bit binary number. The first bit is used to indicate whether both branches of the node at this level have been searched. When only one branch is searched, the first bit is 1, otherwise the first bit is 0. The middle bit is used to indicate two branch types. When the branch type is 1, the middle bit is 0, otherwise the middle bit is 1. The tail bit is used to indicate whether the binary tree enters the left branch or the right branch when growing. When entering the left branch, the tail bit is 0, otherwise the tail bit is 1.

[0019] nowFloor: records the level of the binary tree where the node of this level is located, and the source node is the first level;

[0020] Step 3.2: Initialize parameters:

[0021] Initialize the binary tree source node B1, where parameters Last = NULL, t = T>>1, f0 = 2, f1 = 1, f2 = 1, f3 = 0, nowFloor = 1 (NULL means there is no upper node, >> means right shift in bit operation), if the tail bit of t is 0, then State =

[000] 2 or State =

[001] 2, if the tail bit of t is 1, then State =

[010] 2 or State =

[011] 2 ([·]2 is the binary representation of the value, and the tail bit of the State parameter is determined by the search strategy adopted);

[0022] The maximum number of decomposition levels of a binary tree is equal to maxFloor The number of effective bits when representing a binary number, |·| means rounding in the negative direction;

[0023] Step 3.3: Binary tree growth:

[0024] According to the node B of this layer i The State parameter enters the lower node branch B of the binary tree i+1 , and according to node B i Calculate the parameter value of branch node B i+1 The parameter value before "=" is the value of node B. i+1 The parameter after "=" is the parameter of node B. i Parameters:

[0025] Branch Node B i+1 The parameter Last = B i ; t=t>>1; f0=f0<<1 (<<indicates left shift in bit operation); nowFloor=nowFloor+1;

[0026] Branch Node B i+1 The parameters f1, f2, f3 and node B i State parameters are related to:

[0027] If node B i State=

[000] 2 or

[100] 2, then f1=f0+f1, f2=f0+f2, f3=(f0+f1+f2+f3)>>1,

[0028] If node B i State=

[001] 2 or

[101] 2, then f1=f1, f2=f2, f3=f3>>1,

[0029] If node B i State=

[010] 2 or

[110] 2, then f1=f1, f2=f0+f2, f3=(f1+f3)>>1,

[0030] If node B i State=

[011] 2 or

[111] 2, then f1=f0+f1, f2=f2, f3=(f2+f3)>>1;

[0031] Branch Node B i+1 The parameter State and node B i+1 The parameters t and f3 are related:

[0032] If branch node B i+1 If the tail bits of the parameters t and f3 are the same, then State =

[000] 2 or State =

[001] 2 (the tail bits of the State parameter are determined by the search strategy used),

[0033] If branch node B i+1 If the tail bits of parameters t and f3 are different, then State =

[010] 2 or State =

[011] 2 (the tail bits of the State parameter are determined by the search strategy used);

[0034] When the binary tree grows, the node B at this level i The first and last bits of the parameter State are inverted, that is, 0 becomes 1, and 1 becomes 0;

[0035] Step 3.4: Determine whether the decomposition is complete or whether pruning is required;

[0036] If node B i If the parameter t>f3 and the node layer parameter nowFloor<maxFloor, go to step 3.3;

[0037] If node B i The parameter t = f3, then the decomposition is complete, go to step 4, the product factor

[0038] X=f1,Y=f2;

[0039] If node B i The parameter t>f3, the node layer parameter nowFloor≥maxFloor and

[0040] (t-f3)%f1==0 (% represents remainder operation), then the decomposition is completed, go to step 4, the product factor X=f1, Y=T÷f1;

[0041] If node B i The parameter t>f3, the node layer parameter nowFloor≥maxFloor and

[0042] (t-f3)%f2==0 (% represents remainder operation), then the decomposition is completed, go to step 4, the product factor X=f2, Y=T÷f2;

[0043] In other cases, perform pruning and go to step 3.5;

[0044] Step 3.5: Pruning and judging whether it is finished:

[0045] Delete the current branch node B i , and go to the upper node B i-1 ;

[0046] If the upper node B i-1 If the first bit of the state parameter State is 0 and the Last parameter is not NULL, go to step 3.5 and continue pruning;

[0047] If the upper node B i-1 If the first bit of the state parameter State is 1, go to step 3.3;

[0048] If the upper node B i-1 The first bit of the state parameter State is 0, and the Last parameter is NULL.

[0049] Then T is a prime number, and go to step 4 (multiplication factor X=1, Y=T).

[0050] Step 4: Calculate the decomposition results X, Y: If the input T is an even number, then the output is X=2, Y=T / 2; if the input T is a prime number, then the output is X=1, Y=T; if the input T is decomposed successfully, then the output is X=f1, Y=f2.

[0051] Due to the adoption of the above technical solution, the present invention has the following advantages:

[0052] The present invention is different from the traditional large number factor decomposition method. Instead, the large number T and the factors X and Y are regarded as three bit sets with a constraint relationship between the bits. A binary tree is constructed starting from the lowest bit of the large number T. Through the growth, discrimination, pruning and other operations of the binary tree, the multiplication factors X and Y of the large number T are searched. The present invention adopts a traversal search method. If the large number T has factors X and Y (X≠1, Y≠1), there must be at least one binary tree node that meets the requirements for successful decomposition, so the success of factor decomposition can be guaranteed. At the same time, the present invention uses binary bits as operation units, and uses shift, discrimination, addition and other operations in the factor decomposition process, which reduces the proportion of operations such as division and multiplication, can effectively reduce the amount of calculation and storage requirements, and can be used in the fields of RSA public key cryptographic system security assessment. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1It is a flowchart of the implementation of the large number decomposition method based on binary tree of the present invention.

[0054] Figure 2 It is an example diagram of a binary tree constructed according to the present invention. DETAILED DESCRIPTION

[0055] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Figure 1 , 2 It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0056] (1) Input the number to be decomposed T = 77, which is represented by binary as T = [1001101]2;

[0057] (2) Since the tail bit of T is 1, T is an odd number, and go to step (3);

[0058] (3) Initialize the binary tree source node B1, where parameters Last = NULL, t = T>>1 = [100110]2 = 38, f0 = 2, f1 = 1, f2 = 1, f3 = 0, nowFloor = 1, State =

[000] 2 (since the tail bit of t is 0, the search strategy is to search the left branch first); Then the maximum number of decomposition levels of the binary tree maxFloor=4;

[0059] (4) Enter the left branch B2 of the binary tree node B1, set the parameter State of the node B1 to

[101] 2 (the right branch of the node B1 has not been searched yet), then the parameter Last of the branch node B2 is Last=B1, t=t>>1=

[10011] 2=19, f0=f0<<1=4, f1=f0+f1=3, f2=f0+f2=3, f3=(f0+f1+f2+f3)>>1=2=

[10] 2, nowFloor=2, State=

[010] 2 (since the tail bits of the parameters t and f3 of the branch node B2 are different, the search strategy is to search the left branch first);

[0060] (5) Since the parameter t of branch node B2 is greater than f3 and nowFloor is less than maxFloor, binary tree growth is performed and the left branch B3 of binary tree node B2 is entered. The parameter State of node B2 is set to

[111] 2 (the right branch of node B2 has not been searched yet). Then the parameter Last of branch node B3 is: B2, t=t>>1=

[1001] 2=9, f0=f0<<1=8, f1=f1=3, f2=f0+f2=7, f3=(f1+f3)>>1=2=

[10] 2, State=

[010] 2 (since the tail bits of the parameters t and f3 of branch node B3 are different and the search strategy is to search the left branch first).

[0061] (6) Since the parameter t of branch node B3 is greater than f3 and nowFloor is less than maxFloor, binary tree growth is performed and the left branch B4 of binary tree node B3 is entered. The parameter State of node B3 is set to

[111] 2 (the right branch of node B3 has not been searched yet). Then the parameter Last of branch node B4 is: B3, t=t>>1=

[100] 2=4, f0=f0<<1=16, f1=f1=3, f2=f0+f2=15, f3=(f1+f3)>>1=2=

[10] 2, State=

[000] 2 (since the tail bits of the parameter t of branch node B4 and f3 are the same, the search strategy is to search the left branch first).

[0062] (7) Since the parameters of branch node B4 are t>f3, nowFloor==maxFloor, and (t-f3)%f1≠0, (t-f3)%f2≠0, pruning is performed and the previous node B3 is returned;

[0063] (6) Execute binary tree growth, enter the right branch B4 of binary tree node B3, set the parameter State of node B3 to

[010] 2 (both branches of node B3 have been searched), then the parameter Last of branch node B4 is Last=B3, t=t>>1=

[100] 2=4, f0=f0<<1=16, f1=f0+f1=11, f2=f2=7, f3=(f2+f3)>>1=4=

[100] 2, State=

[000] 2 (since the tail bits of parameter t of branch node B4 and f3 are the same, the search strategy is to search the left branch first);

[0064] (7) Since t==f3, the decomposition is completed, and the multiplication factors of T are X=f1=11, Y=f2=7.

Claims

1. A large number decomposition method based on a binary tree, used in the field of RSA public key cryptography security assessment, characterized by: The following steps are involved: Step 1: Input a large number T, which must be a positive integer expressed in binary; Step 2: Parity determination: if the tail bit of the large number T is 0, then T is an even number, and go to step (4); if the tail bit of the large number T is 1, then T is an odd number, and go to step (3); Step 3: Odd number decomposition. First, initialize the parameters, and then decompose the odd number T by searching the binary tree path. When all paths in the binary tree are pruned, the input T is a prime number. When a path in the binary tree meets the decomposition condition, the input T can be decomposed into the product of two odd numbers. Step 4: Calculate and output the results X, Y. If the input T is an even number, then output X=2, Y=T / 2; if the input T is a prime number, then output X=1, Y=T; if the input T is decomposed successfully, then output the product factors X, Y according to the binary tree node parameters; The method of binary tree path search described in step 3 is used to decompose the odd number T, and the implementation steps are as follows: Step 3.1: Define the binary tree node parameters, including: Last: records the upper node; t: records the remaining value of the large number T of the node at this level. The t of the lower node is equal to the t of the upper node shifted right by one position. f0: process parameter when decomposing large numbers; f1: process parameter when decomposing large numbers; f2: process parameter when decomposing large numbers; f3: process parameter when decomposing large numbers; State: records the fork state of the node at this layer. There are 8 states in total, represented by 3-bit binary numbers. The first bit is used to indicate whether both branches of the node at this layer have been searched. If only one branch has been searched, the first bit is 1, otherwise the first bit is 0. The middle bit is used to indicate two branch types. When the branch type is 1, the middle bit is 0, otherwise the middle bit is 1. The tail bit is used to indicate whether the binary tree enters the left branch or the right branch when growing. When entering the left branch, the tail bit is 0, otherwise the tail bit is 1. nowFloor: records the level of the binary tree where the node of this level is located, and the source node is the first level; Step 3.2: Initialize parameters: Initialize the binary tree source node B1, where parameters Last = NULL, t = T>>1, f0 = 2, f1 = 1, f2 = 1, f3 = 0, nowFloor = 1; NULL means there is no upper node, and >> means right shift in bit operation; If the tail bit of t is 0, then State = [000]2 or State = [001]2; if the tail bit of t is 1, then State = [010]2 or State = [011]2; [·]2 is the binary representation of the value, and the tail bit of the State parameter is determined by the search strategy adopted; The maximum number of decomposition levels of a binary tree is equal to maxFloor The number of binary bits; |·| means rounding in the negative direction; Step 3.3: Binary tree growth: According to the node B of this layer i The State parameter generates the lower node branch B of the binary tree i+1 , and according to node B i Calculate the parameter value of branch node B i+1 The parameter value of node B. i+1 The parameter after "=" is the parameter of node B. i Parameters: Branch Node B i+1 The parameter Last = B i ; t=t>>1; f0=f0<<1, <<indicates left shift in bit operation; nowFloor=nowFloor+1; Branch Node B i+1 The parameters f1, f2, f3 and node B i State parameters are related to: If node B i State=[000]2 or [100]2, then f1=f0+f1, f2=f0+f2, f3=(f0+f1+f2+f3)>>1; If node B i State=[001]2 or [101]2, then f1=f1, f2=f2, f3=f3>>1; If node B i State=[010]2 or [110]2, then f1=f1, f2=f0+f2, f3=(f1+f3)>>1; If node B i State=[011]2 or [111]2, then f1=f0+f1, f2=f2, f3=(f2+f3)>>1; Branch Node B i+1 The parameters of State and node B i+1 The parameters t and f3 are related: If branch node B i+1 The tail bits of parameter t and f3 are the same, then node B i+1 State = [000] 2 or State = [001] 2, the tail bit of the State parameter is determined by the search strategy used; If branch node B i+1 The tail bits of parameters t and f3 are different, then node B i+1 State = [010] 2 or State = [011] 2, the tail bit of the State parameter is determined by the search strategy adopted; When the binary tree grows, the node B at this level i The first and last bits of the parameter State are inverted, that is, 0 becomes 1, and 1 becomes 0; Step 3.4: Determine whether the decomposition is complete or whether pruning is required; If node B i If the parameter t>f3, and the number of node layers nowFloor<maxFloor, go to step 3.3; If node B i The parameter t = f3, then the decomposition is complete, go to step 4, the product factors X = f1, Y = f2; If node B i The parameter t>f3, the node layer parameter nowFloor≥maxFloor and (t-f3)%f1==0; then the decomposition is completed, go to step 4, the product factor X=f1, Y=T÷f1, % represents the remainder operation; If node B i If the parameter t>f3, the node layer parameter nowFloor≥maxFloor and (t-f3)%f2==0, the decomposition is completed, and go to step 4, the product factor X=f2, Y=T÷f2, % represents the remainder operation; In other cases, perform pruning and go to step 3.5; Step 3.5: Pruning and determining whether it is finished: Delete the current branch node B i , and go to the upper node B i-1 ; If the upper node B i-1 If the first bit of the state parameter State is 0 and the Last parameter is not NULL, go to step 3.5 and continue pruning; If the upper node B i-1 If the first bit of the state parameter State is 1, go to step 3.3; if the upper node B i-1 If the first bit of the state parameter State is 0 and the Last parameter is NULL, then T is a prime number, and go to step 4, the multiplication factor X=1, Y=T.