Digital signature method and device, storage medium and electronic equipment

By disaggrating the target message and processing the Hanming weights, replacing the modulo inverse operation, the problem of long-term signature of the elliptic curve cryptography algorithm is solved, and the effect of improving signature efficiency is achieved.

CN119519994AInactive Publication Date: 2025-02-25SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510091959.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-02-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The elliptic curve cipher algorithm takes a long time during the signature process, mainly due to the time consumption of modulo inverse operations.

Method used

By discretizing the target messages to be signed, N sub-messages are obtained, and these sub-messages are processed using the initialized parameter set to obtain the Hamming weight of each sub-message. Then, these Hamming weights are used to sign the sub-messages in place of traditional modular inverse operations.

Benefits of technology

It effectively reduces the time consumption during the signature process, improves the signature efficiency, and avoids the problem of long-term mode inverse operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119519994A_ABST
    Figure CN119519994A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a digital signature method and device, a storage medium and electronic equipment, and the method comprises the steps: carrying out the discretization of a to-be-signed target message, and obtaining N sub-messages, N being an integer greater than 1; processing each sub-message through the initialized parameter set to obtain a Hamming weight of each sub-message; and signing each sub-message by using the Hamming weight to obtain N signature results of the N sub-messages, and determining the N signature results as a target signature result of the target message. According to the invention, the method solves a problem that the signature of an elliptic curve cryptographic algorithm in the prior art consumes much time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a digital signature method and device, a storage medium, and an electronic device. Background Art

[0002] As a research focus in public key cryptography, the elliptic curve cryptography (ECC) algorithm has been proven to have great advantages in performance and security, and has been widely used in many fields.

[0003] The full name of the SM2 algorithm is the SM2 elliptic curve public key cryptography algorithm, which is the most widely used signature scheme in ECC. In 2016, SM2 became China's national cryptographic standard. In the commercial cryptographic system, SM2 is mainly used to replace the RSA encryption algorithm. The national SM2 algorithm is also based on the elliptic curve public key algorithm. The operations on the elliptic curve are the same as the international algorithm. The recommended curve is given in the national SM2 specification, so the national recommended parameters need to be loaded first. The algorithm basis of the national SM2 is the elliptic curve. When calculating the output signature, a modular inverse operation is required. Since at least one inversion operation must be performed in the multiplication operation, and the modular inversion operation takes 10 times the time of the multiplication operation, the signature time is mainly caused by the inversion operation.

[0004] There is currently no effective solution to the above problems. Summary of the invention

[0005] The embodiments of the present application provide a digital signature method and device, a storage medium and an electronic device to at least solve the problem that the signature of the elliptic curve cryptography algorithm in the related art is time-consuming.

[0006] According to one embodiment of the present application, a digital signature method is provided, comprising: discretizing a target message to be signed to obtain N sub-messages, wherein N is an integer greater than 1; processing each of the sub-messages through an initialized parameter set to obtain a Hamming weight of each of the sub-messages; signing each of the sub-messages using the Hamming weight to obtain N signature results of the N sub-messages, and determining the N signature results as the target signature result of the target message.

[0007] In an exemplary embodiment, the parameter set includes: a finite field, a curve equation on the finite field, a horizontal coordinate coefficient and a constant term of the curve equation, an Abelian group formed by points on the curve equation, an order q of the Abelian group, and a base point of the Abelian group, and the processing of each of the sub-messages through the initialized parameter set to obtain the Hamming weight of each of the sub-messages includes: obtaining an identity identifier and a length of the identity identifier of a target account; splicing the identity identifier, the length of the identity identifier, the horizontal coordinate coefficient a, the constant term, and the horizontal coordinate of a first coordinate point randomly selected on the curve equation, the vertical coordinate of the first coordinate point, the horizontal coordinate of the base point, and the vertical coordinate of the base point to obtain a first splicing result; and processing each of the sub-messages through the first splicing result to obtain the Hamming weight of each of the sub-messages.

[0008] In an exemplary embodiment, each of the sub-messages is processed through the first splicing result to obtain the Hamming weight of each of the sub-messages, including: performing a hash operation on the first splicing result to obtain a first hash value; splicing the first hash value with each of the sub-messages to obtain N second splicing results; and obtaining the Hamming weight of each of the sub-messages through the N second splicing results.

[0009] In an exemplary embodiment, the Hamming weight of each of the sub-messages is obtained through N second splicing results, including: performing a hash operation on the i-th second splicing result to obtain a second hash value, wherein i is an integer less than N, the i-th second splicing result is the splicing result of the i-th sub-message and the first hash value, the N second splicing results include the i-th second splicing result, and the N sub-messages include the i-th sub-message; when the second hash value is a binary number, the number of the first preset value in the second hash value is determined as the Hamming weight of the i-th sub-message.

[0010] In an exemplary embodiment, each of the sub-messages is signed using the Hamming weight to obtain N signature results for the N sub-messages, including: obtaining a first signature of the i-th sub-message through the Hamming weight of the i-th sub-message, wherein the signature result of the i-th sub-message includes the first signature.

[0011] In an exemplary embodiment, before obtaining the first signature of the i-th sub-message through the Hamming weight of the i-th sub-message, the method further includes: randomly selecting a first numerical value between a second preset value and q-1; determining the product of the first numerical value and the first coordinate point as a second coordinate point; and determining the second signature of each of the i-th sub-messages according to the second coordinate point, wherein the signature result of the i-th sub-message includes the second signature.

[0012] In an exemplary embodiment, determining the second signature of each of the i-th sub-messages based on the second coordinate point includes: determining the modulus value between the horizontal coordinate of the second coordinate point and the order q of the Abelian group as the second signature of the i-th sub-message.

[0013] In an exemplary embodiment, obtaining the first signature of the i-th sub-message through the Hamming weight of the i-th sub-message includes: obtaining the first signature of the i-th sub-message through the Hamming weight of the i-th sub-message and the second signature of the i-th sub-message.

[0014] In an exemplary embodiment, obtaining the first signature of the i-th sub-message by using the Hamming weight of the i-th sub-message and the second signature of the i-th sub-message includes: randomly selecting a second numerical value between the second preset value and q-1; obtaining the first signature of the i-th sub-message by using the second numerical value, the Hamming weight of the i-th sub-message and the second signature of the i-th sub-message.

[0015] In an exemplary embodiment, obtaining the first signature of the i-th sub-message by using the second value, the Hamming weight of the i-th sub-message, and the second signature of the i-th sub-message includes:

[0016] The first signature of the i-th sub-message is obtained by the following formula:

[0017]

[0018] in, is the second value, is the Hamming weight of the ith sub-message, is the second signature of the i-th sub-message, is the order of the Abelian group, is a modulo operation, is the first signature of the i-th sub-message.

[0019] In an exemplary embodiment, the method further includes: randomly selecting a third value between the second preset value and q-1, wherein the sum of the second value and the third value is equal to the first value; and determining the third value as the third signature of the i-th sub-message.

[0020] In an exemplary embodiment, the target message to be signed is discretized to obtain N sub-messages, including:

[0021] The length of the target message is not In the case of, the target message is completed to The padded target message is obtained by calculating the length of the padded target message, wherein n is an integer greater than or equal to 1; and the padded target message is discretized into binary to obtain the N sub-messages.

[0022] In an exemplary embodiment, the method further comprises: determining each of the sub-messages as a fourth signature of each of the sub-messages.

[0023] According to another embodiment of the present application, a method for verifying a digital signature is provided, including: obtaining a target signature result of a target message, wherein the target signature result includes N signature results, N is an integer greater than 1, the target message is discretized into N sub-messages, and each of the signature results is a signature result obtained by signing a corresponding sub-message; determining whether the target message has been tampered with based on the target signature result.

[0024] In an exemplary embodiment, determining whether the target message has been tampered with based on the target signature result includes: determining whether the second signature, the third signature, and the fourth signature in the signature results of each of the sub-messages belong to a second preset value and q-1, wherein q is the order of an initialized parameter set Abelian group, and the parameter set includes: a finite field, a curve equation on the finite field, the abscissa coefficient and a constant term of the curve equation, the points on the curve equation constitute the Abelian group, and the base point of the Abelian group; in the event that the second signature, the third signature, and the fourth signature in the signature results of each of the sub-messages do not belong to the second preset value and q-1, it is determined that the target message has been tampered with.

[0025] In an exemplary embodiment, the method further includes: when the second signature, the third signature and the fourth signature in the signature results of each of the sub-messages belong to the second preset value and q-1, determining whether the target message has been tampered with according to the N signature results.

[0026] In an exemplary embodiment, determining whether the target message has been tampered with based on the N signature results includes: obtaining N first parameter values ​​based on N first signatures, N third signatures, and N fourth signatures among the N signature results; obtaining N second parameter values ​​based on N fourth signatures of the N signature results and the second signatures of the N signature results; and determining whether the target message has been tampered with based on the N first parameter values ​​and the N second parameter values.

[0027] In an exemplary embodiment, obtaining N first parameter values ​​according to N first signatures, N third signatures, and N fourth signatures in the N signature results includes: obtaining the i-th first parameter value by the following formula:

[0028]

[0029] in, is the i-th first parameter value, is the first signature in the i-th signature result, is the third signature in the i-th signature result, is the fourth signature in the i-th signature result, is the order of the abelian group.

[0030] In an exemplary embodiment, N second parameter values ​​are obtained based on the N fourth signatures of the N signature results and the second signature of the N signature results, including: obtaining N Hamming weights based on the N fourth signatures of the N signature results; and obtaining N second parameter values ​​through the N Hamming weights and the second signature.

[0031] In an exemplary embodiment, N Hamming weights are obtained based on N fourth signatures of the N signature results, including: obtaining an identity identifier and a length of the identity identifier of a target account; splicing the identity identifier, the length of the identity identifier, the horizontal coordinate coefficient, the constant term, and the horizontal coordinate of a first coordinate point randomly selected on the curve equation, the vertical coordinate of the first coordinate point, the horizontal coordinate of the base point, and the vertical coordinate of the base point to obtain a first splicing result; and processing the N fourth signatures through the first splicing result to obtain the N Hamming weights.

[0032] In an exemplary embodiment, the N fourth signatures are processed through the first splicing result to obtain the N Hamming weights, including: performing a hash operation on the first splicing result to obtain a first hash value; splicing the first hash value with the N fourth signatures respectively to obtain N second splicing results; and obtaining each of the N Hamming weights through the N second splicing results.

[0033] In an exemplary embodiment, obtaining each of the N Hamming weights through N second splicing results includes: performing a hash operation on the i-th second splicing result to obtain a second hash value, wherein i is an integer less than or equal to N, the i-th second splicing result is the splicing result of the i-th fourth signature and the first hash value, the N second splicing results include the i-th second splicing result, and the N second splicing results include the i-th second splicing result; when the second hash value is a binary number, the number of the first preset value in the second hash value is determined as the i-th Hamming weight, and the N Hamming weights include the i-th Hamming weight.

[0034] In an exemplary embodiment, obtaining N second parameter values ​​by using the N Hamming weights and the second signature includes: obtaining the i-th second parameter value by using the following formula:

[0035]

[0036] in, is the i-th second parameter value, is the second signature, is the order of the Abelian group, It is a modulo operation.

[0037] In an exemplary embodiment, determining whether the target message has been tampered with based on the N first parameter values ​​and the N second parameter values ​​includes: determining a target parameter value based on the N first parameter values ​​and the N second parameter values; when the target parameter value is equal to the second signature, determining that the target message has not been tampered with; when the target parameter value is not equal to the second signature, determining that the target message has been tampered with.

[0038] In an exemplary embodiment, determining a target parameter value according to the N first parameter values ​​and the N second parameter values ​​includes: obtaining the target parameter value by the following formula:

[0039]

[0040] in, is the i-th first parameter value, is the i-th second parameter value, A first coordinate point is randomly selected on the curve equation, is the second coordinate point obtained by multiplying the first value by the first coordinate point, the first value is a value randomly selected between the second preset value and q-1, is the order of the Abelian group, It is a modulo operation.

[0041] According to another embodiment of the present application, a digital signature device is provided, including: a discretization module, used to discretize a target message to be signed to obtain N sub-messages, wherein N is an integer greater than 1; a processing module, used to process each of the sub-messages through an initialized parameter set to obtain a Hamming weight of each of the sub-messages; a signing module, used to sign each of the sub-messages using the Hamming weight to obtain N signature results of the N sub-messages, and determine the N signature results as the target signature result of the target message.

[0042] According to another embodiment of the present application, a device for verifying a digital signature is provided, including: an acquisition module, used to obtain a target signature result of a target message, wherein the target signature result includes N signature results, N is an integer greater than 1, and the target message is discretized into N sub-messages, each of the signature results is a signature result obtained by signing a corresponding sub-message; a determination module, used to determine whether the target message has been tampered with based on the target signature result.

[0043] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0044] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0045] Through the present application, the target message to be signed is discretized to obtain N sub-messages, where N is an integer greater than 1; each sub-message is processed by an initialized parameter set to obtain the Hamming weight of each sub-message; each sub-message is signed using the Hamming weight to obtain N signature results of the N sub-messages, and the N signature results are determined as the target signature results of the target message. Since the Hamming weight replaces the hash value of the message, the problem of long modular inverse operation time is avoided. Therefore, the problem of long signature time of the elliptic curve cryptographic algorithm in the related art can be solved, and the effect of improving the signature efficiency can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 It is a hardware structure block diagram of a server device of a digital signature method in an embodiment of the present application;

[0047] Figure 2 is a flow chart of a digital signature method according to an embodiment of the present application;

[0048] Figure 3 It is a structural block diagram of a digital signature device according to an embodiment of the present application. DETAILED DESCRIPTION

[0049] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0050] Definitions of Acronyms and Key Terms:

[0051] Fq: A finite field containing q elements.

[0052] a,b: elements in Fq, which define an elliptic curve E on Fq.

[0053] d: The private key used by the user.

[0054] e: The output value of the cryptographic hash function applied to the message M.

[0055] e`: The output value of the cryptographic hash function applied to the message M.

[0056] G: A base point on the elliptic curve, whose order is a prime number.

[0057] Hv(): A cryptographic hash function with a message digest length of v bits.

[0058] IDA: User A's distinguishable identifier.

[0059] M: Message to be signed.

[0060] M`: Message to be verified.

[0061] n: the order of the base point G.

[0062] mod n: modulo n operation.

[0063] P: User public key.

[0064] ZA: A hash value of the user A’s identifiable identifier, some elliptic curve system parameters, and the user A’s public key.

[0065] (r,s): The signature sent.

[0066] (r′ ,s′ ): received signature.

[0067] Karatsuba algorithm:

[0068] The idea is to split the two multipliers into two (assuming each half of the digit is n / 2). For multiplication of large numbers, the split can be:

[0069]

[0070]

[0071]

[0072] remember , , but:

[0073]

[0074] Also know: , so the entire large number multiplication can be reduced to just calculating the multiplication and as well as Next, recursively split the multiplication in each of the above factors until the maximum bit width m supported by the hardware is met. If the existing hardware supports data processing bit width of 32, taking the most common SM2 key length of 256 as an example, the large number needs to be split 256->128->64->32. After 4 recursive splits, the maximum computing bit width of the hardware can be reached, and and This can be done with the help of shift operations.

[0075] So it can be seen that for the above example , directly multiplying its complexity ; If Karatsuba fast multiplication is used, according to the main theorem, the complexity is reduced to , greatly reducing the computing cost and improving the response speed.

[0076] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0077] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a digital signature method in an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0078] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the digital signature method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0079] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0080] In this embodiment, a digital signature method is provided. Figure 2 is a flow chart of a digital signature method according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:

[0081] Step S202, discretizing the target message to be signed to obtain N sub-messages, where N is an integer greater than 1;

[0082] The target message to be signed is m. Specifically, when the length of the target message m is not In the case of , fill the target message to The padded target message is obtained by calculating the length of the padded target message, where n is an integer greater than or equal to 1; the padded target message is discretized into binary format to obtain N sub-messages M i , , N is less than or equal to n.

[0083] Step S204, processing each of the sub-messages using the initialized parameter set to obtain a Hamming weight of each of the sub-messages;

[0084] Specifically, the parameter set includes: finite field F p , the curve square defined on a finite field , a is the coefficient of the abscissa of the curve equation, b is the constant term, p is a large prime number, the points on the curve equation form the Abelian group G, the order of the Abelian group is q, and the base point g of the Abelian group, the coordinates of the base point g are . is a v-bit hash function.

[0085] Specifically, the Hamming weight of each sub-message can be obtained in the following manner:

[0086] Get the target account's ID A and the length of the identity tag ENTL A ;

[0087] The identity ID A , the length of the identity tag ENTL A , the abscissa coefficient a, the constant term b, and the abscissa x of the first randomly selected coordinate point P on the curve equation p , the ordinate y of the first coordinate point p , the horizontal coordinate x of the base point g g and the ordinate y of the base point g Perform splicing to obtain a first splicing result;

[0088] Specifically, the first splicing result is (ENTL A ||ID A ||a||b||x p ||y p ||x g ||y g ), || is the concatenation symbol.

[0089] The Hamming weight of each sub-message is obtained by processing each sub-message according to the first concatenation result. Specifically, it includes:

[0090] The first concatenation result is subjected to a hash operation to obtain a first hash value; wherein the first hash value Z=H v (ENTL A ||ID A ||a||b||x p ||y p ||x g ||y g ).

[0091] Concatenate the first hash value with each of the sub-messages to obtain N second concatenation results;

[0092] Among them, taking the i-th sub-message as an example, i is an integer greater than or equal to 0 and less than N, the i-th sub-message is concatenated with the first hash value to obtain the second concatenation result of the i-th sub-message .

[0093] The Hamming weight of each of the sub-messages is obtained through the N second concatenation results.

[0094] Taking the calculation of the Hamming weight of the i-th sub-message as an example, the following steps are included:

[0095] Performing a hash operation on the i-th second concatenation result to obtain a second hash value, wherein i is an integer less than N, the i-th second concatenation result is a concatenation result of the i-th sub-message and the first hash value, the N second concatenation results include the i-th second concatenation result, and the N sub-messages include the i-th sub-message;

[0096] Among them, the hash value of the i-th second splicing result is .

[0097] In the case that the second Hash value is a binary number, the number of the first preset value in the second Hash value is determined as the Hamming weight of the i-th sub-message.

[0098] The Hamming weight is the number of symbols in a string that are different from the zero symbol (defined in the character set used). For a binary number, its Hamming weight is equal to the number of 1s (the first preset value). For example, the binary representation of '11' is '0000000000000000000000000000001011', so the Hamming weight of 11 is 3.

[0099] Step S206: Use the Hamming weight to sign each of the sub-messages to obtain N signature results of the N sub-messages, and determine the N signature results as the target signature results of the target message.

[0100] As an optional implementation manner, before obtaining the first signature of the i-th sub-message by using the Hamming weight of the i-th sub-message, the method further includes:

[0101] A first value is randomly selected between the second preset value and q-1; for example, the first value of the random number is selected as k, .

[0102] The product of the first value and the first coordinate point is determined as the second coordinate point; wherein the elliptic curve point is calculated , the second coordinate point is .

[0103] A second signature of each of the i-th sub-messages is determined according to the second coordinate point, wherein the signature result of the i-th sub-message includes the second signature.

[0104] Taking the example of obtaining the first signature of the i-th sub-message through the Hamming weight of the i-th sub-message, where the signature result of the i-th sub-message includes the first signature, including: determining the modulus value between the horizontal coordinate of the second coordinate point and the order q of the Abelian group as the second signature of the i-th sub-message.

[0105] Specifically, the second signature of the i-th sub-message is , It is a modulo operation.

[0106] Wherein, obtaining the first signature of the i-th sub-message according to the Hamming weight of the i-th sub-message includes:

[0107] The first signature of the i-th sub-message is obtained by using the Hamming weight of the i-th sub-message and the second signature of the i-th sub-message.

[0108] Specifically, the steps include:

[0109] Randomly select a second value between the second preset value and q-1;

[0110] The first signature of the i-th sub-message is obtained by using the second value, the Hamming weight of the i-th sub-message, and the second signature of the i-th sub-message.

[0111] The first signature of the i-th sub-message is obtained by the following formula:

[0112]

[0113] in, is the second value, is the Hamming weight of the ith sub-message, is the second signature of the i-th sub-message, is the order of the Abelian group, is a modulo operation, is the first signature of the i-th sub-message.

[0114] As an optional implementation, the signature result of the i-th sub-message also includes a third signature. Specifically, the third signature of the i-th sub-message can be obtained in the following manner:

[0115] A third value is randomly selected between the second preset value and q-1, wherein the sum of the second value and the third value is equal to the first value; and the third value is determined as the third signature of the i-th sub-message.

[0116] The second preset value is 1, and the third value selected randomly is , and satisfies .

[0117] As an optional implementation manner, each of the sub-messages is determined as a fourth signature of each of the sub-messages.

[0118] The signature result of the i-th sub-message is , It's the first signature. It is the second signature. It is the third signature. It is the fourth signature.

[0119] Through the above steps, when calculating the output signature, the Hamming weight is used to replace the hash value of the message, which avoids the modular inverse operation, reduces the signature time, and achieves the technical effect of improving the signature efficiency.

[0120] The execution subject of the above steps may be a server, a terminal, etc., but is not limited thereto.

[0121] The present application is described below by a specific embodiment:

[0122] In the key generation process, a complex multiplication operation is decomposed into multiple simple multiplication operations using large number fast multiplication, which can calculate the public key faster and more efficiently than traditional calculations. Then, the message to be encrypted is aligned to an integer multiple of the maximum processing length of the hardware, so that the sub-messages can be obtained according to binary discretization. Finally, when calculating the output signature, the Hamming weight is used to replace the hash value of the message to avoid modular inverse operations.

[0123] Improving the SM2 signature algorithm includes the following four steps:

[0124] Initialization: Enter safe parameters , the output parameters are combined into {p,Fp,a,b, G, G,q,Hv,H}, where p is a large prime number, F p is a finite field, in F p The elliptic curve equation is defined on , G is an Abelian group of points that satisfy the equation, q is the order of group G, g is the base point of group G, and its coordinates are , represents a hash function with an output of v bits;

[0125] Key generation: After given parameters, select a random number As a private key;

[0126] Calculated using the Karatsuba algorithm As the public key, output As a public-private key pair.

[0127] Signature Algorithm: Given a private key d and a target message m, the signer will perform the following steps:

[0128] Calculate the first splicing result , where ID A Is the user's identifiable identifier (the target account's identity identifier), ENTL A is ID A The length of the target message m is padded to 2 n long, so that it is easy to discretize M according to binary, and calculate the second concatenation result for each sub-message .

[0129] Calculate the second hash value and its Hamming weight .

[0130] Select the first value of a random number , calculate the elliptic curve point (second coordinate point);

[0131] calculate , r is the second signature.

[0132] The signer then randomly selects two integers , and satisfies , ;

[0133] Calculate the first signature ; Output signature .

[0134] According to an embodiment of the present application, a method for verifying a digital signature is provided, comprising the following steps:

[0135] Step S302, obtaining a target signature result of a target message, wherein the target signature result includes N signature results, where N is an integer greater than 1, the target message is discretized into N sub-messages, and each signature result is a signature result obtained by signing a corresponding sub-message;

[0136] Step S304: determine whether the target message has been tampered with according to the target signature result.

[0137] Wherein, determining whether the target message has been tampered with according to the target signature result includes:

[0138] Determine whether the second signature, the third signature, and the fourth signature in the signature results of each of the sub-messages belong to the second preset value and q-1, where q is the order of the initialized parameter set Abelian group, the parameter set including: a finite field, a curve equation on the finite field, a horizontal coordinate coefficient and a constant term of the curve equation, the points on the curve equation constitute the Abelian group, and a base point of the Abelian group;

