CN108243002A - Mould about subtracts method, apparatus, equipment and computer readable storage medium - Google Patents

Mould about subtracts method, apparatus, equipment and computer readable storage medium Download PDF

Info

Publication number
CN108243002A
CN108243002A CN201810026230.3A CN201810026230A CN108243002A CN 108243002 A CN108243002 A CN 108243002A CN 201810026230 A CN201810026230 A CN 201810026230A CN 108243002 A CN108243002 A CN 108243002A
Authority
CN
China
Prior art keywords
operand
end value
value
subtracts
mould
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810026230.3A
Other languages
Chinese (zh)
Other versions
CN108243002B (en
Inventor
胡湘宏
熊晓明
张盛仕
郑欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong University of Technology
Original Assignee
Guangdong University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong University of Technology filed Critical Guangdong University of Technology
Priority to CN201810026230.3A priority Critical patent/CN108243002B/en
Publication of CN108243002A publication Critical patent/CN108243002A/en
Application granted granted Critical
Publication of CN108243002B publication Critical patent/CN108243002B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3066Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy involving algebraic varieties, e.g. elliptic or hyper-elliptic curves

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Physics & Mathematics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Algebra (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

The invention discloses a kind of moulds about to subtract method, apparatus, equipment and computer readable storage medium, first operand is added 0 to complement to 512 and obtains second operand by the present invention, the first end value is calculated by reduction algorithm in second operand, then the first end value is added 0 to complement to 288 and obtains third operand, the second end value is calculated by reduction algorithm in third operand, judge whether the second end value is less than predetermined threshold value, if so, the second end value of output;It obtains third end value if it is not, the second end value then is subtracted predetermined threshold value and exports third end value.The result that the present invention exports after reduction algorithm twice only needs to subtract the primary or maximum value without subtracting operable numberical range specified in SM2 Encryption Algorithm, need to subtract the maximum value many times in compared with prior art, present invention substantially reduces the numbers for subtracting the maximum value, it shortens and calculates the time, improve the speed that mould about subtracts.

Description

Mould about subtracts method, apparatus, equipment and computer readable storage medium
Technical field
The present invention relates to Encryption Algorithm technical fields, about subtract method more particularly to a kind of mould.The invention further relates to one kind Mould about subtracts device, equipment and computer readable storage medium.
Background technology
SM2 Encryption Algorithm is the commercial cipher algorithm formulated by China national Password Management office, and SM2 Encryption Algorithm is based on ECC (Elliptic Curve Cryptosystem, elliptic curve cryptosystem) algorithm is transformed, SM2 Encryption Algorithm it is close Key length is 256.At present, China is just being widelyd popularize in commercial cipher field using SM2 series commercial cipher algorithms.
There are many factors needed to be considered, in SM2 Encryption Algorithm, the length of input data in realization for SM2 Encryption Algorithm Degree must be 256, in two data it is possible that the data length of output result is more than 256 after point multiplication operation is carried out The problem of, in order to meet the operation rule of SM2 Encryption Algorithm, it is therefore desirable to carry out mould to data of the data length more than 256 About subtract operation, it is exactly that the first operand that mould about subtracts will be needed about to be subtracted to obtain a data length and approach that mould, which about subtracts operation, The first operand of 256, then again by the first operand in numberical range operable specified in SM2 Encryption Algorithm Maximum value (256 first operands) modulus obtain as a result, i.e. with this data length close to 256 first operation Number constantly subtracts this maximum value, until result is less than the maximum value.Mould about subtracts after operation about subtracted in the prior art As a result data length and 256 also have certain gap, therefore need when modulo operation is carried out to subtract the secondary of maximum value Number can it is relatively more, cause calculating the time it is long, the calculating speed that entire mould about subtracts operation is slow.
Therefore, how to provide a kind of fireballing mould about to subtract method, apparatus, equipment and computer readable storage medium is this Field technology personnel's problem to be solved.
Invention content
The object of the present invention is to provide a kind of moulds about to subtract method, can improve the speed that mould about subtracts;The present invention's is another Purpose is to provide a kind of mould including the above method and about subtracts device, equipment and computer readable storage medium, can also improve The speed that mould about subtracts.
In order to solve the above technical problems, the present invention provides a kind of moulds about to subtract method, including:
Receive the first operand that pending mould about subtracts;
The addition 0 before the first operand highest order is until the first operand reaches 512 and obtains the second behaviour It counts;
The first end value is calculated by reduction algorithm in the second operand;
The addition 0 before the first end value highest order is until first end value reaches 288 and obtains third behaviour It counts;
The second end value is calculated by the reduction algorithm in the third operand;
Judge whether second end value is less than predetermined threshold value, if so, output second end value;If it is not, then Second end value is subtracted the predetermined threshold value to obtain third end value and export the third end value;
Wherein, the predetermined threshold value is the maximum value specified in SM2 Encryption Algorithm in operable numberical range.
Preferably, the process that the second operand is calculated to the first end value by reduction algorithm is specifically wrapped It includes:
The second operand step-by-step is split into the 4th operand of 16 32;
By the 4th operand and the 5th operand of 0 composition 14 256;
5th operand is obtained into first end value by add operation and subtraction.
Preferably, it is described to have the third operand by the process that the second end value is calculated in the reduction algorithm Body includes:
The third operand step-by-step is split into the 6th operand of 9 32;
By the 6th operand and the 7th operand of 0 composition 3 256;
7th operand is obtained into the second end value by add operation and subtraction.
In order to solve the above-mentioned technical problem, the present invention also provides a kind of moulds about to subtract device, including:
Receiving unit, for receiving the first operand that pending mould about subtracts;
First processing units, for the addition 0 before the first operand highest order until the first operand reaches 512 and obtain second operand;
First about subtracts unit, for the second operand to be calculated the first end value by reduction algorithm;
Second processing unit, for the addition 0 before the first end value highest order until first end value reaches 288 and obtain third operand;
Second about subtracts unit, for the third operand to be calculated the second end value by the reduction algorithm;
Third processing unit, for judging whether second end value is less than predetermined threshold value, if so, output described the Two end values;It obtains third end value if it is not, second end value then is subtracted the predetermined threshold value and exports the third End value;
Wherein, the predetermined threshold value is the maximum value specified in SM2 Encryption Algorithm in operable numberical range.
Preferably, described first about subtracts unit and includes:
First split cells, for the second operand step-by-step to be split into the 4th operand of 16 32;
First assembled unit, for the 4th operand and 0 to be formed to the 5th operand of 14 256;
First arithmetic element, for the 5th operand to be obtained described first by add operation and subtraction End value.
Preferably, described second about subtracts unit and includes:
Second split cells, for the third operand step-by-step to be split into the 6th operand of 9 32;
Second assembled unit, for the 6th operand and 0 to be formed to the 7th operand of 3 256;
Second arithmetic element, it is final for the 7th operand to be obtained second by add operation and subtraction Value.
In order to solve the above-mentioned technical problem, about reduced the present invention also provides a kind of mould it is standby, including:
Memory, for storing computer program;
Processor realizes that mould described in any one of the above embodiments such as about subtracts the step of method during for performing the computer program Suddenly.
In order to solve the above-mentioned technical problem, the present invention also provides a kind of computer readable storage medium, the computers Computer program is stored on readable storage medium storing program for executing, is realized when the computer program is executed by processor such as any of the above-described institute The mould stated about subtracts the step of method.
A kind of mould provided by the invention about subtracts method, apparatus, equipment and computer readable storage medium, and the present invention is first When operand is less than 512, it would be desirable to it carries out the first operand that mould about subtracts and adds 0 to complement to 512 and obtain second operand, The first end value is calculated by reduction algorithm in second operand, then when the first end value is less than 288, by first End value adds 0 to complement to 288 and obtains third operand, and third operand is calculated second finally by reduction algorithm Value, judges whether the second end value is less than predetermined threshold value, which is operable numerical value model specified in SM2 Encryption Algorithm Interior maximum value is enclosed, if so, the second end value of explanation is meets operand as defined in SM2 Encryption Algorithm;If it is not, then by second End value subtracts predetermined threshold value and obtains third end value, and third end value is meets operand as defined in SM2 Encryption Algorithm.This hair The bright result exported after reduction algorithm twice is only needed to subtract primary or can be grasped specified in SM2 Encryption Algorithm without subtracting Make the maximum value of numberical range, compared with prior art in need to subtract the maximum value many times, present invention substantially reduces subtract this The number of maximum value shortens and calculates the time, improves the speed that mould about subtracts.
Description of the drawings
It to describe the technical solutions in the embodiments of the present invention more clearly, below will be to institute in the prior art and embodiment Attached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the present invention Example, for those of ordinary skill in the art, without creative efforts, can also obtain according to these attached drawings Obtain other attached drawings.
Fig. 1 is the flow chart that a kind of mould provided by the invention about subtracts method;
Fig. 2 is the structure diagram that a kind of mould provided by the invention about subtracts device.
Specific embodiment
The core of the present invention is to provide a kind of mould and about subtracts method, can improve the speed that mould about subtracts;The present invention's is another Core is to provide a kind of mould including the above method and about subtracts device, equipment and computer readable storage medium, can also improve The speed that mould about subtracts.
Purpose, technical scheme and advantage to make the embodiment of the present invention are clearer, below in conjunction with the embodiment of the present invention In attached drawing, the technical solution in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is Part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art All other embodiments obtained without making creative work shall fall within the protection scope of the present invention.
The present invention provides a kind of moulds about to subtract method, and as shown in FIG. 1, FIG. 1 is a kind of moulds provided by the invention about to subtract method Flow chart, this method includes the following steps:
Step S1:Receive the first operand that pending mould about subtracts.
It should be noted that it is one that the maximum value that operable numerical value is defined in SM2 Encryption Algorithm, which is prime field P, P, The binary number of 256, concrete numerical value can be written as 2256-2224-296+264- 1 form, in SM2 Encryption Algorithm into During row point multiplication operation, obtained result may be more than P, therefore the value more than P needs progress mould about to reduce to the value less than P, this In first operand be in SM2 Encryption Algorithm be more than P value.
Step S2:The addition 0 before first operand highest order is until first operand reaches 512 and obtains the second operation Number.
It should be noted that the result maximum that two P are multiplied in SM2 Encryption Algorithm does not exceed 512, while in order to accord with Close the operating characteristic of thirty-two bit computer, it would be desirable to carry out the first operand that mould about subtracts and be standardized to meeting computer operation The number of characteristic, i.e., before the highest order of first operand plus 0 until first operand reach 512, the operand of 512 For second operand, 0 digit that can change first operand is added before the highest order of first operand, will not be changed The numerical value of first operand.
Step S3:The first end value is calculated by reduction algorithm in second operand.
It should be noted that second operand is the binary number of 512, pass through reduction algorithm, second operation of 512 Number can about reduce to digit approximately no more than the binary number of 260, which is the first end value, and first is final The concrete numerical value of value is about 0~15P.
Step S4:The addition 0 before the first end value highest order is until the first end value reaches 288 and obtains third operation Number.
It should be noted that since the first end value obtained after being calculated by first time reduction algorithm does not exceed 260 Position, and for the estimated performance for meeting thirty-two bit computer needs the digit by the first end value to complement to distance 260 nearest 32 multiple adds 0 until the digit of the first end value reaches 288 that is, before the highest order of the first end value, this 288 The binary number of position is third operand, and the first end value can be changed by adding 0 before the highest order of the first end value Digit will not change the numerical value of the first end value.
Step S5:The second end value is calculated by reduction algorithm in third operand.
It should be noted that third operand is the binary number of 288, pass through reduction algorithm, the third operation of 512 Number can about reduce to the binary number of 256 or so, which is the second end value, the specific number of the second end value Value is about 0~2P, and the maximum value P of the second end value and numberical range operable in SM2 Encryption Algorithm is sufficiently close to.
Step S6:Judge whether the second end value is less than predetermined threshold value, if so, S7 is entered step, if it is not, then entering step S8。
Step S7:Export the second end value.
Step S8:Second end value is subtracted predetermined threshold value to obtain third end value and export third end value.
It should be noted that since the range of the second end value is about 0~2P, it is therefore desirable to judge that the second end value is It is no about to reduce in SM2 Encryption Algorithm in operable numberical range, that is, judge whether the second end value is less than predetermined threshold value, wherein, Predetermined threshold value is the maximum value P specified in SM2 Encryption Algorithm in operable numberical range, if so, the second end value of explanation Numerical value within 0~P, met the range of operable numerical value in SM2 Encryption Algorithm, exported the second end value at this time i.e. Can, if it is not, the numerical value for then illustrating the second end value, at this point, the second end value is subtracted predetermined threshold value P, obtains within 1P~2P To third end value of the numberical range within 0~P, and export third end value.Second end value subtracts the behaviour of P Make to be operation of second end value to P modulus, the second end value and third end value are all to meet the operation of SM2 Encryption Algorithm Number.
As preference, the process that second operand is calculated to the first end value by reduction algorithm specifically includes:
Second operand step-by-step is split into the 4th operand of 16 32;
By the 4th operand and the 5th operand of 0 composition 14 256;
5th operand is obtained into the first end value by add operation and subtraction.
It should be noted that when carrying out about subtracting operation for the first time, need the second operand of 512 according to every 32 For unit, the 4th operand of 16 32 is split into from a high position to low level, such as:Split after obtain c15, c14 ..., c1 And c0 this 16 32 the 4th operand.Then by this 16 32 the 4th operand and 0 (note:Include herein below Be used for recombination 0, the 0 all referring to 32 of narration) it is recombinated according to the rule of reduction algorithm, obtain 14 256 5th operand, such as:Obtained after recombination s14, s15 ..., s2 and s1 this 14 256 the 5th operand, wherein with s1 For, s1 is recombinated by the 4th operand of 8 32, s1 be followed successively by from a high position to low level c7, c6, c5, c4, c3, c2, C1 and c0.Detailed regrouping process is as follows:
S1={ c7, c6, c5, c4, c3, c2, c1, c0 }
S2={ c15,0,0,0,0,0,0,0 }
S3={ c12,0, c15, c14,0,0,0, c13 }
S4={ c13,0,0,0,0,0, c14, c15 }
S5=c14, and 0,0,0, c13,0, c15, c14 }
S6={ c8, c11, c13, c15, c14,0, c9, c10 }
S7={ c9, c14, c10, c13, c8,0, c11, c12 }
S8={ c10, c15, c14, c12, c11,0, c13, c8 }
S9={ c11,0,0, c9, c12,0, c10, c9 }
S10={ 0,0,0,0, c15,0, c12, c11 }
S11={ 0,0,0,0,0, c8,0,0 }
S12={ 0,0,0,0,0, c9,0,0 }
S13={ 0,0,0,0,0, c13,0,0 }
S14={ 0,0,0,0,0, c14,0,0 }
This 14 256 the 5th operand is subjected to 14 sub-addition operations and 4 times according to the relational expression in reduction algorithm Subtraction obtains the first end value R1, and physical relationship formula is as follows:
R1=s1+s2+s2+s2+s3+s3+s4+s4+s5+s5+s6+s7+s8+s9+s10-s11-s12-s13-s14
Wherein, s1, s2 ..., s14 be the 5th operand of 14 256.R1 is the number in the range of 0~15P.
Preferably, the process that third operand is calculated to the second end value by reduction algorithm specifically includes:
Third operand step-by-step is split into the 6th operand of 9 32;
By the 6th operand and the 7th operand of 0 composition 3 256;
7th operand is obtained into the second end value by add operation and subtraction.
It should be noted that when about being subtracted operation for the second time, need the third operand of 288 according to every 32 For unit, the 6th operand of 9 32 is split into from a high position to low level, such as:Split after obtain d8, d7 ..., d1 and This 9 32 the 6th operand of d0.Then this 9 32 the 6th operand and 0 are carried out according to the rule of reduction algorithm Recombination, obtains the 7th operand of 3 256, such as:The 7th operation of r1, r2 and r3 tri- 256 is obtained after recombination Number, wherein, by taking r1 as an example, r1 by 8 32 the 7th groups of operands into, be followed successively by from a high position to low level d7, d6, d5, d4, d3、d2、d1、d0.Detailed regrouping process is as follows:
R1={ d7, d6, d5, d4, d3, d2, d1, d0 }
R2={ d8,0,0,0, d8,0,0, d8 }
R3={ 0,0,0,0,0, d8,0,0 }
This 3 256 the 7th operand is subjected to 1 sub-addition operation according to the relational expression in reduction algorithm and is subtracted for 1 time Method operation obtains the second end value R2, and physical relationship formula is as follows:
R2=r1+r2-r3, wherein, r1, r2, r3 are the 7th operand of 3 256, and R2 is the number in the range of 0~2P.
It is understood that in SM2 Encryption Algorithm, it is believed that the fractionation and combination of operand are not need to the time , the operand needs after middle progress about subtracts for the first time compared with the prior art, which subtract P many times, (averagely to be needed to subtract 7 time, the worst feelings Condition needs to subtract 14 time), the operand that mould reduction algorithm provided by the invention is obtained after Fast Modular about subtracts in first time only need into One sub-addition of row and a subtraction can be obtained by the second end value of 0~2P, and the second end value only needs to subtract 1 time P, therefore big The big number for reducing calculating, accelerates the speed that mould about subtracts.
A kind of mould provided by the invention about subtracts method, and the present invention is when first operand is less than 512, it would be desirable to carry out mould The first operand about subtracted adds 0 to complement to 512 and obtains second operand, and second operand is calculated by reduction algorithm To the first end value, then when the first end value is less than 288, the first end value is added 0 to complement to 288 and obtains third The second end value is calculated by reduction algorithm in third operand by operand, and it is default to judge whether the second end value is less than Threshold value, which is the maximum value specified in SM2 Encryption Algorithm in operable numberical range, if so, explanation second End value is meets operand as defined in SM2 Encryption Algorithm;If it is not, the second end value then is subtracted predetermined threshold value obtains third most Final value, third end value is meets operand as defined in SM2 Encryption Algorithm.The knot that the present invention exports after reduction algorithm twice Fruit only needs to subtract the primary or maximum value without subtracting operable numberical range specified in SM2 Encryption Algorithm, compared to existing Need to subtract the maximum value many times in technology, present invention substantially reduces the numbers for subtracting the maximum value, shorten and calculate the time, Improve the speed that mould about subtracts.
The present invention also provides a kind of moulds about to subtract device, as shown in Fig. 2, Fig. 2 about subtracts dress for a kind of mould provided by the invention The structure diagram put, the device include:
Receiving unit, for receiving the first operand that pending mould about subtracts;
First processing units, for the addition 0 before first operand highest order until first operand reaches 512 and obtains To second operand;
First about subtracts unit, for second operand to be calculated the first end value by reduction algorithm;
Second processing unit, for the addition 0 before the first end value highest order until the first end value reaches 288 and obtains To third operand;
Second about subtracts unit, for third operand to be calculated the second end value by reduction algorithm;
Third processing unit, for judging whether the second end value is less than predetermined threshold value, if so, output second is final Value;It obtains third end value if it is not, the second end value then is subtracted predetermined threshold value and exports third end value;
Wherein, predetermined threshold value is the maximum value specified in SM2 Encryption Algorithm in operable numberical range.
Preferably, first about subtracts unit and includes:
First split cells, for second operand step-by-step to be split into the 4th operand of 16 32;
First assembled unit, for the 4th operand and 0 to be formed to the 5th operand of 14 256;
First arithmetic element, for the 5th operand to be obtained the first end value by add operation and subtraction.
Preferably, second about subtracts unit and includes:
Second split cells, for third operand step-by-step to be split into the 6th operand of 9 32;
Second assembled unit, for the 6th operand and 0 to be formed to the 7th operand of 3 256;
Second arithmetic element, for the 7th operand to be obtained the second end value by add operation and subtraction.
A kind of mould provided by the invention about subtracts device, and the present invention is when first operand is less than 512, it would be desirable to carry out mould The first operand about subtracted adds 0 to complement to 512 and obtains second operand, and second operand is calculated by reduction algorithm To the first end value, then when the first end value is less than 288, the first end value is added 0 to complement to 288 and obtains third The second end value is calculated by reduction algorithm in third operand by operand, and it is default to judge whether the second end value is less than Threshold value, which is the maximum value specified in SM2 Encryption Algorithm in operable numberical range, if so, explanation second End value is meets operand as defined in SM2 Encryption Algorithm;If it is not, the second end value then is subtracted predetermined threshold value obtains third most Final value, third end value is meets operand as defined in SM2 Encryption Algorithm.The knot that the present invention exports after reduction algorithm twice Fruit only needs to subtract the primary or maximum value without subtracting operable numberical range specified in SM2 Encryption Algorithm, compared to existing Need to subtract the maximum value many times in technology, present invention substantially reduces the numbers for subtracting the maximum value, shorten and calculate the time, Improve the speed that mould about subtracts.
About reduced the present invention also provides a kind of mould it is standby, including:
Memory, for storing computer program;
Processor realizes the step of mould such as any of the above-described about subtracts method during for performing computer program.
The present invention also provides a kind of computer readable storage medium, computer is stored on computer readable storage medium Program realizes the step of mould such as any of the above-described about subtracts method when computer program is executed by processor.
Standby and computer readable storage medium introduction is about reduced for a kind of mould provided by the invention and please refers to above-mentioned side Method embodiment, the present invention are not repeating herein.
About subtract method, apparatus, equipment and computer readable storage medium to a kind of mould provided by the present invention above to carry out It is discussed in detail.Specific case used herein is expounded the principle of the present invention and embodiment, above example Illustrate to be merely used to help understand method and its core concept of the invention.It should be pointed out that the common skill for the art For art personnel, without departing from the principle of the present invention, can also to the present invention some improvement and modification can also be carried out, these change It is also fallen within the protection scope of the claims of the present invention into modification.

Claims (8)

1. a kind of mould about subtracts method, which is characterized in that including:
Receive the first operand that pending mould about subtracts;
The addition 0 before the first operand highest order is until the first operand reaches 512 and obtains second operand;
The first end value is calculated by reduction algorithm in the second operand;
The addition 0 before the first end value highest order is until first end value reaches 288 and obtains third operand;
The second end value is calculated by the reduction algorithm in the third operand;
Judge whether second end value is less than predetermined threshold value, if so, output second end value;If it is not, then by institute It states the second end value and subtracts the predetermined threshold value and obtain third end value and export the third end value;
Wherein, the predetermined threshold value is the maximum value specified in SM2 Encryption Algorithm in operable numberical range.
2. mould according to claim 1 about subtracts method, which is characterized in that it is described by the second operand by about subtracting calculation The process that the first end value is calculated in method specifically includes:
The second operand step-by-step is split into the 4th operand of 16 32;
By the 4th operand and the 5th operand of 0 composition 14 256;
5th operand is obtained into first end value by add operation and subtraction.
3. mould according to claim 2 about subtracts method, which is characterized in that it is described by the third operand by it is described about It cuts algorithm and the process of the second end value is calculated specifically includes:
The third operand step-by-step is split into the 6th operand of 9 32;
By the 6th operand and the 7th operand of 0 composition 3 256;
7th operand is obtained into the second end value by add operation and subtraction.
4. a kind of mould about subtracts device, which is characterized in that including:
Receiving unit, for receiving the first operand that pending mould about subtracts;
First processing units, for the addition 0 before the first operand highest order until the first operand reaches 512 And obtain second operand;
First about subtracts unit, for the second operand to be calculated the first end value by reduction algorithm;
Second processing unit, for the addition 0 before the first end value highest order until first end value reaches 288 And obtain third operand;
Second about subtracts unit, for the third operand to be calculated the second end value by the reduction algorithm;
Third processing unit, for judging whether second end value is less than predetermined threshold value, if so, output described second is most Final value;If it is not, then subtracting second end value, the predetermined threshold value obtains third end value and to export the third final Value;
Wherein, the predetermined threshold value is the maximum value specified in SM2 Encryption Algorithm in operable numberical range.
5. mould according to claim 4 about subtracts device, which is characterized in that described first, which about subtracts unit, includes:
First split cells, for the second operand step-by-step to be split into the 4th operand of 16 32;
First assembled unit, for the 4th operand and 0 to be formed to the 5th operand of 14 256;
First arithmetic element, it is final for the 5th operand to be obtained described first by add operation and subtraction Value.
6. mould according to claim 5 about subtracts device, which is characterized in that described second, which about subtracts unit, includes:
Second split cells, for the third operand step-by-step to be split into the 6th operand of 9 32;
Second assembled unit, for the 6th operand and 0 to be formed to the 7th operand of 3 256;
Second arithmetic element, for the 7th operand to be obtained the second end value by add operation and subtraction.
7. a kind of mould about reduces standby, which is characterized in that including:
Memory, for storing computer program;
Processor, for performing computer program when, realize that mould as described in any one of claims 1 to 3 about subtracts method Step.
8. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium Program, the computer program realize that mould as described in any one of claims 1 to 3 about subtracts the step of method when being executed by processor Suddenly.
CN201810026230.3A 2018-01-11 2018-01-11 Method, apparatus, device and computer readable storage medium for modular reduction Active CN108243002B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810026230.3A CN108243002B (en) 2018-01-11 2018-01-11 Method, apparatus, device and computer readable storage medium for modular reduction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810026230.3A CN108243002B (en) 2018-01-11 2018-01-11 Method, apparatus, device and computer readable storage medium for modular reduction

Publications (2)

Publication Number Publication Date
CN108243002A true CN108243002A (en) 2018-07-03
CN108243002B CN108243002B (en) 2021-03-16

Family

ID=62699533

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810026230.3A Active CN108243002B (en) 2018-01-11 2018-01-11 Method, apparatus, device and computer readable storage medium for modular reduction

Country Status (1)

Country Link
CN (1) CN108243002B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101763241A (en) * 2010-01-20 2010-06-30 西安电子科技大学 Large integer modular arithmetic device for realizing signature algorithm in ECC cryptosystem and modular method therefor
US8971528B2 (en) * 2013-01-29 2015-03-03 Certicom Corp. Modified elliptic curve signature algorithm for message recovery
CN107147495A (en) * 2017-05-25 2017-09-08 广东工业大学 Binary expands the implementation method of SM2 AESs on domain

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101763241A (en) * 2010-01-20 2010-06-30 西安电子科技大学 Large integer modular arithmetic device for realizing signature algorithm in ECC cryptosystem and modular method therefor
US8971528B2 (en) * 2013-01-29 2015-03-03 Certicom Corp. Modified elliptic curve signature algorithm for message recovery
CN107147495A (en) * 2017-05-25 2017-09-08 广东工业大学 Binary expands the implementation method of SM2 AESs on domain

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
邵梦丽: "国密SM2在SoPC上快速运算的研究和实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Also Published As

Publication number Publication date
CN108243002B (en) 2021-03-16

Similar Documents

Publication Publication Date Title
US8495093B2 (en) Multiway trie data structure that dynamically adjusts node sizes in a manner that reduces memory footprint and improves access speed
US8411855B1 (en) Size optimization for large elliptic curve cryptography scalar multiplication acceleration tables
Bernstein et al. On the correct use of the negation map in the Pollard rho method
CN103226461B (en) A kind of Montgomery modular multiplication method for circuit and circuit thereof
CN106681690A (en) Montgomery modular multiplication based data processing method, modular multiplication operation method and device
CN108768656B (en) Data verification method based on Hash algorithm
CN104917608B (en) A kind of method of the anti-power consumption attack of key
EP3570488A1 (en) Online/offline signature system and method based on multivariate cryptography
CN105786616B (en) EMS memory management process and system
CN108243002A (en) Mould about subtracts method, apparatus, equipment and computer readable storage medium
CN111970112B (en) Ether house deployment method and system based on ZYNQ heterogeneous computing platform
Basu A new parallel window-based implementation of the elliptic curve point multiplication in multi-core architectures
CN103580869B (en) A kind of CRT-RSA signature method and device
CN108347334A (en) The method for generating encryption key pair
CN106909339A (en) A kind of Galois field multiplier based on binary tree structure
CN102902510B (en) A kind of finite field inverter
CN108075889A (en) A kind of data transmission method and system for reducing encryption and decryption operation time complexity
Ma et al. Fast implementation for modular inversion and scalar multiplication in the elliptic curve cryptography
CN106844605A (en) Batch data logical process method and device
JP2007526513A (en) Method of element power or scalar multiplication
CN110399117A (en) A kind of mixing multiplication addition process method and device
Goundar et al. New strategy for doubling-free short addition-subtraction chain
CN104750457B (en) A kind of data processing method and device based on Montgomery Algorithm
CN109992242A (en) Operation method and device based on multiplier
CN104793997B (en) A kind of data processing equipment and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant