Memory optimization method and device for digital signature, electronic equipment and storage medium

By splitting the public and private key matrices into sets or blocks of sub-matrices, key generation, signature generation, and signature verification can be efficiently performed in embedded chips, solving the problem of large memory consumption in multivariate cryptography and ensuring post-quantum security.

CN121644065APending Publication Date: 2026-03-10CHINA CONSTRUCTION BANK
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-04
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

The large size of public and private keys in multivariate cryptography results in a significant memory requirement for key generation, signing, and verification processes, making it unsuitable for use in embedded chips.

Method used

The public key matrix and private key matrix are split into sets of sub-matrices or blocks of sub-matrices, and key generation, signature generation and signature verification are performed in batches or blocks to reduce memory usage.

Benefits of technology

It reduces the memory overhead of the multivariate digital signature process, adapts to the limited memory resources of embedded chips, and ensures efficient execution of key generation, signing and verification, as well as post-quantum security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121644065A_ABST
    Figure CN121644065A_ABST
Patent Text Reader

Abstract

The invention discloses a memory optimization method and device for a digital signature, electronic equipment and a storage medium, and relates to the technical field of post-quantum security, and the method comprises the steps: determining a matrix unit according to a public key matrix and a private key matrix, and executing a target program based on the matrix unit. Wherein the public key matrix is used for generating public keys, and the private key matrix is used for generating private keys; the matrix unit is at least one of a sub-matrix set and sub-matrix blocks; the number of the sub-matrix sets is greater than the original number of sets formed by the public key matrixes and the private key matrixes; the number of elements of the sub-matrix blocks is smaller than the number of elements of the public key matrix or the private key matrix; the target program comprises at least one of key generation, signature generation and signature verification. By applying the technical scheme of the invention, the memory overhead during the operation of the multivariable digital signature can be effectively reduced, the limited memory resources of the embedded chip are adapted, the post-quantum security is ensured, and the efficient execution of key generation, signature and signature verification is ensured at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of post-quantum security, and particularly relates to a memory optimization method and device for digital signature, an electronic device and a storage medium. BACKGROUND

[0002] With the rapid development of quantum computing technology, traditional computing power is broken through, and the security of cryptography is also threatened. Therefore, post-quantum cryptography technology becomes the core response direction. Multivariate cryptography technology is often applied in digital signature because of its advantages in the digital signature scene.

[0003] The multivariate cryptography technology takes a multivariate polynomial as a public key, and generates a private key corresponding to the public key. When signing, the private key generates signature data that meets the public key constraint, and when verifying, the public key verifies the validity of the data. The core advantage is that the signature size is short and the signature verification speed is fast, which is suitable for scenes that require storage and efficiency. However, the public key and the private key of the above-mentioned multivariate cryptography technology have large sizes (such as the public key containing multiple sets of polynomial coefficients, and the private key storing reversible transformation information), which results in that a large amount of memory is occupied in the key generation, signature and signature verification processes. The memory resources of embedded chips are limited, which reduces the applicability of the multivariate cryptography technology. SUMMARY

[0004] Therefore, the present application provides a memory optimization method and device for digital signature, an electronic device and a storage medium to solve the problem of large memory overhead of multivariate cryptography.

[0005] In a first aspect, the present application provides a memory optimization method for digital signature, comprising the following steps: determining a matrix unit according to a public key matrix and a private key matrix; the public key matrix is used to generate a public key, and the private key matrix is used to generate a private key; the matrix unit is at least one of a sub-matrix set and a sub-matrix block; the number of the sub-matrix set is greater than the original number of a set composed of the public key matrix and the private key matrix; and the number of elements of the sub-matrix block is less than the number of elements of the public key matrix or the private key matrix; executing a target program based on the matrix unit, the target program including at least one of key generation, signature generation and signature verification.

[0006] In the above method, by dividing the batch of matrices into more batches or by the way of matrix block (uniformly represented as matrix unit), the memory storage overhead in the digital signature process can be reduced. When executing the target program such as key generation, signature generation and verification based on the matrix unit, the memory resource occupation can be reduced, which is suitable for memory limited scenes such as embedded devices and mobile devices. At the same time, the key security and signature operation integrity are guaranteed while the memory is optimized, which effectively improves the adaptability and execution efficiency of the digital signature technology in resource-constrained scenes.

[0007] Optionally, the sub-matrix set includes a first sub-matrix set and a second sub-matrix set; the determining the matrix unit according to the public key matrix and the private key matrix includes: splitting the public key matrix into the first sub-matrix set, and splitting the private key matrix into the second sub-matrix set; wherein the first sub-matrix set contains a first number of the public key matrix, and the second sub-matrix set contains a second number of the private key matrix; the sum of the first number and the second number is greater than a third number; the third number is the sum of the original number of the set composed of the public key matrix and the private key matrix.

[0008] Optionally, the executing the target program based on the matrix unit includes: in response to the executing the key generation, creating an initial random seed, the initial random seed including a first seed of the public key and a second seed of the private key; determining a first matrix based on the second seed, and determining a plurality of matrix pairs based on the first seed; determining the sub-matrix set according to the first matrix and the matrix pairs; the sub-matrix set includes the first sub-matrix set and the second sub-matrix set; and outputting the first sub-matrix set and the second sub-matrix set to obtain the public key and the private key stored in batches.

[0009] Optionally, the executing the target program based on the matrix unit includes: in response to the executing the signature generation, obtaining a target message; determining a first salt value based on the target message; concatenating the target message and the first salt value to obtain a first concatenation result; performing a hash operation on the first concatenation result to obtain a first vector; performing a first operation in batches based on the first vector and the second sub-matrix set to obtain a second vector; the first operation is a storage program and an operation program corresponding to the signature generation; and generating a digital signature of the target message according to the second vector and the first salt value.

[0010] Optionally, the executing the target program based on the matrix unit includes: in response to the executing the signature verification, obtaining a target message; determining a second salt value based on the target message; concatenating the target message and the second salt value to obtain a second concatenation result; performing a hash operation on the second concatenation result to obtain a third vector; performing a second operation in batches based on the first sub-matrix set to obtain a first target component; the second operation is a storage program and an operation program corresponding to the signature verification; and outputting a result of passing the verification if the corresponding components in the first target component and the third vector are consistent.

[0011] Optionally, the sub-matrix blocks include a first sub-matrix block and a second sub-matrix block; and the determining the matrix unit according to the public key matrix and the private key matrix includes: splitting the public key matrix into the first sub-matrix block and splitting the private key matrix into the second sub-matrix block; wherein the first sub-matrix block has a smaller number of elements than the public key matrix, and the second sub-matrix block has a smaller number of elements than the private key matrix.

[0012] Optionally, the executing the target program based on the matrix unit includes: in response to the key generation, creating an initial random seed, the initial random seed including a first seed of the public key and a second seed of the private key; determining a first block and a second block based on the second seed, and determining a third block and a fourth block based on the first seed; the first block and the second block belong to the second sub-matrix block, and the third block and the fourth block belong to the first sub-matrix block; the third block is composed of an upper triangular matrix by transverse and longitudinal splicing; and outputting the public key and the private key stored in the blocks according to the first block, the second block, the third block and the fourth block.

[0013] Optionally, the determining the public key and the private key stored in the blocks includes: determining the second sub-matrix block based on a sum of a transpose of the third block and the third block, the first block, the second block and the fourth block; and determining the first sub-matrix block based on the first block, a transpose of the second block, the third block and the fourth block.

[0014] Optionally, the executing the target program based on the matrix unit includes: in response to the signature generation, obtaining a target message; determining a third salt value based on the target message; splicing the target message and the third salt value to obtain a third splicing result; performing a hash operation on the third splicing result to obtain a fourth vector; performing a first operation based on the fourth vector and the second sub-matrix block to obtain a fifth vector; the first operation is a storage program and an operation program corresponding to the signature generation; and generating a digital signature of the target message according to the fifth vector and the third salt value.

[0015] Optionally, the executing the target program based on the matrix unit comprises: in response to the signature verification, obtaining a target message; determining a fourth salt value based on the target message; splicing the target message and the fourth salt value to obtain a fourth splicing result; performing a hash operation on the fourth splicing result to obtain a sixth vector; performing a second operation based on the first sub-matrix block to obtain a second target component; the second operation is a storage program and an operation program corresponding to the signature verification; and if the second target component is consistent with a corresponding component in the sixth vector, outputting a result of passing the verification.

[0016] In a second aspect, the present application provides a memory optimization device for digital signature, comprising: a processing unit configured to determine a matrix unit according to a public key matrix and a private key matrix; the public key matrix is used to generate a public key, and the private key matrix is used to generate a private key; the matrix unit is at least one of a sub-matrix set and a sub-matrix block; the number of the sub-matrix set is greater than the original number of a set composed of the public key matrix and the private key matrix; and the number of elements of the sub-matrix block is less than the number of elements of the public key matrix or the private key matrix; a digital signature unit configured to execute a target program based on the matrix unit, the target program comprising at least one of key generation, signature generation and signature verification.

[0017] In a third aspect, the present application provides an electronic device, comprising: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of the first aspect.

[0018] In a fourth aspect, the present application provides a non-transitory computer readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the method of the first aspect.

[0019] In a fifth aspect, the present application provides a computer program product comprising a computer program, wherein the computer program is executed by a processor to implement the method of the first aspect.

[0020] According to the technical scheme, the memory optimization method and device of the digital signature, the electronic device and the storage medium disclosed by the application relate to the post-quantum security technical field, the method determines a matrix unit according to a public key matrix and a private key matrix, and executes a target program based on the matrix unit. The public key matrix is used to generate a public key, and the private key matrix is used to generate a private key. The matrix unit is at least one of a sub-matrix set and a sub-matrix block. The number of the sub-matrix set is greater than the original number of a set composed of the public key matrix and the private key matrix. The number of elements of the sub-matrix block is less than the number of elements of the public key matrix or the private key matrix. The target program includes at least one of key generation, signature generation and signature verification. By applying the technical scheme of the application, the memory overhead of the multivariate digital signature during running can be effectively reduced, the limited memory resources of the embedded chip are adapted, the post-quantum security is ensured, and the efficient execution of key generation, signature and signature verification is ensured.

[0021] The above description is only a summary of the technical scheme of the application. In order to more clearly understand the technical means of the application, the application can be implemented according to the content of the specification, and in order to make the above and other purposes, characteristics and advantages of the application more obvious and easy to understand, the following specific embodiments of the application are described. BRIEF DESCRIPTION OF DRAWINGS

[0022] The drawings incorporated into the specification and forming part of the specification show embodiments consistent with the application and, together with the specification, serve to explain the principles of the application.

[0023] In order to more clearly illustrate the technical scheme in the embodiments of the application or the prior art, the drawings needed in the embodiment or the prior art description will be briefly introduced below. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor.

[0024] Figure 1 A flowchart of a memory optimization method of a digital signature provided by an embodiment of the application is shown; Figure 2 A flowchart of a key generation provided by an embodiment of the application is shown; Figure 3 A flowchart of a signature generation provided by an embodiment of the application is shown; Figure 4 A flowchart of a signature verification provided by an embodiment of the application is shown; Figure 5 Another flowchart of a key generation provided by an embodiment of the application is shown; Figure 6 Another flowchart of a signature generation provided by an embodiment of the application is shown; Figure 7 Fig. 2 shows a flow diagram of another signature verification method according to an embodiment of the present application; Figure 8 Fig. 3 shows a structure diagram of a memory optimization device for digital signature according to an embodiment of the present application; Figure 9 Fig. 4 shows a schematic block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0025] Embodiments of the present application will be described in more detail with reference to the drawings. It should be noted that the embodiments and features of the embodiments in the present application can be combined with each other if there is no conflict.

[0026] The embodiments of the present disclosure are not exhaustive, but only illustrate some embodiments, and are not specific limitations on the protection scope of the present disclosure. Each step in an embodiment can be implemented as an independent embodiment, and the steps can be combined arbitrarily, for example, the scheme after removing some steps in an embodiment can also be implemented as an independent embodiment, and the order of the steps in an embodiment can be arbitrarily exchanged, in addition, the optional implementation manners in an embodiment can be combined arbitrarily; in addition, the embodiments can be combined arbitrarily, for example, the steps of different embodiments or part of the steps of different embodiments can be combined arbitrarily, an embodiment can be combined with the optional implementation manners of other embodiments.

[0027] In the embodiments of the present disclosure, the terms and / or descriptions of the embodiments are consistent and can be referred to each other if there is no special description and logical conflict, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationship. The terms used in the embodiments of the present disclosure are only for the purpose of describing the specific embodiments, and not as a limitation on the present disclosure. In the embodiments of the present disclosure, unless otherwise specified and logically conflicted, the elements expressed in singular form, such as “one”, “a”, “the”, “above”, “said”, “preceding”, “this” and the like, can represent “one and only one”, or “one or more”, “at least one” and the like. For example, in the case of using articles such as “a”, “an”, “the” and the like in English, the noun after the article can be understood as singular expression, or can be understood as plural expression. In some embodiments, the terms “in response to”, “in response to determining”, “in the case of”, “when”, “when”, “if”, “if” and the like can be replaced with each other. In some embodiments, the terms "greater than", "greater than or equal to", "not less than", "more than", "more than or equal to", "not less than", "higher than", "higher than or equal to", "not lower than", "above", and the like can be replaced with each other, and the terms "less than", "less than or equal to", "not greater than", "fewer than", "fewer than or equal to", "not more than", "lower than", "lower than or equal to", "not higher than", "below", and the like can be replaced with each other. The prefix words "first", "second", and the like in the embodiments of the present disclosure are merely used to distinguish different description objects, and do not constitute limitation on the position, order, priority, quantity, or content of the description objects. The description of the description objects should refer to the description in the context of the claims or embodiments, and should not constitute redundant limitation because of the use of the prefix words.

[0028] In the embodiments of the present disclosure, "multiple" refers to two or more. In the embodiments of the present disclosure, the terms "import", "input", "read in", and the like can be replaced with each other.

[0029] In some embodiments, the apparatus and the like can be interpreted as entities, and can also be interpreted as virtual, and the names thereof are not limited to the names recorded in the embodiments. The terms "apparatus", "equipment", "device", "circuit", "network element", "node", "function", "unit", "section", "system", "network", "chip", "chip system", "entity", "subject", and the like can be replaced with each other.

[0030] The following explains the terms and elements involved in the present application.

[0031] The finite field is denoted as GF(q) , and the polynomial ring over the finite field is denoted as GF(q)[x] . .

[0032] The matrix set is denoted as , and the matrix is denoted as . In the memory, the matrix is stored as a vector in a row-major manner, for example, the first element of the first row of the matrix to the first element of the first row of the matrix .

[0033] The transpose matrix of the matrix is denoted as .

[0034] The operation is to transform the square matrix into an upper triangular matrix, and the upper triangular part of the matrix is equal to​​​ The upper triangular part.

[0035] Multivariate cryptography can be applied to digital signatures, offering advantages such as short signature size and fast verification speed. In some implementations, multivariate cryptography can be implemented using the Unbalanced Oil and Vinegar Scheme (UOV), which includes key generation, signature, and verification algorithms.

[0036] For example, with parameters as Let's take an example to illustrate.

[0037] The key generation algorithm includes the following steps S11-S16: S11. Generate a public and private key random seed. and .

[0038] S12, Extension , to obtain the matrix .

[0039] S13, Extension A batch of matrices were obtained. ,in It is an upper triangular matrix. .

[0040] S14. Calculate a batch of matrices related to the private key. , .

[0041] S15, Calculate and public key related matrices. .

[0042] S16, Output the public key private key .

[0043] Signature algorithm (private key) ,information This includes the following steps S21-S27: S21, Regarding the message Take a random salt value Perform hash operations ,get .

[0044] S22, Randomly select vectors Calculate the matrix , of which Behavior Vector .

[0045] S23, Judgment Matrix If it is reversible, then proceed to S22.

[0046] S24, Calculate vectors , of which the first Components .

[0047] S25. Solving linear equation systems .

[0048] S26, Calculate vectors .

[0049] S27, Order Output message signature .

[0050] Verification algorithm (message) ,sign Public key This includes the following steps S31-S32: S31, Regarding the message Perform hash operations ,get .

[0051] S32, If for all , and The first vector If the components are equal, the verification passes. If they are not equal, the verification fails.

[0052] However, the large size of the public and private keys in the aforementioned multivariate cryptography techniques leads to a significant memory requirement for key generation, signing, and verification, thus reducing the applicability of multivariate cryptography. For example, embedded chips have limited memory resources, making them unsuitable for the operation and storage of such multivariate cryptography.

[0053] To address the aforementioned issues, this application provides a memory optimization method for digital signatures, applicable to embedded chip devices, such as... Figure 1 As shown, it includes steps S101-S102.

[0054] S101. Determine the matrix elements based on the public key matrix and the private key matrix.

[0055] The public key matrix is ​​used to generate the public key, i.e., the public key-related matrix, and the private key matrix is ​​used to generate the private key, i.e., the private key-related matrix. Each matrix unit is at least one of a set of submatrices or a submatric block. The number of submatrices is greater than the original number of elements in the set formed by the public and private key matrices, and the number of elements in a submatric block is less than the number of elements in either the public or private key matrix.

[0056] Exemplarily, the matrix in batches of may be divided into matrices in batches of , and a total of matrices are stored and operated. For the sub-matrix block, the block matrix operation can be used to reduce the memory overhead during operation, that is, the small matrix after block is read into the memory during operation, rather than the entire matrix.

[0057] S102, executing the target program based on the matrix unit.

[0058] The target program is executed according to the above batch or block matrix unit, wherein the target program includes at least one of key generation, signature generation and signature verification. In this way, the memory overhead of multivariate digital signature runtime can be reduced, the limited memory resources of embedded chips can be adapted, and the deployment problem caused by the large public key or private key matrix of the original solution can be solved; at the same time, the split matrix unit does not affect the post-quantum security characteristics of the multivariate cipher, while ensuring the efficient execution of key generation, signature and signature verification, and achieving the balance between security and resource adaptation.

[0059] For the batch storage and operation scheme, in some embodiments, the sub-matrix set includes a first sub-matrix set and a second sub-matrix set. When determining the matrix unit according to the public key matrix and the private key matrix, the public key matrix is split into the first sub-matrix set, and the private key matrix is split into the second sub-matrix set. The first sub-matrix set contains a first number of public key matrices, and the second sub-matrix set contains a second number of private key matrices; the sum of the first number and the second number is greater than a third number; the third number is the original sum of the number of the set composed of the public key matrix and the private key matrix.

[0060] For example, the public key related matrix and the private key related matrix are respectively split in batches. The sum of the first number and the second number is m, and the third number is . Then, the matrix unit composed of the sub-matrix set is the matrix in batches of is divided into matrices in batches of , and a total of matrices are stored and operated.

[0061] It should be noted that, in order to facilitate understanding, the following examples of batch storage and operation are taken as an example of the matrix in batches of is divided into matrices in batches of , and a total of matrices are stored and operated.

[0062] For the batch storage and operation of key generation, as shown in Figure 2 , in some embodiments, the key generation can include steps S201-S205.

[0063] S201, in response to performing key generation, creating an initial random seed.

[0064] wherein the initial random seed includes a first seed of the public key and a second seed of the private key .

[0065] S202, determining a first matrix based on the second seed, and determining a plurality of matrix pairs based on the first seed.

[0066] After creating the initial random seed described above, the corresponding matrices can be obtained by expanding the random seed.

[0067] For example, expanding , to obtain the matrix (i.e. the first matrix). Further expanding , to obtain batch matrices (i.e. matrix pairs), and storing them in batches, wherein is an upper triangular matrix, .

[0068] S203, determining a sub-matrix set according to the first matrix and the matrix pairs.

[0069] According to the first matrix and the sub-matrix set described above, a sub-matrix set including a first sub-matrix set (public key related) and a second sub-matrix set (private key related) is determined.

[0070] For example, calculating and private key related batch matrices (i.e. the second sub-matrix set), and storing them in batches, . Calculating and public key related batch matrices (i.e. the first sub-matrix set), and storing them in batches.

[0071] S204, outputting the first sub-matrix set and the second sub-matrix set to obtain the batch-stored public key and private key.

[0072] For example, outputting the batch-stored public key: ; and, outputting the batch-stored private key: .

[0073] Illustratively, the key generation performed based on batch storage can include the following steps S41-S46.

[0074] S41, generating a public key and a private key random seed and .

[0075] S42, expanding , to get matrix .

[0076] S43, expanding , to get batch matrix and store in batches, where is upper triangular matrix, .

[0077] S44, calculating and private key related batch matrix and store in batches, .

[0078] S45, calculating and public key related batch matrix and store in batches.

[0079] S46, outputting the stored in batches public key: , and outputting the stored in batches private key: .

[0080] For the signature generation in batches, in some embodiments, as shown in Figure 3 , the signature generation can include steps S301-S306.

[0081] S301, in response to performing signature generation, obtaining a target message.

[0082] For signature generation (i.e. signature algorithm), first determine the target message M to be signed.

[0083] S302, determining a first salt value based on the target message.

[0084] Taking a random salt value on the target message M to determine the corresponding first salt value.

[0085] S303, concatenating the target message with the first salt value to get a first concatenation result.

[0086] S304, performing a hash operation on the first concatenation result to get a first vector.

[0087] Then concatenate the target message M and the first salt value , do hash operation, get (i.e. the first vector t).

[0088] S305. Based on the first vector and the second submatrix set, perform the first operation in batches to obtain the second vector.

[0089] The first operation involves the stored procedure and computation procedure for signature generation. In other words, signature generation-related batch calculations can be performed based on the batched sub-matrix sets (related to the private key) to obtain the corresponding second vector s.

[0090] For example, first calculate the first to second... Okay, we only need to read a batch of private keys. Once it's in memory, then calculate the matrix... Arrive at the Yes, the memory space used to store the previous batch of private keys can be used to store the next batch of private keys. (Judgment matrix) If the vector is invertible, calculate it in batches. , of which the first Components Solve the system of linear equations. Calculate vectors , to be used as the second vector.

[0091] S306. Generate a digital signature for the target message based on the second vector and the first salt value.

[0092] Based on the above, the second vector s and the first salt value are generated. Output the digital signature corresponding to the target message M. For example, let ), and output messages signature .

[0093] For example, signature generation based on batch storage execution may include the following steps S51-S57.

[0094] S51, Regarding the message Take a random salt value Perform hash operations ,get .

[0095] S52, Randomly select vectors Calculate the matrix , of which Behavior Vector Specifically, the matrix is ​​calculated in batches; for example, the first to second elements of the matrix are calculated first. Okay, we only need to read a batch of private keys. Once it's in memory, then calculate the matrix... Arrive at the Yes, you can use the memory space that stored the previous batch of private keys to store the next batch of private keys.

[0096] S53, judging the matrix whether reversible, if not, jump to S52.

[0097] S54, batch computing vector , the first component of which is . The specific way is similar to S52.

[0098] S55, solving linear equations .

[0099] S56, computing vector .

[0100] S57, let ), output the signature of the message . .

[0101] For batch storage and operation of signature verification, in some embodiments, as shown in Figure 4 , the signature verification can include steps S401-S406.

[0102] S401, in response to performing signature verification, obtaining the target message.

[0103] For signature verification (i.e. verification algorithm), first determine the target message M to be signed.

[0104] S402, determining the second salt value based on the target message.

[0105] Take a random salt value on the target message M to determine the corresponding second salt value.

[0106] S403, concatenating the target message with the second salt value to obtain a second concatenation result.

[0107] S404, performing a hash operation on the second concatenation result to obtain a third vector.

[0108] Then concatenate the target message M and the second salt value , do hash operation, get (i.e. the third vector t).

[0109] S405, performing the second operation based on the first sub-matrix set in batches to obtain the first target component.

[0110] Wherein, the second operation is the storage program and operation program corresponding to the signature verification. That is, the batch calculation related to the signature verification can be performed according to the batch sub-matrix set (public key related) to obtain the corresponding first target component component. ​

[0111] For example, vectors can be solved in batches. Each time, only one batch of public keys needs to be read. It can be loaded into memory.

[0112] S406. If the first target component and the corresponding component in the third vector are the same, then output the result of verification success.

[0113] Compare the first target component If all components of the third vector t are identical, then the verification is successful; otherwise, the verification fails. For example, if for all... , and The first vector If the components are equal, the verification passes. If they are not equal, the verification fails.

[0114] For example, signature verification based on batch storage may include the following steps S61-S62.

[0115] S61, Regarding messages Perform hash operations ,get .

[0116] S62, If for all , and The first vector If all components are equal, the verification passes. If they are not equal, the verification fails. Specifically, the vectors can be solved in batches. Each time, only one batch of public keys needs to be read. It can be loaded into memory.

[0117] As can be seen from the above batch calculation and storage scheme, the batch storage and operation method first splits the public key matrix and private key matrix into more batches of sub-matrix sets (the first / second sub-matrix sets, with the total batch size greater than the original total size), expands and generates corresponding matrices based on the public key and private key random seeds, and then calculates and stores the public key and private key related sub-matrices in batches; when generating a signature, the sub-matrixes are loaded into memory in batches based on the private key sub-matrix set to calculate the matrix L and vector y, reusing memory space to process multiple batches of data. Similarly, during verification, the public key sub-matrix set is loaded and calculated in batches to avoid the large matrix occupying memory as a whole.

[0118] In this way, by reusing memory in batches, the memory requirements of the multivariate signature algorithm are adapted to the limited resources of the embedded chip; at the same time, the correctness of key generation, signing and verification and post-quantum security are ensured, achieving a balance between security and efficiency in resource-constrained scenarios.

[0119] For the scheme of the block matrix, in some embodiments, the sub-matrix blocks include a first sub-matrix block and a second sub-matrix block. When the matrix units are determined according to the public key matrix and the private key matrix, the public key matrix can be split into the first sub-matrix block, and the private key matrix can be split into the second sub-matrix block. Wherein, the number of elements of the first sub-matrix block is less than the number of elements of the public key matrix, and the number of elements of the second sub-matrix block is less than the number of elements of the private key matrix.

[0120] That is, the block matrix operation can be used to reduce the memory overhead during operation, that is, for the public key matrix and the private key matrix, the small matrix after the block is read into the memory during operation, rather than the entire matrix.

[0121] It should be noted that, in order to facilitate understanding, the following examples of block matrix are illustrated by taking an example of splitting a matrix into four blocks of 2*2, but not limited thereto, and other forms of block splitting can also be used.

[0122] For the key generation of the block matrix, as shown in the following table, in some embodiments, the key generation can include steps S501-S503. Figure 5

[0123] S501, creating an initial random seed.

[0124] Wherein, the initial random seed includes a first seed of the public key and a second seed of the private key.

[0125] S502, determining a first block and a second block based on the second seed, and determining a third block and a fourth block based on the first seed.

[0126] After creating the above initial random seed, the block of the corresponding matrix can be obtained by expanding the random seed. Wherein, the first block and the second block belong to the second sub-matrix block, the third block and the fourth block belong to the first sub-matrix block, and the third block is composed of an upper triangular matrix by horizontal and vertical splicing.

[0127] For example, expanding , a batch of matrices ; Wherein is a sub-matrix block of the upper triangular matrix ; is a sub-matrix block of the matrix :

[0128]

[0129] S503, output the public key and the private key stored in the blocks according to the first block, the second block, the third block and the fourth block.

[0130] According to the above-mentioned blocks, the public key and the private key can be output, and the memory occupation of operation can be reduced.

[0131] In some embodiments, when determining the public key and the private key stored in the blocks, the second sub-matrix block is determined based on the transpose of the third block and the sum of itself, the first block, the second block and the fourth block; and the first sub-matrix block is determined based on the first block, the transpose of the second block, the third block and the fourth block.

[0132] For example, a batch of matrices related to the private key is calculated , ; ; ; wherein . Specifically, the calculation of can be performed by first calculating , multiplying the obtained result by , and then performing several matrix multiplications and additions. In this way, only small-scale matrices need to be read into the memory for operation each time.

[0133] and a batch of matrices related to the public key is calculated ; The public key and the private key are output.

[0134] Exemplarily, the key generation performed based on the block matrix can include the following steps S71-S76.

[0135] S71, generating a public key and a private key random seed and .

[0136] S72, expanding to obtain matrices and , wherein and are the block sub-matrices of the matrix :

[0137] S73, expanding to obtain a batch of matrices: ; wherein It is an upper triangular matrix The block submatrix; It is a matrix The block submatrix:

[0138]

[0139] S74. Calculate a batch of matrices related to the private key:

[0140]

[0141]

[0142]

[0143] in, Specifically, for example, calculation You can calculate first. Multiply the result again Then perform several more matrix multiplications and additions. This ensures that only a small matrix needs to be read into memory for each operation.

[0144] S75. Calculate a batch of matrices associated with the public key:

[0145] S76, Output Public Key private key .

[0146] For signature generation of block matrices, such as Figure 6 As shown, in some embodiments, signature generation includes steps S601-S606.