[0139] If the second signature, the third signature, and the fourth signature in the signature results of each of the sub-messages do not belong to the second preset value and q-1, it is determined that the target message has been tampered with. The second preset value is 1.

[0140] The signature result of the i-th sub-message For example, check First check whether it is effective. Is it established? They are the second signature, the third signature and the fourth signature. If they are not true, it is determined that the target message has been tampered with.

[0141] When the second signature, the third signature and the fourth signature in the signature results of each of the sub-messages belong to the second preset value and q-1, it is determined whether the target message has been tampered with according to the N signature results.

[0142] Obtaining N first parameter values ​​according to the N first signatures, the N third signatures, and the N fourth signatures in the N signature results, including: obtaining the i-th first parameter value by the following formula:

[0143]

[0144] in, is the i-th first parameter value, is the first signature in the i-th signature result, is the third signature in the i-th signature result, is the fourth signature in the i-th signature result, is the order of the abelian group.

[0145] Obtaining N second parameter values ​​according to the N fourth signatures of the N signature results and the second signature of the N signature results, including: obtaining N Hamming weights according to the N fourth signatures of the N signature results; obtaining N second parameter values ​​through the N Hamming weights and the second signature, including:

[0146] The i-th second parameter value is obtained by the following formula:

[0147]

[0148] in, is the i-th second parameter value, is the second signature, is the order of the Abelian group, It is a modulo operation.

[0149] Wherein, N Hamming weights are obtained according to the N fourth signatures of the N signature results, including:

[0150] Obtaining the identity identifier of the target account and the length of the identity identifier; splicing the identity identifier, the length of the identity identifier, the abscissa coefficient a, the constant term b, and the abscissa of a first coordinate point randomly selected on the curve equation, the ordinate of the first coordinate point, the abscissa of the base point, and the ordinate of the base point to obtain a first splicing result; processing the N fourth signatures through the first splicing result to obtain the N Hamming weights, including:

[0151] Performing a hash operation on the first concatenation result to obtain a first hash value;

[0152] Concatenate the first hash value with the N fourth signatures respectively to obtain N second concatenation results;

[0153] Calculate the first splicing result , where ID A Is the user's identifiable identifier (the target account's identity identifier), ENTL A is ID A The length of the target message m is padded to 2 n long, so that it is easy to discretize M according to binary, and calculate the second concatenation result for each sub-message .

[0154] Obtaining each of the N Hamming weights through the N second splicing results includes:

[0155] Performing a hash operation on the i-th second splicing result to obtain a second hash value, wherein i is an integer less than or equal to N, the i-th second splicing result is the splicing result of the i-th fourth signature and the first hash value, the N second splicing results include the i-th second splicing result, and the N second splicing results include the i-th second splicing result;

[0156] Among them, the hash value of the i-th second splicing result is .

[0157] In the case where the second Hash value is a binary number, the number of the first preset value in the second Hash value is determined as the i-th Hamming weight, and the N Hamming weights include the i-th Hamming weight.

[0158] Determining whether the target message has been tampered with according to the N first parameter values ​​and the N second parameter values ​​includes:

[0159] The i-th second parameter value is obtained by the following formula:

[0160]

[0161] in, is the i-th second parameter value, is the second signature, is the order of the Abelian group, It is a modulo operation.

[0162] Determining whether the target message has been tampered with according to the N first parameter values ​​and the N second parameter values ​​includes:

[0163] Determine a target parameter value according to the N first parameter values ​​and the N second parameter values; obtain the target parameter value by the following formula:

[0164]

[0165] in, is the i-th first parameter value, is the i-th second parameter value, A first coordinate point is randomly selected on the curve equation, is the second coordinate point obtained by multiplying the first value by the first coordinate point, the first value is a value randomly selected between the second preset value and q-1, is the order of the Abelian group, It is a modulo operation.

[0166] When the target parameter value is equal to the second signature, that is, Determine that the target message has not been tampered with; and when the target parameter value is not equal to the second signature, determine that the target message has been tampered with.

[0167] The present invention is applicable to scenarios where the ECC algorithm is used for digital signatures. It innovatively uses large number fast multiplication to decompose a complex multiplication operation into multiple simple multiplication operations, and calculates the public key faster and more efficiently than traditional calculations. Based on this, the message to be encrypted is aligned to an integer multiple of the maximum processing length of the hardware, so that the sub-messages can be obtained according to binary discretization. And when calculating the output signature, the Hamming weight is used to replace the hash value of the message to avoid modular inverse operations. This improves the signature efficiency and the user experience of users using the ECC algorithm for signature verification.

[0168] The present invention utilizes fast multiplication in the key generation process to decompose a complex multiplication operation into multiple simple multiplication operations. Then, the message to be encrypted is aligned to an integer multiple of the maximum processing length of the hardware, so as to obtain sub-messages according to binary discretization. Finally, when calculating the output signature, the Hamming weight is used to replace the hash value of the message, avoiding the modular inverse operation.

[0169] The digital signature optimization algorithm without modular inverse calculation proposed in the present invention makes full use of hardware resources, shortens the calculation cycle by using large number fast multiplication, and avoids modular inverse operation by using Hamming weight to greatly reduce the calculation complexity.

[0170] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0171] In this embodiment, a digital signature device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0172] Figure 3 is a structural block diagram of a digital signature device according to an embodiment of the present application, such as Figure 3 As shown, the device includes: a discretization module 32, used to discretize the target message to be signed to obtain N sub-messages, wherein N is an integer greater than 1; a processing module 34, used to process each of the sub-messages through an initialized parameter set to obtain the Hamming weight of each of the sub-messages; a signature module 36, used to sign each of the sub-messages using the Hamming weight to obtain N signature results of the N sub-messages, and determine the N signature results as the target signature result of the target message.

[0173] In an exemplary embodiment, the parameter set includes: a finite field, a curve equation on the finite field, a horizontal coordinate coefficient and a constant term of the curve equation, an Abelian group formed by points on the curve equation, an order q of the Abelian group, and a base point of the Abelian group. The above-mentioned device is also used to obtain an identity identifier of a target account and the length of the identity identifier; splice the identity identifier, the length of the identity identifier, the horizontal coordinate coefficient a, the constant term b, and the horizontal coordinate of a first coordinate point randomly selected on the curve equation, the vertical coordinate of the first coordinate point, the horizontal coordinate of the base point, and the vertical coordinate of the base point to obtain a first splicing result; and process each of the sub-messages using the first splicing result to obtain the Hamming weight of each of the sub-messages.

