A method and device for determining a pseudo-random sequence
By constructing modular polynomials and recursive logic expressions in the Galois field, the problem of low efficiency in generating pseudo-random source sequences in lightweight sequence cryptography is solved, and the generation efficiency and randomness of sequence cryptography are improved. It is suitable for Internet of Things security, etc. field.
Patent Information
- Application Number
- CN202311866231.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-30
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2043-12-30
AI Technical Summary
The pseudo-random source sequence generation efficiency of lightweight sequence ciphers in the existing technology is low, resulting in the efficiency of generating sequence ciphers also need to be improved, especially on the premise of ensuring randomness, balance and large periods.
By constructing modular polynomials and recursive logical expressions of the Galois field, using irreducible polynomials and random values to generate pseudo-random sequences, the efficiency of generating pseudo-random sequences is improved, and different random sequences are generated through different recursive logical expressions to improve sequence encryption. generation efficiency.
It improves the generation efficiency and randomness of pseudo-random sequences, ensures the quality and efficiency of sequence encryption, and provides more pseudo-random sequence generation methods, which is suitable for fields such as Internet of Things security.
Smart Images

Figure CN117834113B
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of information security, and in particular, to a method and device for determining a pseudo-random sequence. Background Art
[0002] Pseudo-random sequences play an important role in cryptography. The randomness, balance, unpredictability, period size, nonlinearity and generation efficiency of random sequences are important indicators in the design of sequence cipher algorithms.
[0003] For example, lightweight stream cipher is a cryptographic algorithm with advantages such as easy implementation, low energy consumption, low latency and compact design. Due to the many advantages of this cryptographic algorithm, it has attracted much attention in the field of IoT security applications and has become a hot topic in cryptography research in recent years. However, since the efficiency of generating pseudo-random random source sequences of lightweight stream ciphers needs to be improved, the efficiency of generating lightweight stream ciphers needs to be improved.
[0004] Therefore, how to improve the efficiency of generating random sequences while ensuring the balance, large cycle and randomness of random sequences, thereby improving the efficiency of generating sequence passwords, has become a key point in the development of this technology field. Summary of the invention
[0005] The embodiments of the present application provide a method and device for generating a pseudo-random sequence, so as to improve the efficiency of generating a random sequence, thereby improving the efficiency of generating a sequence password.
[0006] In the first aspect, a pseudo-random sequence determination method provided by an embodiment of the present application includes: determining an irreducible polynomial whose coefficients are all 0 or 1 according to a preset word length of a storage unit, and the degree of the irreducible polynomial is the same as the word length of the storage unit. Construct a corresponding Galois field according to the irreducible polynomial. Obtain a numerical value and a first array corresponding to the modulo polynomial of the Galois field, the numerical value corresponding to the modulo polynomial includes all coefficients of the modulo polynomial, the first array includes a number with a numerical value of 2 and m numbers with a numerical value of 0 or 1, and m is a positive integer. According to the numerical value corresponding to the modulo polynomial and the first numerical value, determine the second numerical value corresponding to the first numerical value, the first numerical value is any numerical value among a plurality of random numerical values, and the XOR result of the first numerical value and the second numerical value is the numerical value corresponding to the modulo polynomial. Determine a first recursive logic formula according to the first array and the first numerical value, the first array is the coefficient of the first recursive logic formula, and the first numerical value is the constant of the first recursive logic formula. And, determine a second recursive logic formula according to the first array and the second numerical value, the first array is the coefficient of the second recursive logic formula, and the second numerical value is the constant of the second recursive logic formula. Processing k initial elements according to the first recursive logic formula and / or the second recursive logic formula to obtain a first pseudo-random sequence, wherein the k initial elements are polynomials with coefficients of 0 and / or 1, and k is a positive integer greater than m. Outputting the first pseudo-random sequence, and generating a sequence password according to the first pseudo-random sequence.
[0007] By adopting this method, the values in the first array in the recursive logic formula are all 0 or 1 except for a 2 in a fixed position, and the first value and the second value are both fixed constants. Therefore, according to the recursive logic formula, the k initial elements can be processed quickly, and the efficiency of generating the first pseudo-random sequence is improved, thereby improving the efficiency of generating the sequence password.
[0008] Furthermore, since the values in the first array are selected and measured according to relevant criteria, the constructed recursive logic formula has randomness, which can improve the randomness of the first pseudo-random sequence and ensure that the sequence has a maximum period, thereby ensuring the quality of the random source sequence of the sequence cipher. The second value is determined based on the value corresponding to the first value and the modulus polynomial, so this method can ensure the balance of the random sequence.
[0009] In addition, since the first value is obtained randomly and the recursive logic formula is constructed based on the first value, different first values can construct different recursive logic formulas, and different random sequences can be generated by using different recursive logic formulas. Therefore, this method can quickly generate a large number of random sequences, improve the efficiency of generating random sequences, and also provide a method for generating more pseudo-random sequences.
[0010] In one implementable manner, the k initial elements are all polynomials on the Galois Field, and the result of adding and / or multiplying any elements among the k initial elements is an element on the Galois Field.
[0011] In this way, k polynomials are randomly obtained under the premise that the k elements are polynomials whose coefficients are all 0 or 1 on the Galois field, and a pseudo-random sequence with a maximum period can be recursively generated, and the efficiency of random sequence generation is guaranteed.
[0012] In an implementable manner, processing k initial elements according to a first recursive logic formula and / or a second recursive logic formula to obtain a first pseudo-random sequence includes: processing the k initial elements according to a preset conditional function to recursively obtain a plurality of output elements of the sequence, wherein the function in the conditional function is obtained according to the first recursive logic formula and the second recursive logic formula. The k initial elements are concatenated with the output elements to obtain the first pseudo-random sequence.
[0013] In an implementable manner, k initial elements are processed according to a preset conditional function to recursively obtain multiple output elements of the sequence, including: performing a cyclic shift process on an element at a specified position of the k initial elements to obtain a cyclically shifted element. The cyclically shifted element replaces the element at a specified position of the k initial elements to obtain k elements. The k elements are processed according to the conditional function to recursively obtain multiple output elements.
[0014] In this way, by selecting different bits as conditional discriminant bits, multiple different recursive logic formulas can be obtained. Different recursive logic formulas can generate different random sequences. Therefore, this method can provide more methods for generating random sequences, thereby providing more options for sequence cipher design.
[0015] In one achievable manner, the cyclic shift includes a cyclic left shift and a cyclic right shift.
[0016] In one implementable manner, the cyclically shifted elements are used as a basis for determining the conditional function.
[0017] In a second aspect, an embodiment of the present application provides a pseudo-random sequence determination device, including: a communication module and a processing module.
[0018] Among them, the processing module is used to determine an irreducible polynomial whose coefficients are all 0 or 1 according to the word length of the preset storage unit, and the degree of the irreducible polynomial is the same as the word length of the storage unit. The processing module is also used to construct a corresponding Galois field according to the irreducible polynomial. The communication module is used to obtain the numerical value and the first array corresponding to the modular polynomial of the Galois field, the numerical value corresponding to the modular polynomial includes all the coefficients of the modular polynomial, the first array includes a number with a numerical value of 2 and m numbers with a numerical value of 0 or 1, and m is a positive integer. The processing module is also used to determine the second numerical value corresponding to the first numerical value according to the numerical value corresponding to the modular polynomial and the first numerical value, the first numerical value is any numerical value among a plurality of random numerical values, and the exclusive OR result of the first numerical value and the second numerical value is the numerical value corresponding to the modular polynomial. The processing module is also used to determine the first recursive logic formula according to the first array and the first numerical value, the first array is the coefficient of the first recursive logic formula, and the first numerical value is the constant of the first recursive logic formula. And, the processing module is also used to determine the second recursive logic formula according to the first array and the second numerical value, the first array is the coefficient of the second recursive logic formula, and the second numerical value is the constant of the second recursive logic formula. The processing module is further used to process k initial elements according to the first recursive logic formula and / or the second recursive logic formula to obtain a first pseudo-random sequence, wherein the k initial elements are polynomials with coefficients of 0 and / or 1, and k is a positive integer greater than m. The processing module is further used to output the first pseudo-random sequence and generate a sequence password according to the first pseudo-random sequence.
[0019] In one implementable manner, the k initial elements are all polynomials on the Galois Field, and the result of adding and / or multiplying any elements among the k initial elements is an element on the Galois Field.
[0020] In one achievable manner, the processing module is specifically used to: process k initial elements according to a preset conditional function, recursively obtain multiple output elements of the sequence, wherein the function in the conditional function is obtained according to the first recursive logic formula and the second recursive logic formula. The k initial elements are concatenated with the output elements to obtain a first pseudo-random sequence.
[0021] In an achievable manner, the processing module is specifically used to: perform cyclic shift processing on the elements at the specified positions of the k initial elements to obtain the cyclically shifted elements. Replace the elements at the specified positions of the k initial elements with the cyclically shifted elements to obtain k elements. Process the k elements according to the conditional function to recursively obtain multiple output elements.
[0022] In one achievable manner, the cyclic shift includes a cyclic left shift and a cyclic right shift.
[0023] In one implementable manner, the cyclically shifted elements are used as a basis for determining the conditional function.
[0024] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method of the first aspect and any one of its designs is implemented.
[0025] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the processor implements the first aspect and any one of the designed methods thereof.
[0026] The technical effects brought about by the second to fourth aspects and any one of their designs can refer to the technical effects brought about by the corresponding design in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 A schematic diagram of a flow chart of a pseudo-random sequence determination method provided in an embodiment of the present application;
[0029] Figure 2 A schematic diagram of the structure of a pseudo-random sequence determination device provided in an embodiment of the present application;
[0030] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings. Among them, in the description of the embodiments of the present application, the terms "first" and "second" are used only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0032] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
[0033] In order to facilitate understanding of the solution provided by the present application, the method of generating a pseudo-random sequence is introduced below by taking a sequence cipher in the prior art as an example.
[0034] In the prior art stream cipher scheme, the random source sequence generator of the stream cipher is the core component of the cryptographic algorithm, which is usually a binary field (GF2) or a Galois finite field (Galois fields 2 n , GF2 n ) on a linear feedback shift register. The GF2 field is a set consisting of only two elements, 0 and 1, which constitutes the smallest Galois finite field. However, the linear feedback shift register on the GF2 field can only generate 1 bit of random symbol in each beat, resulting in a low efficiency in generating random sequences by the random number generator, which in turn leads to a low efficiency in generating lightweight sequence cryptography. The Galois finite field (GF2 n )The linear feedback shift register may need to solve the difficulties in programming and implementing fast polynomial multiplication operations.
[0035] Therefore, how to improve the efficiency of generating pseudo-random sequences, and thus improve the efficiency of generating sequence passwords, becomes a key point in the development of this technical field.
[0036] In order to solve the above problems, the present application provides a pseudo-random sequence determination method to improve the efficiency of generating random sequences, thereby improving the efficiency of generating sequence passwords.
[0037] In the pseudo-random sequence determination method provided in the embodiment of the present application, the first device can determine the second value corresponding to the first value according to the corresponding value of the modular polynomial of the constructed Galois field and the first value obtained randomly. The first device can use the first array as the coefficient of the first recursive logic formula and the first value as the constant of the first recursive logic formula to construct the first recursive logic formula. Among them, the first array includes a number with a value of 2 and m numbers with a value of 0 or 1, and m is a positive integer. Similarly, the first device can use the first array as the coefficient of the second recursive logic formula and the second value as the constant of the second recursive logic formula to construct the second recursive logic formula. The first device can process k initial elements according to the first recursive logic formula and / or the second recursive logic formula to obtain a first pseudo-random sequence, and generate a random source sequence of a sequence password according to the first pseudo-random sequence.
[0038] It can be understood that the values in the first array in the recursive logic formula are all 0 or 1 except for one 2, and the first value and the second value are both certain constants. Therefore, according to the recursive logic formula, the k initial elements can be processed quickly, the efficiency of generating the first pseudo-random sequence is improved, and thus the efficiency of generating the sequence password is improved.
[0039] Furthermore, since the values in the first array are selected and measured according to relevant criteria, the constructed recursive logic formula has randomness, which can improve the randomness of the first pseudo-random sequence and ensure that the sequence has a maximum period, thereby ensuring the quality of the random source sequence of the sequence cipher. The second value is determined based on the value corresponding to the first value and the modulus polynomial, so this method can ensure the balance of the random sequence.
[0040] In addition, since the first value is obtained randomly and the recursive logic formula is constructed based on the first value, different first values can construct different recursive logic formulas, and different random sequences can be generated by using different recursive logic formulas. Therefore, this method can quickly generate a large number of random sequences, improve the efficiency of generating random sequences, and also provide a method for generating more pseudo-random sequences.
[0041] Optionally, the first device may be a processing device for executing the method described in the present application, or may be a processing device in a computer system for executing the method described in the present application, such as a processor or a processing module, etc., which is not specifically limited in the present application.
[0042] The following is an introduction to a method for determining a pseudo-random sequence provided by this application:
[0043] Figure 1 A schematic diagram of a method for determining a pseudo-random sequence provided in an embodiment of the present application. Figure 1 In the method shown, the first device is used as the execution subject. Figure 1As shown, the method comprises the following steps:
[0044] S101: The first device determines, according to a preset word length of a storage unit, an irreducible polynomial whose coefficients are all 0 or 1. The degree of the irreducible polynomial is the same as the word length of the storage unit.
[0045] Specifically, the word length of the storage unit may refer to the maximum number of binary bits that can be stored in each memory storage unit. The word length of the preset storage unit may be set according to the word length of the storage unit supported by the processing device (e.g., a device for generating a random sequence). For example, the word length of the storage unit may be 8 bits, 16 bits, 32 bits, or 64 bits, etc.
[0046] The first device may determine an irreducible polynomial on GF2 of the same degree as the word length of the storage unit according to the word length of the storage unit. The coefficients of the irreducible polynomial are all 0 or 1. For example, if the word length of the preset storage unit is 64, an irreducible polynomial of degree 64 may be determined on GF2, such as x 64 +x 43 +x 14 +x 2 +1. Among them, the polynomials in GF2 are all polynomials with coefficients of 0 or 1. For another example, if the word length of the preset storage unit is 32 bits, an irreducible polynomial of degree 32 can be determined on GF2. For example, an irreducible polynomial of degree 32 can be taken as:
[0047] x 32 +x 31 +x 27 +x 25 +x 23 +x 18 +x 13 +x 12 +x 7 +x+1.
[0048] In addition, the word length of the storage unit can also be determined according to the number of register levels supported by the processing device in this application and the sequence period required by the user. Among them, since the storage unit of the shift register on the early GF2 is composed of n flip-flops, the sequence period generated by the shift register is 2 n -1, n is a positive integer. Since a larger sequence period consumes more computing resources, the first device can determine an appropriate sequence period according to the user's needs. For example, the user's required sequence period is 2 256 magnitude, then the determined sequence period can be 2 256 -1. The word length of the storage unit can be expressed as S, and the number of shift registers can be expressed as R. Then the word length of the storage unit, the number of shift registers and the sequence period satisfy:
[0049] (2 S ) R =2 n , that is, S×R=n.
[0050] For example, if you need to generate a sequence with a period of 2 n =2 256 The word length can be selected as 32 and the number of shift registers as 8. Thus, a primitive 8-level GF (2 32 ) domain shift register sequence can reach (2 32 ) 8 -1=2 256 -1.
[0051] S102: The first device constructs a corresponding Galois field according to the irreducible polynomial.
[0052] Specifically, after determining the irreducible polynomial, the first device may construct a Galois field according to the irreducible polynomial, wherein the irreducible polynomial is a modular polynomial of the constructed Galois field.
[0053] For example, the irreducible polynomial determined by the first device is:
[0054] x 32 +x 31 +x 27 +x 25 +x 23 +x 18 +x 13 +x 12 +x 7 +x+1;
[0055] Then the Galois field constructed by the first device according to the irreducible multinomial is:
[0056] Z2[x] / (x 32 +x 31 +x 27 +x 25 +x 23 +x 18 +x 13 +x 12 +x 7 +x+1);
[0057] The irreducible polynomial may be referred to as a modular polynomial of the Galois Field.
[0058] S103: The first device obtains a value and a first array corresponding to a modular polynomial of a Galois Field, wherein the value corresponding to the modular polynomial includes all coefficients of the modular polynomial, and the first array includes a number with a value of 2 and m numbers with a value of 0 or 1, where m is a positive integer.
[0059] Specifically, after determining the Galois Field, the first device can determine the value corresponding to the modulo polynomial according to the modulo polynomial of the Galois Field. Since the coefficients of the modulo polynomial are all 0 and / or 1, a binary number can be formed according to the coefficients of the polynomial. Among them, the value corresponding to the modulo polynomial can be the binary number. For example, the modulo polynomial is x 3 +x+1, the binary number corresponding to the polynomial is 1011, then ignoring the highest order term, the value corresponding to the modular polynomial can be 011. In addition, the value corresponding to the modular polynomial can be expressed in hexadecimal form, that is, the binary number can be converted to hexadecimal. For example, the irreducible polynomial is x 32 +x 31 +x 27 +x 25 +x 23 +x 18 +x 13 +x 12 +x 7 +x+1, the value of the modulus polynomial is 0x8a843083, where 0x is a hexadecimal number.
[0060] The first device can randomly obtain a first array. The first array includes a number with a value of 2 and m numbers with a value of 0 or 1, and m is a positive integer. That is to say, the values in the first value are all 0 or 1, and at least one of the m values is 2. In addition, the number of values in the first array can be determined according to the number of stages of the shift register supported by the processing device. For example, if the number of stages of the shift register supported by the processing device in the present application is 8, then the number of values in the first value is 8, that is, the first value includes a number with a value of 2 and 7 numbers with values of 0 or 1. For example, the first value can be represented as c0, c1, c2, c3, c4, c5, c6, c7 respectively. Among them, c2=c3=1, c1=c4=c5=c6=c7=0, and c0 is fixed to 2.
[0061] It can be understood that the data in the first array includes a number with a value of 2 and m numbers with a value of 0 or 1, so that the modular multiplication operation between polynomials over the finite field can be avoided, the efficiency of subsequent processing of k polynomials using recursive logic can be improved, and the consumption of computing resources can be reduced.
[0062] S104: The first device may determine a second value corresponding to the first value according to the value corresponding to the modulo polynomial and the first value, wherein the first value is any value among a plurality of random values, and an XOR result of the first value and the second value is the value corresponding to the modulo polynomial.
[0063] For example, still taking the above-mentioned modulo polynomial of degree 32 as an example, the value corresponding to the modulo polynomial is 0x8a843083. If the "1" in the highest bit is removed and moved to the lowest bit, the value corresponding to the modulo polynomial is actually 0x8a843082. If the first value is 0x9000003B, the second value is 0x10421033. For another example, if the first value is 0xE888883B, the second value is 0x68CA9833. Among them, the XOR result of 0x9000003B and 0x10421033 is 0x8a843082, that is, 0x9000003B⊕0x10421033=0x8a843082. The XOR result of 0xE888883B and 0x68CA9833 is 0x8a843082, that is, 0xE888883B⊕0x68CA9833=0x8a843082.
[0064] It is understandable that the first value and the second value can be called a value pair. Since the first value is obtained randomly, a large number of value pairs can be obtained by using this method. For example, taking a modulus polynomial of degree 32 as an example, 2 32 A pair of values.
[0065] S105: The first device determines a first recursive logic formula according to a first array and a first value, wherein the first array is a coefficient of the first recursive logic formula, and the first value is a constant of the first recursive logic formula.
[0066] S106: The first device determines a second recursive logic formula according to the first array and the second value, wherein the first array is a coefficient of the second recursive logic formula, and the second value is a constant of the second recursive logic formula.
[0067] For example, the number of shift register stages is 8. The first array can be represented as c0=2=x, c1, c2, c3, c4, c5, c6 and c7, the first value can be represented as B0, the second value can be represented as B1, and the variable in the recursive logic formula can be represented as a i , a i+1 , a i+2 , a i+3 , a i+4 , a i+5 , a i+6 , a i+7 and a i+8 .
[0068] The first value, the first array and the first recursive logic formula satisfy:
[0069] a i+8 =c7a i+7 ⊕c6a i+6 ⊕c5a i+5 ⊕c4ai+4 ⊕c3a i+3 ⊕c2a i+2 ⊕c1a i+1 ⊕xA i ⊕B0;
[0070] The second value, the first array, and the second recursive logic formula satisfy:
[0071] a i+8 =c7a i+7 ⊕c6a i+6 ⊕c5a i+5 ⊕c4a i+4 ⊕c3a i+3 ⊕c2a i+2 ⊕c1a i+1 ⊕xA i ⊕B1;
[0072] Wherein, i=0,1,2,3,……. In the above formula, “xa i "Originally "c0a i ", because c0 is fixed to 2, and the binary representation of 2 is 00...010, corresponding to x in the finite field, 2 is written as x. Similarly, 3 is equivalent to x+1, and 4 is equivalent to x 2 , 5 is equal to x 2 +1 etc.
[0073] If c0=2, c2=c3=1, c1=c4=c5=c6=c7=0, then the first value, the first array and the first recursive logic formula satisfy:
[0074] a i+8 =a i+3 ⊕a i+2 ⊕xA i ⊕B0, i=0,1,2,3,……。
[0075] The second value, the first array, and the second recursive logic formula satisfy:
[0076] a i+8 =a i+3 ⊕a i+2 ⊕xA i ⊕B1, i=0,1,2,3,……。
[0077] In the present application, the first device may first execute step S105 and then execute step S106. The first device may also first execute step S106 and then execute step S105. The present application does not limit the order of executing step S105 and step S106.
[0078] It is understandable that, since a large number of value pairs can be obtained through step S104, a large number of first recursive logic formulas and second recursive logic formulas can be generated based on steps S105-S106.
[0079] S107: The first device may process k initial elements according to the first recursive logic formula and / or the second recursive logic formula to obtain a first pseudo-random sequence, wherein the k initial elements are polynomials with coefficients of 0 and / or 1, and k is a positive integer greater than m.
[0080] Specifically, the first device can randomly obtain k polynomials with coefficients of 0 and / or 1 as k initial elements. The number of initial elements can be the same as the number of stages of the shift register. For example, the number of stages of the shift register is 8, and the length of the storage unit of the shift register is 32 bits. Then the first device can determine 8 numbers with a length of 32 bits from the Galois field finite field, which are regarded as polynomials a0, a1, a2, a3, a4, a5, a6 and a7. Among them, for example, a0 is 0xFFFFFFFF, and a1, a2, a3, a4, a5, a6 and a7 are all 0. "0x" is expressed as a hexadecimal number. Take a0, a1, a2, a3, a4, a5, a6 and a7 as the initial elements, and reasonably use the recursive logic formula a according to the agreed conditions. i+8 =a i+3 ⊕a i+2 ⊕xA i ⊕B0 and a i+8 =a i+3 ⊕a i+2 ⊕xA i ⊕B1, a pseudo-random sequence with a longer period can be generated.
[0081] In one or more embodiments, the k initial elements of the first device are all polynomials on the Galois Field, wherein the result of adding and / or multiplying any element of the k initial elements is an element on the Galois Field.
[0082] Specifically, the first device can randomly obtain k polynomials on the Galois field. The coefficients of the polynomials on the Galois field are 0 or 1. The result of adding and / or multiplying the polynomials on the Galois field is still the polynomial on the Galois field, wherein when the degree of the result after the polynomials are added and / or multiplied is greater than or equal to the degree of the modular polynomial of the Galois field, the result is modulo the modular polynomial of the Galois field, thereby realizing the closure of the Galois field to addition and / or multiplication.
[0083] Based on this embodiment, k polynomials are randomly obtained under the premise of ensuring that the coefficients of k elements are all 0 or 1, which can improve the efficiency of subsequent random sequence generation.
[0084] The first device processes the k initial elements according to a preset conditional function to obtain a first pseudo-random sequence, including:
[0085] In one or more embodiments, the first device processes k initial elements according to a preset conditional function to recursively obtain multiple output elements of the sequence. The function in the conditional function is obtained according to the first recursive logic formula and the second recursive logic formula. The first device concatenates the k initial elements with the output elements to obtain a first pseudo-random sequence.
[0086] Specifically, the first device may use the k initial elements as variables of the recursive logic formula, calculate the k initial elements according to the recursive logic formula, and recursively obtain a pseudo-random sequence.
[0087] For example, k polynomials can be represented as a0, a1, a2, a3, a4, ..., a k-1 , the coefficients of the recursive logic formula can be expressed as c0 = 2, c1, c2, c3, ..., c k-1 , the constant of the recursive logic expression can be expressed as B, then the recursive logic expression satisfies:
[0088] a i+k =c k-1 a i+k-1 ⊕……⊕c4a i+4 ⊕c3a i+3 ⊕c2a i+2 ⊕c1a i+1 ⊕xA i ⊕B;
[0089] i=0,1,2,3,……。
[0090] Optionally, the first device performs a cyclic shift process on the element at the specified position of the k initial elements to obtain a processed element. The first device replaces the element at the specified position of the k initial elements with the processed element to obtain k elements. The first device processes the k elements according to the conditional function to recursively obtain multiple output elements. Optionally, the cyclic shift includes a cyclic left shift and a cyclic right shift.
[0091] Specifically, the designated position can be set according to the needs of the user. For example, the designated position can be the first element of the k initial elements. For example, the k initial elements can be represented as a0, a1, a2, a3, a4, ..., a k-1 , then the first element can be represented as a0.
[0092] The first device may perform a cyclic shift process on the element at the specified position to obtain a cyclically shifted element, and replace the element at the specified position with the cyclically shifted element, wherein the number of bits of the cyclic shift is n, and n is an integer greater than or equal to 0.
[0093] Taking the above example, the first element can be represented as a0, and the element after circular shift can be represented as a0 <<< n. Here, X <<< h represents circularly shifting X to the right by h bits.
[0094] The k elements can be represented as: a0 <<< n, a1, a2, a3, a4, ……, a k-1 ;
[0095] The recursive logic formula satisfies:
[0096] a i+k-1 = c k a i+k-1 ⊕ …… ⊕ c4a i+4 ⊕ c3a i+3 ⊕ c2a i+2 ⊕ c1a i+1 ⊕ (a i <<< n) ⊕ B, i = 0, 1, 2,
[0097] 3, …….
[0098] Here, when h = 1, the meaning of "a i <<< 1" is similar to that of "xa i " above.
[0099] Furthermore, optionally, the element after circular shift is used as the judgment basis for the conditional function.
[0100] Exemplarily, the conditional function is: if the element after circular shift is even, the first recursive logic formula is used to process the k elements to obtain the corresponding output elements; if the element after circular shift is odd, the second recursive logic formula is used to process the k elements to obtain the corresponding output elements.
[0101] The conditional function satisfies:
[0102] If a i <<< n is even, the recursive logic formula is:
[0103] a i+k = c k a i+k-1 ⊕ …… ⊕ c4a i+4 ⊕ c3a i+3 ⊕ c2a i+2 ⊕ c1a i+1 ⊕ (a i <<< n) ⊕ B0;
[0104] If a i <<< n is odd, the recursive logic formula is:
[0105] ai+k = c k a i+k-1 ⊕……⊕ c4a i+4 ⊕ c3a i+3 ⊕ c2a i+2 ⊕ c1a i+1 ⊕ (a i <<< n) ⊕ B1;
[0106] In addition, the judgment conditions in the conditional function may include at least one of the following:
[0107] a i <<< n's parity, where n is a positive integer;
[0108] a i >>> n's parity, where n is a positive integer, and X >>> n means circularly shifting X left by n bits.
[0109] In addition, the conditions in the conditional function can also be other conditions, which are not specifically limited in this application.
[0110] Exemplarily, taking a random sequence as an example, where the Galois field is GF(2 32 ), the sequence period is 2 256 -1, the number of stages of the shift register is 8, and the storage unit is a 32-bit storage unit. The irreducible polynomial is x 32 + x 31 + x 22 + x 17 + x 12 + x 7 + x + 1, then the value corresponding to the modulo polynomial can be 0x8a843082. The k initial elements can be represented as a0, a1, a2, a3, a4, a5, a6, and a7 respectively, that is, k is equal to 8. The values in the first array can be represented as c0 = 2 -1 , c1, c2, c3, c4, c5, c6, c7. The conditional function is: circularly shift a i right by 1 bit. If a i >>> 1 is less than 0x80000000, then the first recursive logic formula is adopted; if a i >>> 1 is greater than 0x7FFFFFFF, then the second recursive logic formula is adopted. Where i is an integer greater than or equal to 0. The constant in the first recursive logic formula can be represented as B0, and the constant in the second recursive logic formula can be represented as B1. Then the initial elements, the first array, and the recursive logic formula satisfy:
[0111] If a i >>> 1 is less than 0x80000000, then
[0112] a i+8 = c7ai+7 ⊕c6a i+6 ⊕c5a i+5 ⊕c4a i+4 ⊕c3a i+3 ⊕c2a i+2 ⊕c1a i+1 ⊕(a i >>>1)⊕B0;
[0113] If a i >>>1 is greater than 0x7FFFFFFF, then
[0114] a i+8 =c7a i+7 ⊕c6a i+6 ⊕c5a i+5 ⊕c4a i+4 ⊕c3a i+3 ⊕c2a i+2 ⊕c1a i+1 ⊕(a i >>>1)⊕B1;
[0115] Among them, B0 and B1 satisfy B0⊕B1=0x8a843082>>1=0x45421841, X>>>h means circularly shifting X right by h positions, and ⊕ is the XOR symbol.
[0116] If in the first array, for example, c2=c3=1, c1=c4=c5=c6=c7=0, c0=2 -1 , then the conditional function can be expressed as:
[0117] If a i >>>1 is less than 0x80000000, then
[0118] a i+8 =a i+3 ⊕a i+2 ⊕(a i >>>1)⊕B0;
[0119] If a i >>>1 is greater than 0x7FFFFFFF, then
[0120] a i+8 =a i+3 ⊕a i+2 ⊕(a i >>>1)⊕B1.
[0121] Understandably, the sequence period is 2 256 -1, it means that the k initial elements can be processed according to the first recursive logic formula and / or the second recursive logic formula to obtain a length of 2 256-1 output element, so that the generated pseudo-random sequence has a large period.
[0122] Based on this embodiment, different bits are selected as conditional discriminant bits to obtain multiple different recursive logic formulas. Different recursive logic formulas can generate different random sequences. Therefore, this method can provide more methods for generating random sequences, thereby improving the efficiency of generating sequence passwords.
[0123] The first device may process the k initial elements according to the recursive polynomial in the above manner to obtain multiple output elements. The first device may concatenate the coefficients of each element in the k elements and the output elements to obtain a binary number corresponding to the element. The first device may concatenate the binary numbers of all elements to obtain a pseudo-random sequence. The first device may use a partial continuous sequence or the entire sequence of the pseudo-random sequence as a first pseudo-random sequence.
[0124] Based on step S107, the first device processes the k initial elements according to the recursive logic formula to obtain the first pseudo-random sequence, which can improve the efficiency of generating the first pseudo-random sequence. At the same time, the first device can select different recursive logic formulas according to preset conditions, thereby improving the diversity of the generated pseudo-random sequence.
[0125] S108: The first device outputs a first pseudo-random sequence, and generates a sequence password according to the first pseudo-random sequence.
[0126] Specifically, the first device can use part or all of the first pseudo-random sequence as a random source sequence to generate a sequence password, thereby generating a random number sequence of a large-period sequence password. The specific method of generating a sequence password based on the random source sequence can refer to the prior art and will not be discussed here.
[0127] In addition, the present application also provides a method for verifying whether the generated pseudo-random sequence has a large period. The following describes how to verify whether the pseudo-random sequence has a large period:
[0128] Specifically, the first device can generate multiple output elements that are expanded into a binary sequence, and use the BMP iterative algorithm or solve a linear equation system to obtain the polynomial corresponding to the binary sequence. If the polynomial is a reducible polynomial, or the degree of the polynomial is less than n, it means that a pseudo-random sequence with a large period cannot be generated according to the recursive logic formula. Therefore, it is necessary to redetermine the first array to construct a new recursive logic formula and / or redetermine the irreducible polynomial to construct a new Galois field.
[0129] For example, a Galois field with a number of 32 is used as an example. The sequence period is 2 256 -1, that is, n = 256, some or all of the output elements can be represented as a0, a1, a2, ..., a15 , ..., a n The first array can be represented as c0=2, c1, c2, c3, c4, c5, c6 and c7.
[0130] The first device can place a0, a1, a2, ..., a 15 , ..., a n , some of the continuous polynomials in, or all of the polynomials are expanded to obtain a binary sequence of at least 512 in length, and the binary sequence is processed using the BMP iterative algorithm or by solving a system of linear equations to obtain the polynomial corresponding to the binary sequence. If the polynomial is a reducible polynomial, or the degree of the polynomial is less than 256, it means that the binary sequence is a non-primitive sequence, and a pseudo-random sequence with a large period cannot be obtained according to the recursive logic formula. Therefore, c1, c2, c3, c4, c5, c6 and c7 can be reselected to construct a new recursive logic formula. If the binary sequences corresponding to the recursive logic formulas generated by all combinations of c1, c2, c3, c4, c5, c6 and c7 are non-primitive sequences, irreducible polynomials can be reselected to construct a new Galois field.
[0131] Based on this embodiment, after generating some output elements, the recursive logic formula and / or finite field can be verified according to the some output elements to ensure that a pseudo-random sequence with a large period can be generated according to the recursive logic formula and / or finite field.
[0132] Based on the above content and the same concept, the present application provides a pseudo-random sequence determination device. Figure 2 A schematic diagram of a modular structure of a pseudo-random sequence determination device provided in an embodiment of the present application. The device includes a processing module 202 and a communication module 201.
[0133] The processing module 202 is used to determine an irreducible polynomial whose coefficients are all 0 or 1 according to the word length of the preset storage unit, and the degree of the irreducible polynomial is the same as the word length of the storage unit. The processing module 202 is also used to construct a corresponding Galois field according to the irreducible polynomial. The communication module 201 is used to obtain the numerical value and the first array corresponding to the modular polynomial of the Galois field, the numerical value corresponding to the modular polynomial includes all the coefficients of the modular polynomial, the first array includes a number with a numerical value of 2 and m numbers with numerical values of 0 or 1, and m is a positive integer. The processing module 202 is also used to determine the second numerical value corresponding to the first numerical value according to the numerical value corresponding to the modular polynomial and the first numerical value, the first numerical value is any numerical value among multiple random numerical values, and the exclusive OR result of the first numerical value and the second numerical value is the numerical value corresponding to the modular polynomial. The processing module 202 is also used to determine the first recursive logic formula according to the first array and the first numerical value, the first array is the coefficient of the first recursive logic formula, and the first numerical value is the constant of the first recursive logic formula. And, the processing module 202 is further used to determine the second recursive logic formula according to the first array and the second value, the first array is the coefficient of the second recursive logic formula, and the second value is the constant of the second recursive logic formula. The processing module 202 is further used to process k initial elements according to the first recursive logic formula and / or the second recursive logic formula to obtain a first pseudo-random sequence, the k initial elements are polynomials with coefficients of 0 and / or 1, and k is a positive integer greater than m. The processing module 202 is further used to output the first pseudo-random sequence and generate a sequence password according to the first pseudo-random sequence.
[0134] In one implementable manner, the k initial elements are all polynomials on the Galois Field, and the result of adding and / or multiplying any elements among the k initial elements is an element on the Galois Field.
[0135] In an implementable manner, the processing module 202 is specifically used to: process the k initial elements according to a preset conditional function, recursively obtain multiple output elements of the sequence, and the function in the conditional function is obtained according to the first recursive logic formula and the second recursive logic formula. The k initial elements are concatenated with the output elements to obtain a first pseudo-random sequence.
[0136] In an implementable manner, the processing module 202 is specifically used to: perform cyclic shift processing on the elements at the specified positions of the k initial elements to obtain the cyclically shifted elements. Replace the elements at the specified positions of the k initial elements with the cyclically shifted elements to obtain k elements. Process the k elements according to the conditional function to recursively obtain multiple output elements.
[0137] In one achievable manner, the cyclic shift includes a cyclic left shift and a cyclic right shift.
[0138] In one implementable manner, the cyclically shifted elements are used as a basis for determining the conditional function.
[0139] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown.
[0140] The electronic device in the embodiment of the present application may include a processor 301. The processor 301 is the control center of the device, and various interfaces and lines can be used to connect various parts of the device, by running or executing instructions stored in the memory 303 and calling data stored in the memory 303. Optionally, the processor 301 may include one or more processing units, and the processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 301. In some embodiments, the processor 301 and the memory 303 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.
[0141] The processor 301 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The method steps disclosed in the embodiments of the present application may be directly executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0142] In the embodiment of the present application, the memory 303 stores instructions that can be executed by at least one processor 301. The at least one processor 301 can be used to execute the method steps disclosed in the embodiment of the present application by executing the instructions stored in the memory 303.
[0143] The memory 303 is a non-volatile computer-readable storage medium, which can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 303 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 303 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 303 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0144] In the embodiment of the present application, the device may further include a communication interface 302 , through which the electronic device may transmit data.
[0145] Optional, can be Figure 3 The processor 301 (or the processor 301 and the communication interface 302) implements Figure 2 The processing module 202 and / or the communication module 201 shown, that is, the actions of the processing module 202 and / or the communication module 201 can be executed by the processor 301 (or the processor 301 and the communication interface 302).
[0146] Based on the same inventive concept, the embodiment of the present application also provides a computer-readable storage medium, which may store instructions. When the instructions are executed on a computer, the computer executes the operation steps provided in the above method embodiment. The computer-readable storage medium may be Figure 3 The memory 303 is shown.
[0147] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0148] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0149] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0150] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0151] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for determining a pseudo-random sequence, characterized in that: The method comprises: Determine an irreducible polynomial whose coefficients are all 0 or 1 according to a preset word length of the storage unit, wherein the degree of the irreducible polynomial is the same as the word length of the storage unit; Constructing a corresponding Galois field according to the irreducible polynomial; Obtain a value and a first array corresponding to the modular polynomial of the Galois Field, wherein the value corresponding to the modular polynomial includes all coefficients of the modular polynomial, and the first array includes a number with a value of 2 and m numbers with a value of 0 or 1, where m is a positive integer; Determine, according to a value corresponding to the modulo polynomial and a first value, a second value corresponding to the first value, wherein the first value is any value among a plurality of random values, and an exclusive OR result of the first value and the second value is the value corresponding to the modulo polynomial; Determine a first recursive logic formula according to the first array and the first value, wherein the first array is a coefficient of the first recursive logic formula and the first value is a constant of the first recursive logic formula; and Determine a second recursive logic formula according to the first array and the second value, wherein the first array is a coefficient of the second recursive logic formula, and the second value is a constant of the second recursive logic formula; Processing k initial elements according to the first recursive logic formula and / or the second recursive logic formula to obtain a first pseudo-random sequence, wherein the k initial elements are polynomials with coefficients of 0 and / or 1, and k is a positive integer greater than m; Outputting the first pseudo-random sequence, and generating a sequence password according to the first pseudo-random sequence; The step of processing k initial elements according to the first recursive logic formula and / or the second recursive logic formula to obtain a first pseudo-random sequence includes: Processing the k initial elements according to a preset conditional function to recursively obtain a plurality of output elements of a sequence, wherein the function in the conditional function is obtained according to the first recursive logic formula and the second recursive logic formula; The k initial elements are concatenated with the output element to obtain the first pseudo-random sequence.
2. The method according to claim 1, characterized in that The k initial elements are all polynomials on the Galois Field, and the result of adding and / or multiplying any elements among the k initial elements is an element on the Galois Field.
3. The method according to claim 1, characterized in that The k initial elements are processed according to a preset conditional function to recursively obtain multiple output elements of the sequence, including: Performing a cyclic shift process on the elements at the specified positions of the k initial elements to obtain cyclically shifted elements; Replace the elements at the specified positions of the k initial elements with the cyclically shifted elements to obtain k elements; The k elements are processed according to the conditional function to recursively obtain the multiple output elements.
4. The method according to claim 3, characterized in that The cyclic shift includes cyclic left shift and cyclic right shift.
5. The method according to claim 3, characterized in that The cyclically shifted elements are used as a basis for determining the conditional function.
6. A device for determining a pseudo-random sequence, characterized in that: The device comprises: A processing module, used for determining an irreducible polynomial whose coefficients are all 0 or 1 according to a preset word length of the storage unit, wherein the degree of the irreducible polynomial is the same as the word length of the storage unit; The processing module is further used to construct a corresponding Galois field according to the irreducible polynomial; A communication module, used to obtain a numerical value and a first array corresponding to the modular polynomial of the Galois field, wherein the numerical value corresponding to the modular polynomial includes all coefficients of the modular polynomial, and the first array includes a number with a value of 2 and m numbers with a value of 0 or 1, where m is a positive integer; The processing module is further used to determine a second value corresponding to the first value according to the value corresponding to the modulo polynomial and the first value, the first value is any value among a plurality of random values, and an exclusive OR result of the first value and the second value is the value corresponding to the modulo polynomial; The processing module is further used to determine a first recursive logic formula according to the first array and the first value, wherein the first array is a coefficient of the first recursive logic formula and the first value is a constant of the first recursive logic formula; and The processing module is further used to determine a second recursive logic formula according to the first array and the second value, wherein the first array is a coefficient of the second recursive logic formula, and the second value is a constant of the second recursive logic formula; The processing module is further used to process k initial elements according to the first recursive logic formula and / or the second recursive logic formula to obtain a first pseudo-random sequence, wherein the k initial elements are polynomials with coefficients of 0 and / or 1, and k is a positive integer greater than m; The processing module is further used to output the first pseudo-random sequence and generate a sequence password according to the first pseudo-random sequence; The step of processing k initial elements according to the first recursive logic formula and / or the second recursive logic formula to obtain a first pseudo-random sequence includes: Processing the k initial elements according to a preset conditional function to recursively obtain a plurality of output elements of a sequence, wherein the function in the conditional function is obtained according to the first recursive logic formula and the second recursive logic formula; The k initial elements are concatenated with the output element to obtain the first pseudo-random sequence.
7. The device according to claim 6, characterized in that The k initial elements are all polynomials on the Galois Field, and the result of adding and / or multiplying any elements among the k initial elements is an element on the Galois Field.
8. The device according to claim 6, characterized in that The processing module is specifically used for: Performing a cyclic shift process on the elements at the specified positions of the k initial elements to obtain cyclically shifted elements; Replace the elements at the specified positions of the k initial elements with the cyclically shifted elements to obtain k elements; The k elements are processed according to the conditional function to recursively obtain the multiple output elements.
9. The device according to claim 8, characterized in that The cyclic shift includes cyclic left shift and cyclic right shift.
10. The device according to claim 8, characterized in that The cyclically shifted elements are used as a basis for determining the conditional function.
11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of any one of the methods in claims 1 to 5.
12. A computer-readable storage medium, characterized in that: The method comprises a program code. When the program code is run on an electronic device, the program code is used to enable the electronic device to execute the steps of any method described in claims 1 to 5.