[0147] S601, In response to the execution of signature generation, obtain the target message.

[0148] For signature generation (i.e. signature algorithm), the target message M to be signed is first determined.

[0149] S602. Determine the third salt value based on the target message.

[0150] Take a random salt value for the target message M In order to determine the corresponding third salt value.

[0151] S603. Concatenate the target message with the third salt value to obtain the third concatenation result.

[0152] S604. Perform a hash operation on the third concatenation result to obtain the fourth vector.

[0153] Then combine the target message M and the third salt value Concatenate, perform a hash operation, and get (i.e., the fourth vector t).

[0154] S605. Based on the fourth vector and the second submatrix, divide the data into blocks and perform the first operation in each block to obtain the fifth vector.

[0155] The first operation involves the stored procedure and computation procedure for signature generation. In other words, signature generation-related batch calculations can be performed based on submatrix blocks (private key related) to obtain the corresponding fifth vector s.

[0156] For example, randomly select a vector Calculate the matrix , of which Behavior Vector Judgment matrix Is it invertible? If the matrix... If it is invertible, then calculate the vector. , of which the first Components Solve the system of linear equations. Calculate vectors , to be used as the fifth vector.

[0157] S606. Generate a digital signature for the target message based on the fifth vector and the third salt value.

[0158] Based on the above, the fifth vector s and the third salt value are generated. Output the digital signature corresponding to the target message M. For example, let ), and output messages signature .

[0159] For example, key generation based on matrix block execution may include the following steps S81-S87.

[0160] S81, Regarding messages Take a random salt value Then perform a hash operation on it. ,get .

[0161] S82, Randomly select vectors Calculate the matrix , of which Behavior Vector .

[0162] S83, Judgment Matrix Check if it is reversible; if not, jump to S82.

[0163] S84, calculating a vector ; wherein the first component is .

[0164] S85, solving a linear equation set .

[0165] S86, calculating a vector .

[0166] S87, setting ), outputting a signature of a message . .

[0167] For signature verification of a matrix block, as shown in FIG. 7, in some embodiments, the signature verification can include steps S701-S706. Figure 7

[0168] S701, in response to performing signature verification, obtaining a target message.

[0169] For signature verification (i.e., verification algorithm), first determine the target message M to be signed.

[0170] S702, determining a fourth salt value based on the target message.

[0171] Take a random salt value salt for the target message M to determine the corresponding fourth salt value.

[0172] S703, concatenating the target message with the fourth salt value to obtain a fourth concatenation result.

[0173] S704, performing a hash operation on the fourth concatenation result to obtain a sixth vector.

[0174] Then concatenate the target message M and the fourth salt value , and perform a hash operation to obtain (i.e., the sixth vector t).

[0175] S705, performing a second operation based on the first sub-matrix block to obtain a second target component.

[0176] The second operation is a storage program and an operation program corresponding to the signature verification. That is, the signature verification related block calculation can be performed according to the matrix block (public key related) to obtain the component of the corresponding second target component .

[0177] S706, if the second target component is consistent with the corresponding component in the sixth vector, output a result of passing the verification.

[0178] ​Compare the second target components If all components of the sixth vector t are identical, then the verification is successful; otherwise, the verification fails. For example, if for all... , and The first vector If the components are equal, the verification passes. If they are not equal, the verification fails.

[0179] For example, signature verification based on batch storage may include the following steps S91-S92.

[0180] S91, Regarding the message Perform hash operations ,get .

[0181] S92, If for all , and The first vector If all components are equal, the verification passes. If they are not equal, the verification fails. Similarly, a batch of... .

[0182] As can be seen from the above calculation and storage scheme of the block matrix, the core logic of large matrix splitting and small block operation optimizes memory: First, the original public key matrix and private key matrix are split into sub-matrix blocks with fewer elements (the first sub-matrix block corresponds to the public key, and the second sub-matrix block corresponds to the private key), for example, the matrix is ​​split into 2×2 small blocks; then, each block is generated by expanding based on the public key and private key random seed. During operation, only small-scale blocks are loaded to perform matrix multiplication, addition and other operations. Finally, the public key and private key are output based on the blocks. The same block matrix multiplication is used in the signature and verification stages, avoiding the large matrix from occupying memory throughout the process.

[0183] This reduces the amount of data loaded into memory at a single time to the level of small blocks, significantly reducing the peak memory usage of multivariate signature algorithms and adapting to the limited memory resources of embedded chips. At the same time, it ensures the post-quantum security characteristics of multivariate cryptography, and the small block operation is more easily adapted to the computing power of embedded hardware, achieving a balance between resource adaptation and computing efficiency while ensuring the correctness and security of signatures and verifications.

[0184] Memory optimization methods based on the above digital signatures, such as Figure 8 As shown, this application also provides a memory optimization device 800 for digital signatures, including a processing unit 801 and a digital signature unit 802, wherein: The processing unit 801 is configured to determine a matrix unit according to a public key matrix and a private key matrix; the public key matrix is used to generate a public key, and the private key matrix is used to generate a private key; the matrix unit is at least one of a sub-matrix set and a sub-matrix block; the number of the sub-matrix set is greater than the original number of a set composed of the public key matrix and the private key matrix; and the number of elements of the sub-matrix block is less than the number of elements of the public key matrix or the private key matrix. The digital signature unit 802 is configured to execute a target program based on the matrix unit, the target program including at least one of key generation, signature generation, and signature verification.

[0185] In some embodiments, the processing unit 801 is further configured to split the public key matrix into the first sub-matrix set and split the private key matrix into the second sub-matrix set; the first sub-matrix set contains a first number of the public key matrix, and the second sub-matrix set contains a second number of the private key matrix; the sum of the first number and the second number is greater than a third number; and the third number is the sum of the original number of the set composed of the public key matrix and the private key matrix.