[0174] In an exemplary embodiment, the above-mentioned device is also used to perform a hash operation on the first splicing result to obtain a first hash value; splice the first hash value with each of the sub-messages to obtain N second splicing results; and obtain the Hamming weight of each of the sub-messages through the N second splicing results.

[0175] In an exemplary embodiment, the above-mentioned device is also used to perform a hash operation on the i-th second splicing result to obtain a second hash value, wherein i is an integer less than N, the i-th second splicing result is the splicing result of the i-th sub-message and the first hash value, the N second splicing results include the i-th second splicing result, and the N sub-messages include the i-th sub-message; when the second hash value is a binary number, the number of the first preset value in the second hash value is determined as the Hamming weight of the i-th sub-message.

[0176] In an exemplary embodiment, the above-mentioned apparatus is further used to obtain a first signature of the i-th sub-message through the Hamming weight of the i-th sub-message, wherein the signature result of the i-th sub-message includes the first signature.

[0177] In an exemplary embodiment, the above-mentioned device is also used to randomly select a first numerical value between a second preset value and q-1 before obtaining the first signature of the i-th sub-message through the Hamming weight of the i-th sub-message; determine the product of the first numerical value and the first coordinate point as the second coordinate point; determine the second signature of each of the i-th sub-messages according to the second coordinate point, wherein the signature result of the i-th sub-message includes the second signature.

[0178] In an exemplary embodiment, the above-mentioned apparatus is further used to determine the modulus value between the horizontal coordinate of the second coordinate point and the order q of the Abelian group as the second signature of the i-th sub-message.

[0179] In an exemplary embodiment, the above-mentioned apparatus is further used to obtain the first signature of the i-th sub-message through the Hamming weight of the i-th sub-message and the second signature of the i-th sub-message.

[0180] In an exemplary embodiment, the above-mentioned device is also used to randomly select a second numerical value between the second preset value and q-1; obtain the first signature of the i-th sub-message through the second numerical value, the Hamming weight of the i-th sub-message and the second signature of the i-th sub-message.

[0181] In an exemplary embodiment, the apparatus is further configured to obtain the first signature of the i-th sub-message by using the following formula:

[0182]

[0183] in, is the second value, is the Hamming weight of the ith sub-message, is the second signature of the i-th sub-message, is the order of the Abelian group, is a modulo operation, is the first signature of the i-th sub-message.

[0184] In an exemplary embodiment, the above-mentioned device is also used to randomly select a third value between the second preset value and q-1, wherein the sum of the second value and the third value is equal to the first value; and determine the third value as the third signature of the i-th sub-message.

[0185] In an exemplary embodiment, the above device is also used for: In the case of, the target message is completed to The padded target message is obtained by calculating the length of the padded target message, wherein n is an integer greater than or equal to 1; and the padded target message is discretized into binary to obtain the N sub-messages.

[0186] In an exemplary embodiment, the apparatus is further configured to determine each of the sub-messages as a fourth signature of each of the sub-messages.

[0187] In this embodiment, a device for verifying a digital signature is also provided, including: an acquisition module, used to obtain a target signature result of a target message, wherein the target signature result includes N signature results, N is an integer greater than 1, and the target message is discretized into N sub-messages, each of the signature results is a signature result obtained by signing a corresponding sub-message; a determination module, used to determine whether the target message has been tampered with according to the target signature result.

[0188] In an exemplary embodiment, the above-mentioned device is also used to determine whether the second signature, the third signature and the fourth signature in the signature results of each of the sub-messages belong to the second preset value and q-1, wherein q is the order of the initialized parameter set Abelian group, and the parameter set includes: a finite field, a curve equation on the finite field, the horizontal coordinate coefficient and the constant term of the curve equation, the points on the curve equation constitute the Abelian group, and the base point of the Abelian group; if the second signature, the third signature and the fourth signature in the signature results of each of the sub-messages do not belong to the second preset value and q-1, it is determined that the target message has been tampered with.

[0189] In an exemplary embodiment, the above-mentioned device is also used to determine whether the target message has been tampered with according to the N signature results when the second signature, the third signature and the fourth signature in the signature results of each of the sub-messages belong to the second preset value and q-1.

[0190] In an exemplary embodiment, the above-mentioned device is also used to obtain N first parameter values ​​based on N first signatures, N third signatures, and N fourth signatures among the N signature results; obtain N second parameter values ​​based on the N fourth signatures of the N signature results and the second signature of the N signature results; and determine whether the target message has been tampered with based on the N first parameter values ​​and the N second parameter values.

[0191] In an exemplary embodiment, the above device is further used to obtain the i-th first parameter value by the following formula:

[0192]

[0193] in, is the i-th first parameter value, is the first signature in the i-th signature result, is the third signature in the i-th signature result, is the fourth signature in the i-th signature result, is the order of the abelian group.

[0194] In an exemplary embodiment, the above-mentioned device is also used to obtain N Hamming weights according to the N fourth signatures of the N signature results; and obtain N second parameter values ​​through the N Hamming weights and the second signature.

[0195] In an exemplary embodiment, the above-mentioned device is also used to obtain the identity identifier of the target account and the length of the identity identifier; splice the identity identifier, the length of the identity identifier, the horizontal coordinate coefficient a, the constant term b, and the horizontal coordinate of the first coordinate point randomly selected on the curve equation, the vertical coordinate of the first coordinate point, the horizontal coordinate of the base point and the vertical coordinate of the base point to obtain a first splicing result; and process the N fourth signatures through the first splicing result to obtain the N Hamming weights.

[0196] In an exemplary embodiment, the above-mentioned device is also used to perform a hash operation on the first splicing result to obtain a first hash value; splice the first hash value with N fourth signatures respectively to obtain N second splicing results; and obtain each of the N Hamming weights through the N second splicing results.