[0186] In some embodiments, the digital signature unit 802 is further configured to, in response to executing the key generation, create an initial random seed, the initial random seed including a first seed of the public key and a second seed of the private key; determine a first matrix based on the second seed and a plurality of matrix pairs based on the first seed; determine the sub-matrix set according to the first matrix and the matrix pairs; the sub-matrix set includes the first sub-matrix set and the second sub-matrix set; and output the first sub-matrix set and the second sub-matrix set to obtain the public key and the private key stored in batches.

[0187] In some embodiments, the digital signature unit 802 is further configured to, in response to executing the signature generation, obtain a target message; determine a first salt value based on the target message; splice the target message and the first salt value to obtain a first splicing result; perform a hash operation on the first splicing result to obtain a first vector; perform a first operation in batches based on the first vector and the second sub-matrix set to obtain a second vector; the first operation is a storage program and an operation program corresponding to the signature generation; and generate a digital signature of the target message according to the second vector and the first salt value.

[0188] In some embodiments, the digital signature unit 802 is further configured to, in response to performing the signature verification, obtain a target message; determine a second salt value based on the target message; concatenate the target message with the second salt value to obtain a second concatenation result; perform a hash operation on the second concatenation result to obtain a third vector; perform a second operation based on the first set of sub-matrices in batches to obtain a first target component; the second operation is a storage program and an operation program corresponding to the signature verification; and output a result of passing the verification if the first target component is consistent with a corresponding component in the third vector.

[0189] In some embodiments, the processing unit 801 is further configured to split the public key matrix into the first set of sub-matrices and split the private key matrix into the second set of sub-matrices; wherein the number of elements of the first set of sub-matrices is less than the number of elements of the public key matrix, and the number of elements of the second set of sub-matrices is less than the number of elements of the private key matrix.

[0190] In some embodiments, the digital signature unit 802 is further configured to, in response to performing the key generation, create an initial random seed, the initial random seed including a first seed of the public key and a second seed of the private key; determine a first block and a second block based on the second seed, and determine a third block and a fourth block based on the first seed; the first block and the second block belong to the second set of sub-matrices, the third block and the fourth block belong to the first set of sub-matrices, and the third block is composed of an upper triangular matrix by horizontal and vertical concatenation; and output the public key and the private key stored in the blocks according to the first block, the second block, the third block, and the fourth block.

[0191] In some embodiments, the digital signature unit 802 is further configured to determine the second set of sub-matrices based on a sum of a transpose of the third block and itself, the first block, the second block, and the fourth block; and determine the first set of sub-matrices based on the first block, a transpose of the second block, the third block, and the fourth block.

[0192] In some embodiments, the digital signature unit 802 is further configured to, in response to performing the signature generation, obtain a target message; determine a third salt value based on the target message; concatenate the target message with the third salt value to obtain a third concatenation result; perform a hash operation on the third concatenation result to obtain a fourth vector; perform a first operation based on the fourth vector and the second set of sub-matrices in batches to obtain a fifth vector; the first operation is a storage program and an operation program corresponding to the signature generation; and generate a digital signature of the target message according to the fifth vector and the third salt value.

[0193] In some embodiments, the digital signature unit 802 is further configured to, in response to performing the signature verification, acquire a target message; determine a fourth salt value based on the target message; splice the target message and the fourth salt value to obtain a fourth splicing result; perform a hash operation on the fourth splicing result to obtain a sixth vector; perform a second operation based on the first sub-matrix block to obtain a second target component; the second operation is a storage program and an operation program corresponding to the signature verification; and output a result of passing the verification if the second target component is consistent with a corresponding component in the sixth vector.

[0194] It should be noted that the foregoing explanation of the method embodiments also applies to the apparatuses of the embodiments of the present disclosure, and the principles are the same, and the embodiments of the present disclosure are not limited again.

[0195] According to embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium and a computer program product.

[0196] Figure 9 A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present disclosure described and / or claimed in this document.

[0197] As shown in Figure 9 The electronic device 900 includes a computing unit 901 that can perform various appropriate actions and processes in accordance with a computer program stored in a ROM (Read-Only Memory) 902 or a computer program loaded from a storage unit 908 into a RAM (Random Access Memory) 903. Various programs and data required for the operation of the electronic device 900 can also be stored in the RAM 903. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An I / O (Input / Output) interface 905 is also connected to the bus 904.

[0198] A plurality of components in the electronic device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a magnetic disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the electronic device 900 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0199] The computing unit 901 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 901 performs various methods and processes described above, such as the memory optimization method for digital signatures. For example, in some embodiments, the memory optimization method for digital signatures can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded onto the RAM 903 and executed by the computing unit 901, one or more steps of the methods described above can be performed. Alternatively, in other embodiments, the computing unit 901 can be configured to perform the aforementioned memory optimization method for digital signatures by any other appropriate means, such as by means of firmware.

[0200] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a Field Programmable Gate Array (FPGA), an Application-Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a System on a Chip (SOC), a Complex Programmable Logic Device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0201] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general or special purpose computer, such that the program code, when executed by the processor or controller, causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.

[0202] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory), or flash memory, an optical fiber, a CD-ROM (Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0203] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0204] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a LAN (Local Area Network), a WAN (Wide Area Network), the Internet, and a blockchain network.

[0205] The computer system can include clients and servers. This relationship can be between a client and a server that are typically remote from each other and typically interact through a communication network. The relationship between client and server exists by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server can also be a server of a distributed system, or a server combined with a blockchain.

[0206] It should be noted that artificial intelligence is a discipline that studies enabling computers to simulate some thinking processes and intelligent behaviors of people (such as learning, reasoning, thinking, planning, etc.), both hardware and software technologies. Artificial intelligence hardware technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing, etc.; artificial intelligence software technology mainly includes computer vision technology, speech recognition technology, natural language processing technology, and machine learning / deep learning, big data processing technology, knowledge graph technology, etc. several major directions.

[0207] It should be understood that the various forms of the flow shown above can be used to reorder, add or delete steps. For example, each step described in the present disclosure can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, which is not limited herein.