[0197] In an exemplary embodiment, the above-mentioned device is also used to perform a hash operation on the i-th second splicing result to obtain a second hash value, wherein i is an integer less than or equal to N, the i-th second splicing result is the splicing result of the i-th fourth signature and the first hash value, the N second splicing results include the i-th second splicing result, and the N second splicing results include the i-th second splicing result; when the second hash value is a binary number, the number of the first preset value in the second hash value is determined as the i-th Hamming weight, and the N Hamming weights include the i-th Hamming weight.

[0198] In an exemplary embodiment, the above device is further used to obtain the i-th second parameter value by the following formula:

[0199]

[0200] in, is the i-th second parameter value, is the second signature, is the order of the Abelian group, It is a modulo operation.

[0201] In an exemplary embodiment, the above-mentioned device is also used to determine a target parameter value based on the N first parameter values ​​and the N second parameter values; when the target parameter value is equal to the second signature, it is determined that the target message has not been tampered with; when the target parameter value is not equal to the second signature, it is determined that the target message has been tampered with.

[0202] In an exemplary embodiment, the above device is also used to obtain the target parameter value by the following formula:

[0203]

[0204] in, is the i-th first parameter value, is the i-th second parameter value, A first coordinate point is randomly selected on the curve equation, is the second coordinate point obtained by multiplying the first value by the first coordinate point, the first value is a value randomly selected between the second preset value and q-1, is the order of the Abelian group, It is a modulo operation.

[0205] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0206] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0207] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0208] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0209] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0210] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0211] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0212] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A digital signature method, characterized in that: include: Discretize the target message to be signed to obtain N sub-messages, where N is an integer greater than 1; Processing each of the sub-messages through an initialized parameter set to obtain a Hamming weight of each of the sub-messages; Each of the sub-messages is signed using the Hamming weight to obtain N signature results of the N sub-messages, and the N signature results are determined as the target signature results of the target message.

2. The method according to claim 1, characterized in that: The parameter set includes: a finite field, a curve equation on the finite field, a coefficient of the abscissa and a constant term of the curve equation, an Abelian group formed by points on the curve equation, an order q of the Abelian group, and a base point of the Abelian group, The step of processing each of the sub-messages by using the initialized parameter set to obtain the Hamming weight of each of the sub-messages includes: Obtain the identity identifier of the target account and the length of the identity identifier; The identity identifier, the length of the identity identifier, the abscissa coefficient, the constant term, the abscissa of a first coordinate point randomly selected on the curve equation, the ordinate of the first coordinate point, the abscissa of the base point, and the ordinate of the base point are spliced ​​to obtain a first splicing result; Each of the sub-messages is processed using the first concatenation result to obtain a Hamming weight of each of the sub-messages.

3. The method according to claim 2, characterized in that Processing each of the sub-messages according to the first concatenation result to obtain a Hamming weight of each of the sub-messages includes: Performing a hash operation on the first concatenation result to obtain a first hash value; Concatenate the first hash value with each of the sub-messages to obtain N second concatenation results; The Hamming weight of each of the sub-messages is obtained through the N second concatenation results.

4. The method according to claim 3, characterized in that: Obtaining the Hamming weight of each of the sub-messages through the N second concatenation results includes: Performing a hash operation on the i-th second concatenation result to obtain a second hash value, wherein i is an integer less than N, the i-th second concatenation result is a concatenation result of the i-th sub-message and the first hash value, the N second concatenation results include the i-th second concatenation result, and the N sub-messages include the i-th sub-message; In the case that the second Hash value is a binary number, the number of the first preset value in the second Hash value is determined as the Hamming weight of the i-th sub-message.

5. The method according to claim 4, characterized in that Signing each of the sub-messages using the Hamming weight to obtain N signature results of the N sub-messages, including: A first signature of the i-th sub-message is obtained through the Hamming weight of the i-th sub-message, wherein the signature result of the i-th sub-message includes the first signature.

6. The method according to claim 5, characterized in that Before obtaining the first signature of the i-th sub-message by using the Hamming weight of the i-th sub-message, the method further includes: Randomly select a first value between the second preset value and q-1; Determine the product of the first value and the first coordinate point as a second coordinate point; A second signature of each of the i-th sub-messages is determined according to the second coordinate point, wherein the signature result of the i-th sub-message includes the second signature.

7. The method according to claim 6, characterized in that Determining a second signature of each of the i-th sub-messages according to the second coordinate point includes: The modulo value between the abscissa of the second coordinate point and the order q of the Abelian group is determined as the second signature of the i-th sub-message.

8. The method according to claim 6 or 7, characterized in that: Obtaining a first signature of the i-th sub-message according to the Hamming weight of the i-th sub-message includes: The first signature of the i-th sub-message is obtained by using the Hamming weight of the i-th sub-message and the second signature of the i-th sub-message.

9. The method according to claim 8, characterized in that Obtaining a first signature of the i-th sub-message through the Hamming weight of the i-th sub-message and the second signature of the i-th sub-message includes: Randomly select a second value between the second preset value and q-1; The first signature of the i-th sub-message is obtained by using the second value, the Hamming weight of the i-th sub-message, and the second signature of the i-th sub-message.

10. The method according to claim 9, characterized in that Obtaining the first signature of the i-th sub-message by using the second value, the Hamming weight of the i-th sub-message, and the second signature of the i-th sub-message includes: The first signature of the i-th sub-message is obtained by the following formula: ; in, is the second value, is the Hamming weight of the ith sub-message, is the second signature of the i-th sub-message, is the order of the Abelian group, is a modulo operation, is the first signature of the i-th sub-message.

11. The method according to claim 9 or 10, characterized in that: The method further comprises: Randomly select a third value between the second preset value and q-1, wherein the sum of the second value and the third value is equal to the first value; The third value is determined as a third signature of the i-th sub-message.

12. The method according to claim 1, characterized in that The target message to be signed is discretized to obtain N sub-messages, including: The length of the target message is not In the case of, the target message is completed to , to obtain the padded target message, where n is an integer greater than or equal to 1; The padded target message is discretized in binary format to obtain the N sub-messages.