[0208] The above detailed description does not constitute a limitation on the scope of protection of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present disclosure shall be included in the scope of protection of the present disclosure.

Claims

1. A method for memory optimization of a digital signature, characterized in that, The method comprises: determining a matrix unit according to a public key matrix and a private key matrix; the public key matrix is used to generate a public key, and the private key matrix is used to generate a private key; the matrix unit is at least one of a sub-matrix set and a sub-matrix block; the number of the sub-matrix set is greater than the original number of a set composed of the public key matrix and the private key matrix; and the number of elements of the sub-matrix block is less than the number of elements of the public key matrix or the private key matrix; executing a target program based on the matrix unit, wherein the target program comprises at least one of key generation, signature generation and signature verification.

2. The method of claim 1, wherein, The sub-matrix set comprises a first sub-matrix set and a second sub-matrix set; and the method of determining the matrix unit according to the public key matrix and the private key matrix comprises: splitting the public key matrix into the first sub-matrix set and splitting the private key matrix into the second sub-matrix set; wherein the first sub-matrix set contains a first number of the public key matrix, the second sub-matrix set contains a second number of the private key matrix, and the sum of the first number and the second number is greater than a third number; and the third number is the sum of the original number of the set composed of the public key matrix and the private key matrix.

3. The method of claim 2, wherein, The method of executing the target program based on the matrix unit comprises: in response to executing the key generation, creating an initial random seed, wherein the initial random seed comprises a first seed of the public key and a second seed of the private key; determining a first matrix based on the second seed and a plurality of matrix pairs based on the first seed; determining the sub-matrix set according to the first matrix and the matrix pairs; the sub-matrix set comprises the first sub-matrix set and the second sub-matrix set; outputting the first sub-matrix set and the second sub-matrix set to obtain the public key and the private key stored in batches.

4. The method of claim 2, wherein, The method of executing the target program based on the matrix unit comprises: in response to executing the signature generation, obtaining a target message; determining a first salt value based on the target message; splicing the target message and the first salt value to obtain a first splicing result; performing a hash operation on the first splicing result to obtain a first vector; based on the first vector and the second sub-matrix set, performing a first operation in batches to obtain a second vector; the first operation is a storage program and an operation program corresponding to the signature generation; generating a digital signature of the target message according to the second vector and the first salt value.

5. The method of claim 2, wherein, The method of executing the target program based on the matrix unit comprises: in response to executing the signature verification, obtaining a target message; determining a second salt value based on the target message; splicing the target message and the second salt value to obtain a second splicing result; performing a hash operation on the second splicing result to obtain a third vector; based on the first sub-matrix set, performing a second operation in batches to obtain a first target component; the second operation is a storage program and an operation program corresponding to the signature verification; if the first target component is consistent with a corresponding component in the third vector, outputting a result of passing the verification.

6. The method of claim 1, wherein, The sub-matrix block includes a first sub-matrix block and a second sub-matrix block; and the matrix unit is determined according to the public key matrix and the private key matrix, including: The public key matrix is split into the first sub-matrix block, and the private key matrix is split into the second sub-matrix block; Wherein, the number of elements of the first sub-matrix block is less than the number of elements of the public key matrix, and the number of elements of the second sub-matrix block is less than the number of elements of the private key matrix.

7. The method of claim 6, wherein, The target program is executed based on the matrix unit, including: In response to executing the key generation, an initial random seed is created, including a first seed of the public key and a second seed of the private key; Based on the second seed, a first block and a second block are determined, and based on the first seed, a third block and a fourth block are determined; the first block and the second block belong to the second sub-matrix block, the third block and the fourth block belong to the first sub-matrix block, and the third block is composed of an upper triangular matrix by transverse and longitudinal splicing; According to the first block, the second block, the third block and the fourth block, the public key and the private key stored in the block are outputted.

8. The method of claim 7, wherein, The public key and the private key stored in the block are determined, including: Based on the sum of the transpose of the third block and itself, the first block, the second block and the fourth block, the second sub-matrix block is determined; And based on the first block, the transpose of the second block, the third block and the fourth block, the first sub-matrix block is determined.

9. The method of claim 6, wherein, The target program is executed based on the matrix unit, including: In response to executing the signature generation, a target message is obtained; Based on the target message, a third salt value is determined; The target message and the third salt value are spliced to obtain a third splicing result; The third splicing result is executed by a hash operation to obtain a fourth vector; Based on the fourth vector and the second sub-matrix block, a first operation is performed in blocks to obtain a fifth vector; the first operation is a storage program and an operation program corresponding to the signature generation; According to the fifth vector and the third salt value, a digital signature of the target message is generated.

10. The method of claim 6, wherein, The target program is executed based on the matrix unit, including: In response to executing the signature verification, a target message is obtained; Based on the target message, a fourth salt value is determined; The target message and the fourth salt value are spliced to obtain a fourth splicing result; The fourth splicing result is executed by a hash operation to obtain a sixth vector; Based on the first sub-matrix block, a second operation is performed to obtain a second target component; the second operation is a storage program and an operation program corresponding to the signature verification; If the second target component is consistent with the corresponding component in the sixth vector, a result of passing the verification is outputted.

11. A digitally signed memory optimization apparatus, characterized by, Including: The processing unit is configured to determine a matrix unit according to a public key matrix and a private key matrix; the public key matrix is used to generate a public key, and the private key matrix is used to generate a private key; the matrix unit is at least one of a sub-matrix set and a sub-matrix block; the number of the sub-matrix set is greater than the original number of a set composed of the public key matrix and the private key matrix; and the number of elements of the sub-matrix block is less than the number of elements of the public key matrix or the private key matrix. The digital signature unit is configured to execute a target program based on the matrix unit, the target program including at least one of key generation, signature generation, and signature verification.

12. An electronic device, comprising: Comprise: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-10.

13. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-10.

14. A computer program product, characterised in that, The computer program, when executed by the processor, implements the method of any one of claims 1-10. The computer program, when executed by the processor, implements the method of any one of claims 1-10.