13. The method according to claim 1 or 12, characterized in that: The method further comprises: Each of the sub-messages is determined as a fourth signature of each of the sub-messages.

14. A method for verifying a digital signature, characterized in that: include: Obtain a target signature result of a target message, wherein the target signature result includes N signature results, where N is an integer greater than 1, the target message is discretized into N sub-messages, and each of the signature results is a signature result obtained by signing a corresponding sub-message; Determine whether the target message has been tampered with according to the target signature result.

15. The method according to claim 14, characterized in that Determining whether the target message has been tampered with according to the target signature result includes: Determine whether the second signature, the third signature, and the fourth signature in the signature results of each of the sub-messages belong to the second preset value and q-1, where q is the order of the Abelian group in the initialized parameter set, and the parameter set includes: a finite field, a curve equation on the finite field, a horizontal coordinate coefficient and a constant term of the curve equation, the points on the curve equation constitute the Abelian group, and a base point of the Abelian group; When there is a second signature, a third signature, and a fourth signature in the signature results of each of the sub-messages that does not belong to the second preset value and q-1, it is determined that the target message has been tampered with.

16. The method according to claim 15, characterized in that The method further comprises: When the second signature, the third signature and the fourth signature in the signature results of each of the sub-messages belong to the second preset value and q-1, it is determined whether the target message has been tampered with according to the N signature results.

17. The method according to claim 16, characterized in that Determining whether the target message has been tampered with according to the N signature results includes: Obtaining N first parameter values ​​according to the N first signatures, the N third signatures, and the N fourth signatures in the N signature results; Obtain N second parameter values ​​according to the N fourth signatures of the N signature results and the second signature of the N signature results; Determine whether the target message has been tampered with according to the N first parameter values ​​and the N second parameter values.

18. The method according to claim 17, characterized in that Obtaining N first parameter values ​​according to the N first signatures, the N third signatures, and the N fourth signatures in the N signature results, including: The i-th first parameter value is obtained by the following formula: ; in, is the i-th first parameter value, is the first signature in the i-th signature result, is the third signature in the i-th signature result, is the fourth signature in the i-th signature result, is the order of the abelian group.

19. The method according to claim 17, characterized in that Obtaining N second parameter values ​​according to the N fourth signatures of the N signature results and the second signature of the N signature results, including: Obtaining N Hamming weights according to the N fourth signatures of the N signature results; N second parameter values ​​are obtained by using the N Hamming weights and the second signature.

20. The method according to claim 19, characterized in that According to the N fourth signatures of the N signature results, N Hamming weights are obtained, including: Obtain the identity identifier of the target account and the length of the identity identifier; The identity identifier, the length of the identity identifier, the abscissa coefficient, the constant term, the abscissa of a first coordinate point randomly selected on the curve equation, the ordinate of the first coordinate point, the abscissa of the base point, and the ordinate of the base point are spliced ​​to obtain a first splicing result; The N fourth signatures are processed using the first concatenation results to obtain the N Hamming weights.

21. The method according to claim 20, characterized in that The N fourth signatures are processed by using the first concatenation result to obtain the N Hamming weights, including: Performing a hash operation on the first concatenation result to obtain a first hash value; Concatenate the first hash value with the N fourth signatures respectively to obtain N second concatenation results; The N Hamming weights are obtained through the N second splicing results.

22. The method according to claim 21, characterized in that Obtaining each of the N Hamming weights through the N second splicing results includes: Performing a hash operation on the i-th second splicing result to obtain a second hash value, wherein i is an integer less than or equal to N, the i-th second splicing result is the splicing result of the i-th fourth signature and the first hash value, the N second splicing results include the i-th second splicing result, and the N second splicing results include the i-th second splicing result; In the case where the second Hash value is a binary number, the number of the first preset value in the second Hash value is determined as the i-th Hamming weight, and the N Hamming weights include the i-th Hamming weight.

23. The method according to claim 19, characterized in that Obtaining N second parameter values ​​through the N Hamming weights and the second signature includes: The i-th second parameter value is obtained by the following formula: ; in, is the i-th second parameter value, is the second signature, is the order of the Abelian group, It is a modulo operation.

24. The method according to claim 17, characterized in that Determining whether the target message has been tampered with according to the N first parameter values ​​and the N second parameter values ​​includes: Determining a target parameter value according to the N first parameter values ​​and the N second parameter values; When the target parameter value is equal to the second signature, determining that the target message has not been tampered with; When the target parameter value is not equal to the second signature, it is determined that the target message has been tampered with.

25. The method according to claim 23, characterized in that Determining a target parameter value according to the N first parameter values ​​and the N second parameter values ​​includes: The target parameter value is obtained by the following formula: ; in, is the i-th first parameter value, is the i-th second parameter value, A first coordinate point is randomly selected on the curve equation, is the second coordinate point obtained by multiplying the first value by the first coordinate point, the first value is a value randomly selected between the second preset value and q-1, is the order of the Abelian group, It is a modulo operation.

26. A digital signature device, It is characterized in that include: A discretization module, used for discretizing the target message to be signed to obtain N sub-messages, where N is an integer greater than 1; A processing module, used for processing each of the sub-messages through an initialized parameter set to obtain a Hamming weight of each of the sub-messages; The signature module is used to sign each of the sub-messages using the Hamming weight to obtain N signature results of the N sub-messages, and determine the N signature results as the target signature results of the target message.

27. A device for verifying a digital signature, characterized in that: include: An acquisition module, used to acquire a target signature result of a target message, wherein the target signature result includes N signature results, N is an integer greater than 1, the target message is discretized into N sub-messages, and each of the signature results is a signature result obtained by signing a corresponding sub-message; A determination module is used to determine whether the target message has been tampered with according to the target signature result.

28. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the method described in any one of claims 1 to 13, or implements the steps of the method described in any one of claims 14-25.

29. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the processor implements the steps of the method described in any one of claims 1 to 13, or implements the steps of the method described in any one of claims 14-25.

30. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 13 are implemented, or the method described in any one of claims 14-25 is implemented.

Citation Information

Patent Citations

  • Method and system for generating signature of binary file content

    CN101408881A

  • Digital signature method based on collaborative ECC

    CN116346363A