CN111464296B - Sequence cipher generation method, data encryption method and data decryption method - Google Patents

Sequence cipher generation method, data encryption method and data decryption method Download PDF

Info

Publication number
CN111464296B
CN111464296B CN202010236237.5A CN202010236237A CN111464296B CN 111464296 B CN111464296 B CN 111464296B CN 202010236237 A CN202010236237 A CN 202010236237A CN 111464296 B CN111464296 B CN 111464296B
Authority
CN
China
Prior art keywords
fibonacci
data
sequence
password
standard
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010236237.5A
Other languages
Chinese (zh)
Other versions
CN111464296A (en
Inventor
吴良顺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuo Erzhi Lian Wuhan Research Institute Co Ltd
Original Assignee
Zhuo Erzhi Lian Wuhan Research Institute Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuo Erzhi Lian Wuhan Research Institute Co Ltd filed Critical Zhuo Erzhi Lian Wuhan Research Institute Co Ltd
Priority to CN202010236237.5A priority Critical patent/CN111464296B/en
Publication of CN111464296A publication Critical patent/CN111464296A/en
Application granted granted Critical
Publication of CN111464296B publication Critical patent/CN111464296B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0866Generation of secret information including derivation or calculation of cryptographic keys or passwords involving user or device identifiers, e.g. serial number, physical or biometrical information, DNA, hand-signature or measurable physical characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/065Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/085Secret sharing or secret splitting, e.g. threshold schemes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

The application relates to a method and a device for generating a sequence password, computer equipment and a storage medium. The method comprises the following steps: acquiring and initializing key parameters, generating a random integer pair according to the key parameters, performing sequence coding on the random integer pair by adopting a preset Fibonacci standard system encoder to obtain a Fibonacci standard type bit string, and performing logical OR operation according to bits based on the Fibonacci standard type bit string to generate a sequence password. By adopting the method, the sequence password can be simply and quickly generated on the premise of meeting Golomb randomness assumption, and the data security is higher. The application also relates to a data encryption method, a data encryption device, a computer device, a storage medium, a data decryption method, a data decryption device, a computer device and a storage medium. The data encryption and decryption scheme can enable data encryption and decryption to be simpler and quicker, and reduces consumption of hardware resources and processing time.

Description

Sequence cipher generation method, data encryption method and data decryption method
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for generating a sequence cipher, a computer device and a storage medium, a method and an apparatus for encrypting data, a computer device and a storage medium, and a method and an apparatus for decrypting data, a computer device and a storage medium.
Background
The sequential Cipher, also known as Stream Cipher (Stream Cipher), is one of symmetric Cipher algorithms. The serial cipher has the characteristics of simple realization, convenient hardware implementation, high encryption and decryption processing speed, no or limited error propagation and the like, so that the serial cipher has the advantages in practical application, particularly in a special or confidential institution.
Modern cryptography has two main symmetric encryption methods, stream encryption and block encryption. The stream encryption is to generate a random code stream by using an algorithm and a key, and then generate an encrypted data stream by performing exclusive-or operation with the data stream.
The existing stream encryption algorithm, such as the RC4 stream encryption method, is too complex, consumes more hardware resources and time, and the randomness of the generated key sequence is not high, so the existing stream encryption algorithm has the problem of low encryption efficiency.
Disclosure of Invention
In view of the above, it is necessary to provide a stream-encrypted serial cipher generation method, apparatus, computer device, and storage medium, a data encryption method, apparatus, computer device, and storage medium, and a data decryption method, apparatus, computer device, and storage medium, which can improve encryption efficiency.
A method of sequential cipher generation, the method comprising:
acquiring and initializing key parameters;
generating a random integer pair according to the key parameter;
performing sequence coding on the random integer pair by adopting a preset Fibonacci standard system encoder to obtain a Fibonacci standard type bit string;
and performing logical OR operation according to bits based on the Fibonacci binary standard bit string to generate the sequence password.
In one embodiment, the method further comprises the following steps: and traversing the Fibonacci number sequence, decomposing the integer pair into the Fibonacci standard system to obtain the Fibonacci expression, carrying the position information of each Fibonacci number in the Fibonacci number sequence by the Fibonacci expression, and mapping each Fibonacci number in the Fibonacci expression into the Fibonacci standard system bit string according to the position information.
In one embodiment, the method further comprises the following steps: and intercepting a specific partial sequence of the Fibonacci binary standard bit string, and carrying out logical OR operation according to bits based on the intercepted specific partial sequence to generate a sequence password.
A sequential cipher generation apparatus, the apparatus comprising:
the parameter acquisition module is used for acquiring and initializing key parameters;
the parameter processing module is used for generating a random integer pair according to the key parameter;
the data coding module is used for adopting a preset Fibonacci standard system coder to carry out sequence coding on the random integer pair to obtain a Fibonacci standard system bit string;
and the password sequence generation module is used for carrying out logical OR operation according to bits based on the Fibonacci binary standard bit string to generate a sequence password.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring and initializing key parameters;
generating a random integer pair according to the key parameter;
performing sequence coding on the random integer pair by adopting a preset Fibonacci standard system encoder to obtain a Fibonacci standard type bit string;
and performing logical OR operation according to bits based on the Fibonacci binary standard bit string to generate a sequence password.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring and initializing key parameters;
generating a random integer pair according to the key parameter;
performing sequence coding on the random integer pair by adopting a preset Fibonacci standard system encoder to obtain a Fibonacci standard type bit string;
and performing logical OR operation according to bits based on the Fibonacci binary standard bit string to generate a sequence password.
According to the sequential cipher generation method, the device, the computer equipment and the storage medium, the random integer pair is generated based on initialized key parameters, the random integer pair is subjected to sequential coding by adopting a Fibonacci standard binary coder different from the conventional preset Fibonacci standard binary coder to obtain a Fibonacci standard type bit string, so that one number or character to be coded has multiple coding modes, and then the logical OR operation is carried out according to bits based on the Fibonacci standard type bit string to generate the sequential cipher (stream cipher).
A method of data encryption, the method comprising:
acquiring plaintext information and shared key data, and converting the plaintext information into binary plaintext data;
generating a sequence password according to the shared key data and a preset sequence password generator;
performing exclusive-or operation on the sequence password and the binary plaintext data according to bits to obtain ciphertext data;
sending the ciphertext data to a data receiver;
the preset sequence password generator is constructed based on the sequence password generation method.
A data encryption apparatus, the apparatus comprising:
the data acquisition module is used for acquiring plaintext information and shared key data and converting the plaintext information into binary plaintext data;
the sequence password generating module is used for generating a sequence password according to the shared key data and a preset sequence password generator;
the data encryption module is used for executing exclusive OR operation on the sequence password and the binary plaintext data according to bits to obtain ciphertext data;
the data sending module is used for sending the ciphertext data to a data receiving party;
the preset sequence password generator is constructed based on the sequence password generation method.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring plaintext information and shared key data, and converting the plaintext information into binary plaintext data;
generating a sequence password according to the shared key data and a preset sequence password generator;
performing exclusive-or operation on the sequence password and the binary plaintext data according to bits to obtain ciphertext data;
sending the ciphertext data to a data receiver;
the preset sequence password generator is constructed based on the sequence password generation method.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring plaintext information and shared key data, and converting the plaintext information into binary plaintext data;
generating a sequence password according to the shared key data and a preset sequence password generator;
performing exclusive-or operation on the sequence password and the binary plaintext data according to bits to obtain ciphertext data;
sending the ciphertext data to a data receiver;
the preset sequence password generator is constructed based on the sequence password generation method.
According to the data encryption method, the data encryption device, the computer equipment and the storage medium, the sequence password is generated according to the shared secret key data and the preset sequence password generator, and the exclusive OR operation is performed on the sequence password and the converted binary plaintext data according to the bit to obtain the ciphertext data.
A method of data decryption, the method comprising:
acquiring ciphertext data and shared key data;
generating a sequence password according to the shared key data and a preset sequence password generator;
performing exclusive-or operation on the sequence password and the ciphertext data according to bits to obtain binary plaintext data;
carrying out character encoding on binary plaintext data to obtain plaintext data;
the preset sequence password generator is constructed based on the sequence password generation method.
A data decryption device, the device comprising:
the ciphertext data acquisition module is used for acquiring ciphertext data and shared key data;
the password generation module is used for generating a serial password according to the shared key data and a preset serial password generator;
the binary plaintext data acquisition module is used for executing exclusive OR operation on the sequence password and the ciphertext data according to bits to obtain binary plaintext data;
the data decryption module is used for carrying out character coding on the binary plaintext data to obtain plaintext data;
the preset sequence password generator is constructed based on the sequence password generation method.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring plaintext information and shared key data, and converting the plaintext information into binary plaintext data;
generating a sequence password according to the shared key data and a preset sequence password generator;
performing exclusive-or operation on the sequence password and the binary plaintext data according to bits to obtain ciphertext data;
sending the ciphertext data to a data receiver;
the preset sequence password generator is constructed based on the sequence password generation method.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring plaintext information and shared key data, and converting the plaintext information into binary plaintext data;
generating a sequence password according to the shared key data and a preset sequence password generator;
performing exclusive-or operation on the sequence password and the binary plaintext data according to bits to obtain ciphertext data;
sending the ciphertext data to a data receiver;
the preset sequence password generator is constructed based on the sequence password generation method.
According to the data decryption method, the data decryption device, the computer equipment and the storage medium, the sequence password is generated in the same way according to the shared secret key data and the preset sequence password generator, the exclusive OR operation is performed on the sequence password and the ciphertext data according to bits to obtain the binary plaintext data, and then the binary plaintext data is subjected to character encoding to obtain the plaintext data.
Drawings
FIG. 1 is a flow diagram illustrating a method for generating a sequential cipher according to one embodiment;
FIG. 2 is a flow chart illustrating a method for generating a serial cipher according to another embodiment;
FIG. 3 is a diagram showing an application environment of a data encryption method and a data decryption method in one embodiment;
FIG. 4 is a flow diagram illustrating a method for encrypting data in one embodiment;
FIG. 5 is a flow diagram that illustrates a method for decrypting data, according to one embodiment;
FIG. 6 is a diagram illustrating an application of the data encryption and data decryption method in one embodiment;
FIG. 7 is a block diagram showing the structure of a sequential cipher generation apparatus according to an embodiment;
FIG. 8 is a block diagram showing the construction of a data encryption apparatus according to an embodiment;
FIG. 9 is a block diagram showing the structure of a data decryption apparatus according to an embodiment;
FIG. 10 is a diagram showing an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a method for generating a sequence password is provided, which is described by taking the method as an example applied to the terminal in fig. 1, and it is understood that the method may also be applied to a server, and may also be applied to a system including the terminal and the server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step 102, key parameters are obtained and initialized.
In practical applications, the key parameter refers to a parameter for generating a sequence cipher, and in this application, the sequence cipher may also be referred to as a random code stream cipher sequence. Specifically, the key parameter includes a pair of keys, a pair of integers, and a plaintext sequence length. A pair of keys (K)1,K2) Wherein each key K1,K2Consists of three integers:
Figure BDA0002431065290000061
integer pair (N)0,M0) (initial value), the following condition is satisfied:
Figure BDA0002431065290000062
and 104, generating a random integer pair according to the key parameter.
After the key parameters are initialized, a random integer sequence (pseudo-random integer sequence) may be generated in a modulo manner. Specifically, the random integer sequence may be:
Figure BDA0002431065290000063
the generation of the random integer pair based on the key parameter may specifically be performed in the following manner:
Figure BDA0002431065290000064
and step 106, performing sequence coding on the random integer pair by adopting a preset Fibonacci standard binary encoder to obtain a Fibonacci standard bit string.
The fibonacci number, also known as the golden section number series, also known as the rabbit number series, refers to such a number series: 1. 1,2,3,5,8,13,21,34, … … mathematically, the fibonacci number series is defined in a recursive way as follows: f (1) ═ 1, F (2) ═ 1, F (N) ═ F (N-1) + F (N-2) (N ≧ 3, N ∈ N ×), characterized by the beginning of item 3, each of which is equal to the sum of the first two items. In this embodiment, the fibonacci standard binary encoder is designed based on a fibonacci standard binary system, that is, the fibonacci standard binary encoder is used for encoding, and any integer can be represented by one or more fibonacci numbers, so that any standard fibonacci binary conversion is realized, and an encoder for generating the random code stream cipher sequence C in the stream encryption method is further generated. Specifically, any integer may be converted into a fibonacci scale standard bit string containing a specific meaning, and the bit string may be a 0,1 bit string with a specific meaning. The coding rule of the encoder is not unique due to the characteristics of the Fibonacci series. The design principles of a fibonacci standard encoder include: (1) "100" (low on the right) can be converted to "011"; (2) because F0The lowest position may be 0 or 1, so that 0 is the lowest position; (3) due to F1=F2Thus, if the fibonacci expression is to be incremented by 1, the number 1 can be generated at bit 1 and also at bit 2. Therefore, the codes formed by the Fibonacci encoder are not unique, and the diversity of the codes is increased.
Specifically, the sequence encoding of the random integer pair to obtain the fibonacci scale standard type bit string may be:
the length H of the plaintext sequence is determined by the length of the plaintext P, and all integers Ni,Mi(i ═ 1,2, …, H) are all expressed in fibulacci scale notation of length L (S)L(Ni) And SL(Mi)):
Figure BDA0002431065290000071
And step 108, performing logical OR operation according to bits based on the Fibonacci binary standard bit string to generate a sequence password.
Bitwise logical or operations belong to one type of bitwise logical operations whose operands (operands) are treated as a 32-bit or 64-bit sequence of bits (consisting of 0's and 1's) rather than decimal, hexadecimal or octal values. Logical OR operations are two objects participating in an operation, and are ORed by binary bits. After the fibonacci system standard type bit string is obtained, aiming at the fibonacci system standard type bit string, the middle part can be intercepted to carry out bitwise logic OR operation, and a sequence password C is generated.
According to the sequence cipher generation method, a random integer pair is generated based on initialized key parameters, a Fibonacci standard type bit string is obtained by adopting a preset Fibonacci standard type encoder different from a conventional Fibonacci standard type encoder to carry out sequence encoding on the random integer pair, a number or a character to be encoded has multiple encoding modes, and then a logic or operation is carried out according to bits based on the Fibonacci standard type bit string to generate a sequence cipher (stream cipher).
In one embodiment, as shown in FIG. 2, step 106 comprises: and step 126, traversing the Fibonacci number sequence, decomposing the integer pair into the Fibonacci standard system to obtain the Fibonacci expression, carrying the position information of each Fibonacci number in the Fibonacci number sequence by the Fibonacci expression, and mapping each Fibonacci number in the Fibonacci expression into the Fibonacci standard system bit string according to the position information.
In specific implementation, the meaning of standard fibulacci binary conversion of integers is as follows: expressing the integer N as the sum of mutually different r Fibonacci numbers, i.e. expressing N as
Figure BDA0002431065290000081
If we map all Fiberacci numbers in a Fiberacci representation of an integer N in position into a bit string of 0,1 (Binary Sequence), i.e. the kth bit string1,k2,…,krPosition 1, and the remaining position 0, then this digital representation is referred to as a "Fibonacci scale". The encoding process using a fibonacci encoder may include:
s1, traversing the Fibonacci number series {0,1,1,2,3,5,8,13,21,34,55,89 … }, and connecting N in the integer pairsi,Mi(i ═ 1,2, …, H) is expressed as the sum of the reciprocal r fibonacci numbers, giving a fibonacci expression:
Figure BDA0002431065290000082
Figure BDA0002431065290000083
wherein k is1、k2、…krRepresenting the position information of the Fibonacci number in the Fibonacci number sequence;
s2, mapping the Fibonacci number to the bit string composed of 0,1 according to the position information, namely, the kth bit string1,k2,…,krAnd at the position 1 and the rest positions 0, obtaining a Fibonacci system standard bit string. For example, the process of converting integers 17 and 20 using a fibonacci standard binary encoder includes (note that in the binary conversion, the right side is low, and the reading is from right to left, and the first number 0 of the fibonacci number sequence represents F0The next 1 bit represents F1): first, when the integer 17 is expressed as the sum of the mutually different fibonacci numbers, there are: 17-1 +3+13, the resulting fibonacci expression is 17-F1+F4+F7Correspondingly, the 1 st, 4 th and 7 th positions of the subscript positions (starting from the 0 th position) are set to 1, and the remaining positions are 0, so that the fibonacci bit string of the integer 17 is 01001001. The integer 20 may represent 20 ═ 2+5+13, and the corresponding fibonacci expression is 20 ═ F3+F5+F7Correspondingly, the No. 3, No. 5 and No. 7 of the subscript positions (from No. 0) are set as 1, and the rest positions are 0, so that the Fibon wave of the integer 20 is obtainedThe chey bit string is 00010101.
…89 55 34 21 13 8 5 3 2 1 1 0
1 0 0 1 0 0 1 0(17=F1+F4+F7)
1 0 1 0 1 0 0 0(20=F3+F5+F7)
The Fibonacci standard binary encoder can be realized by hardware or software, and the realization algorithm can be realized by the following steps:
s1: sequentially traversing Fiberacci number series { Fi1,2, … if Fi>N, record index i-1, stop traversing, go to S2.
S2: calculation of N-Fi-1If N-Fi-1When the value is equal to 0, the algorithm is terminated and S3 is performed; otherwise, let N be N-Fi-1And returns to S1.
S3: and setting the positions of all recorded subscripts to be 1 and setting the other positions to be 0 to obtain corresponding codes.
In this embodiment, the design principle of the fibonacci standard binary encoder includes: (1) "100" (low on the right) can be converted to "011"; (2) because F0The lowest position may be 0 or 1, so that 0 is the lowest position; (3) due to F1=F2Thus, if the fibonacci expression is to be incremented by 1, the number 1 can be generated at bit 1 and also at bit 2. Therefore, the codes formed by the Fibonacci encoder are not unique, and the diversity of the codes is increased. For example, a sensor data stream collected by an internet of things device is: 70, 105, 98, 111, 110, 97, 99, 99, 105, and the number N is assumed to have a CountFibExp(N) (i.e., the encoding method using Fibonacci standard binary encoder), CountFibExp(70)=20,CountFibExp(105)=30,CountFibExp(98)=30,CountFibExp(111)=28,CountFibExp(110)=20,CountFibExp(97)=24,CountFibExp(99) 24. In this embodiment, the fibonacci encoder is used to encode, so that one number has multiple encoding modes, and one data stream is encoded according to the idea of permutation and combinationThe code mode is not only a traditional mode, and various coding modes can be evolved, so that the cracking difficulty is increased.
In one embodiment, as shown in FIG. 2, step 108 comprises: and 128, intercepting a specific partial sequence of the Fibonacci binary standard type bit string, and performing logical OR operation according to bits based on the intercepted specific partial sequence to generate a sequence password.
In specific implementation, for a fibonacci scale standard bit string with length L and number m of 1, the probability of 1 appearing at the kth position is:
PL,m(k)=NL,m(k)/NL,m (6)
wherein N isL,m(k)=NL,m(m) is constant when m<k<At L-m +1, then:
Figure BDA0002431065290000101
from (6) and (7), when m < k < L-m +1, the probability of 1 occurring at the k-th position is constant, that is, the probability of 1 occurring in the interval (m, L-m +1) is constant.
Intercepting the middle part (m, L-m +1) (the occurrence probability of 1 is constant), and carrying out logic OR (OR) operation according to bits to obtain a code sequence (sequence code) C with the length of ti
Ci={c1,c2,…,ct} (8)
Wherein t is L-2UL+2,ULIs a parameter, and
Cj=nk+mk(j=1,2,…t;k=UL+j-1) (9)
wherein, ULThe most likely form is:
Figure BDA0002431065290000102
the subsequence C was obtained in the manner described aboveiThen will notIdentical subsequence CiAnd juxtaposing to form the final code sequence C.
C={C1,C2,…,CH} (11)
To more clearly describe the method for generating a sequence cipher provided by the present application, the following description will be made with reference to an example:
assume that the initialized key parameters are:
Figure BDA0002431065290000103
Figure BDA0002431065290000104
Figure BDA0002431065290000105
H=1000
pseudo-random integer sequence N ═ { N) generated according to equation (4)1,N2,…,NHAnd M ═ M1,M2,…,MHExpressing the integer sequence as a Fiberacci scale standard SL(Ni) And SL(Mi) The length L of the fibonacci scale standard bit string is 47, which is obtained by combining (9) and (10), UL13, t-23, pairs S in each standard formula (m, L-m +1)L(Ni) And SL(Mi) Performing logical OR (OR) operation according to bit to obtain cipher sequence C with length tiH code sequences CiThe length of the final sequence cipher (random code stream cipher sequence) C obtained by the combination is Λ ═ Ht ═ 23000, specifically, C ═ 001010111010110011000001110001010010100011100 … (23000 bits in total).
The present application also provides a data encryption method, which can be applied to the application environment diagram shown in fig. 3, wherein a data sender 102 (pre-configured with a sequence cipher generator) communicates with a data receiver 104 (also pre-configured with a sequence cipher generator) via a network, and the data sender 102 and the data receiver 104 share a secret key K. Specifically, when the data sender 102 and the data receiver 104 establish a connection, the data sender 102 obtains plaintext information and shared key data, converts the plaintext information into binary plaintext data, generates a serial password according to the shared key data and a preset serial password generator (a serial password device is constructed based on the serial password method), performs an exclusive or operation on the serial password and the binary plaintext data according to bits to obtain ciphertext data, and finally sends the ciphertext data to the data receiver 104 to complete data encryption. The data sender 102 and the data receiver 104 may be, but are not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices.
In one embodiment, as shown in fig. 4, a data encryption method is provided, which is described by taking the data sender in fig. 3 as an example, and includes the following steps:
step 202, obtaining plaintext information and shared key data, and converting the plaintext information into binary plaintext data;
step 204, generating a sequence password according to the shared secret key data and a preset sequence password generator, wherein the preset sequence password generator is constructed based on the sequence password generation method;
step 206, performing an exclusive or operation on the sequence password and the binary plaintext data according to bits to obtain ciphertext data;
and step 208, sending the ciphertext data to a data receiving party.
By plain text, it is meant words (or strings) without encryption, which in a communication system may be a bit stream, such as text, bitmaps, digitized speech or digitized video images, etc. The shared key data is shared by the data sender and the data receiver, and specifically comprises N0,M0,K1,K2H, the aforementioned key parameters (integer pair, key pair, and plaintext sequence length). In the specific implementation, the data sender passes the informationThe encoding mode converts the plaintext information into binary information P ═ P1,p2,…,pLAnd then generating a random code stream cipher sequence C (C) according to the shared secret key K and the sequence cipher generator1,c2,…,cLAnd then, carrying out exclusive-or operation according to the bit to obtain ciphertext data X:
Figure BDA0002431065290000121
and then the ciphertext data X is sent to a data receiving party.
In the data encryption method, the sequence password is generated according to the shared secret key data and the preset sequence password generator, and the exclusive OR operation is performed on the sequence password and the binary plaintext data obtained by conversion according to bits to obtain the ciphertext data.
The application also provides a data decryption method, which can be applied to the application environment diagram shown in FIG. 3. Specifically, as shown in fig. 5, taking the application of the method to the data receiving end in fig. 3 as an example for explanation, the method includes the following steps:
step 302, ciphertext data and shared key data are obtained;
step 304, generating a sequence password according to the shared secret key data and a preset sequence password generator, wherein the preset sequence password generator is constructed based on the sequence password generation method;
step 306, performing exclusive or operation on the sequence password and the ciphertext data according to bits to obtain binary plaintext data;
and 308, performing character coding on the binary plaintext data to obtain plaintext data.
In specific implementation, the data receiving party obtains the ciphertext data X, and generates a sequence cipher (random code stream cipher sequence) C ═ C according to the shared secret key K and the sequence cipher generator1,c2,…,cLExecuting XOR operation on the sequence cipher and the ciphertext data X according to the bit
Figure BDA0002431065290000122
And obtaining binary plaintext data P, and recovering the plaintext data in a character coding mode. Here, the data transmitting side and the data receiving side share a secret key K (including N)0,M0,K1,K2The implementation of H) is typically: the data sender encrypts K by the public key PK of the data receiver to obtain EPK(K) And then E isPK(K) And sending the data to a data receiving party. The data receiver decrypts D by own private key SKSK(EPK(K) K) to obtain K.
In the data decryption method, the sequence password is generated according to the shared secret key data and the preset sequence password generator, the exclusive OR operation is carried out on the sequence password and the ciphertext data according to the bit to obtain the binary plaintext data, and then the binary plaintext data is subjected to character coding to obtain the plaintext data.
To facilitate understanding of the data encryption and data decryption methods provided herein, reference will now be made to FIG. 6 and an example in which:
when a data sender wants to send plaintext information a ═ Fibonacci "to a data receiver, the plaintext information a needs to be first converted into binary plaintext P ═ P through an encoding table1,p2,…,pLAnd then using a shared secret key K (shared by a data sending party and a data receiving party), generating a random code stream cipher sequence C (C) by a random code stream cipher sequence generator1,c2,…,cLAnd performing bitwise XOR operation on the binary plaintext P and the random code stream cipher sequence C to obtain ciphertext data X:
Figure BDA0002431065290000131
and sending the ciphertext data X to a data receiving party. The data receiving party receives the ciphertext data X, generates a random code stream cipher sequence C through a random code stream cipher sequence generator by using the shared secret key K, and then generates a random code stream cipher sequence C through a random code stream cipher sequence generatorObtaining binary plaintext data to execute by executing XOR operation on the sequence cipher and the ciphertext data according to bits
Figure BDA0002431065290000132
And then the plaintext information A is recovered through the character coding table.
It should be understood that although the steps in the flowcharts of fig. 1,2, 4, and 5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1,2, 4 and 5 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 7, there is provided a sequential password generation apparatus including: a parameter obtaining module 710, a parameter processing module 720, a data encoding module 730 and a cipher sequence generating module 740, wherein:
and a parameter obtaining module 710, configured to obtain and initialize the key parameter.
And a parameter processing module 720, configured to generate a random integer pair according to the key parameter.
And the data encoding module 730 is configured to perform sequence encoding on the random integer pair by using a preset fibonacci standard binary encoder to obtain a fibonacci standard binary bit string.
And the password sequence generating module 740 is configured to perform a logical or operation bitwise based on the fibonacci scale standard type bit string to generate a sequence password.
In one embodiment, the data encoding module 730 is further configured to traverse the fibonacci number sequence, decompose the integer pair into a fibonacci standard system, and obtain a fibonacci expression, where the fibonacci expression carries position information of each fibonacci number in the fibonacci number sequence, and map each fibonacci number in the fibonacci expression into a fibonacci standard bit string according to the position information.
In one embodiment, the cipher sequence generation module 740 is further configured to intercept a specific partial sequence of the fibonacci scale standard bit string, and perform a logical or operation bitwise based on the intercepted specific partial sequence to generate the sequence cipher.
In one embodiment, as shown in fig. 8, there is provided a data encryption apparatus including: data acquisition module 810, sequence password generation module 820, data encryption module 830 and data transmission module 840, wherein:
and a data obtaining module 810, configured to obtain plaintext information and shared key data, and convert the plaintext information into binary plaintext data.
And a sequence cipher generation module 820, configured to generate a sequence cipher according to the shared key data and a preset sequence cipher generator, where the preset sequence cipher generator is constructed based on the sequence cipher generation method.
And the data encryption module 830 is configured to perform an exclusive or operation on the sequence cipher and the binary plaintext data according to bits to obtain ciphertext data.
And the data sending module 840 is configured to send the ciphertext data to a data receiving party.
In one embodiment, as shown in fig. 9, there is provided a data decryption apparatus including: ciphertext data obtaining module 910, password generating module 920, binary plaintext data obtaining module 930, and data decrypting module 940, wherein:
the ciphertext data obtaining module 910 is configured to obtain ciphertext data and shared key data.
And a password generating module 920, configured to generate a serial password according to the shared secret key data and a preset serial password generator, where the preset serial password generator is constructed based on the serial password generating method.
The binary plaintext data obtaining module 930 is configured to perform an exclusive or operation on the sequence cipher and the ciphertext data according to bits to obtain binary plaintext data.
The data decryption module 940 is configured to perform character encoding on the binary plaintext data to obtain plaintext data.
For specific limitations of the sequential password generation device, reference may be made to the above limitations on the sequential password generation method, for specific limitations of the data encryption device, reference may be made to the above limitations on the data encryption method, and for specific limitations of the data decryption device, reference may be made to the above limitations on the data decryption method, which are not described herein again. The various modules in the above-described apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 10. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a sequential cipher generation method, a data encryption method, and a data decryption method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 10 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a processor is provided that is operable to perform at least one of the above-described method of sequential cipher generation, data encryption, or data decryption.
In one embodiment, a computer device is provided, which includes a memory and a processor, wherein the memory stores a computer program, and the processor can implement the steps of the above-mentioned sequential cipher generation method, data encryption method or data decryption method when executing the computer program.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, can implement the steps in the above-described sequential password generation method, data encryption method, or data decryption method.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of sequential cipher generation, the method comprising:
acquiring and initializing key parameters, wherein the key parameters comprise a pair of keys, a pair of integers and a plaintext sequence length;
generating a random integer pair according to the key parameter;
performing sequence coding on the random integer pair by adopting a preset Fibonacci standard system encoder to obtain a Fibonacci standard type bit string;
and performing logical OR operation according to bits based on the Fibonacci binary standard bit string to generate a sequence password.
2. The method of claim 1, wherein the sequence encoding the random integer pair using a preset Fibonacci standard binary encoder to obtain a Fibonacci standard bit string comprises:
traversing a Fibonacci number sequence, decomposing the integer pair into a Fibonacci standard system to obtain a Fibonacci expression, wherein the Fibonacci expression carries position information of each Fibonacci number in the Fibonacci number sequence;
and mapping each Fibonacci number in the Fibonacci expression into a Fibonacci scale standard bit string according to the position information.
3. The method of claim 1, wherein bitwise logically oring based on the fibonacci scale standard bit string generates a sequential cipher comprising:
intercepting a specific partial sequence of the Fibonacci binary standard type bit string;
and performing logical OR operation according to bits based on the intercepted specific partial sequence to generate a sequence password.
4. The method of claim 1, wherein the coding rules of the preset Fibonacci standard binary encoder are non-unique.
5. A method of data encryption, the method comprising:
acquiring plaintext information and shared key data, and converting the plaintext information into binary plaintext data;
generating a sequence password according to the shared key data and a preset sequence password generator;
performing exclusive-or operation on the sequence password and the binary plaintext data according to bits to obtain ciphertext data;
sending the ciphertext data to a data receiver;
wherein the preset sequential cipher generator is constructed based on the sequential cipher generation method of any one of claims 1 to 4.
6. A method of data decryption, the method comprising:
acquiring ciphertext data and shared key data;
generating a sequence password according to the shared key data and a preset sequence password generator;
performing exclusive-or operation on the sequence password and the ciphertext data according to bits to obtain binary plaintext data;
carrying out character encoding on the binary plaintext data to obtain plaintext data;
wherein the preset sequential cipher generator is constructed based on the sequential cipher generation method of any one of claims 1 to 4.
7. A sequential cipher generation apparatus, comprising:
the parameter acquisition module is used for acquiring and initializing key parameters, wherein the key parameters comprise a pair of keys, a pair of integers and a plaintext sequence length;
the parameter processing module is used for generating a random integer pair according to the key parameter;
the data coding module is used for adopting a preset Fibonacci standard system encoder to carry out sequence coding on the random integer pair to obtain a Fibonacci standard system bit string;
and the password sequence generation module is used for carrying out logical OR operation according to bits based on the Fibonacci binary standard bit string to generate a sequence password.
8. The apparatus of claim 7, wherein the data encoding module is further configured to traverse a fibonacci number sequence, decompose the integer pair into fibonacci standard bins, and obtain a fibonacci expression that carries position information of each fibonacci number in the fibonacci number sequence; and mapping each Fibonacci number in the Fibonacci expression into a Fibonacci scale standard bit string according to the position information.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
CN202010236237.5A 2020-03-30 2020-03-30 Sequence cipher generation method, data encryption method and data decryption method Active CN111464296B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010236237.5A CN111464296B (en) 2020-03-30 2020-03-30 Sequence cipher generation method, data encryption method and data decryption method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010236237.5A CN111464296B (en) 2020-03-30 2020-03-30 Sequence cipher generation method, data encryption method and data decryption method

Publications (2)

Publication Number Publication Date
CN111464296A CN111464296A (en) 2020-07-28
CN111464296B true CN111464296B (en) 2020-12-25

Family

ID=71680177

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010236237.5A Active CN111464296B (en) 2020-03-30 2020-03-30 Sequence cipher generation method, data encryption method and data decryption method

Country Status (1)

Country Link
CN (1) CN111464296B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112202548A (en) * 2020-12-07 2021-01-08 卓尔智联(武汉)研究院有限公司 Stream encryption key stream generation method, device, circuit and encryption method
CN112235319B (en) * 2020-12-09 2021-03-16 卓尔智联(武汉)研究院有限公司 Data encryption and decryption method and device and encryption and decryption circuit
CN112231740B (en) * 2020-12-10 2021-03-16 卓尔智联(武汉)研究院有限公司 Data encryption method, data decryption method, data encryption device, computer device, and medium
CN114422800B (en) * 2021-12-14 2023-06-06 统信软件技术有限公司 Data encryption method and device and computing equipment
CN114168993B (en) * 2022-02-15 2022-06-03 佛山市达衍数据科技有限公司 Enterprise data processing method, system, computer device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9544277B1 (en) * 2015-09-09 2017-01-10 Roger G Marshall KAFKA: A cellular automation / complex Fibonacci sequences-based technique for encrypting and decrypting audio, video and text messages
CN107342865A (en) * 2017-06-20 2017-11-10 贵州信安创科技有限公司 A kind of authentication encryption algorithm and decipherment algorithm based on SM4
CN109495240A (en) * 2018-12-06 2019-03-19 齐齐哈尔大学 Based on three rank Fibonacci chaos system pseudo-random sequence generator design method of broad sense

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6894631B1 (en) * 2004-03-31 2005-05-17 Analog Devices, Inc. Pipeline ADC digital dithering for increased digital calibration resolution
CN201936335U (en) * 2011-01-20 2011-08-17 广东商学院 RFID (radio frequency identification) electronic tag chip with encryption function
US20160260013A1 (en) * 2015-03-06 2016-09-08 Nokia Technologies Oy Method and apparatus for optimization
CN109934364B (en) * 2019-03-10 2023-04-25 西北工业大学 Tool on-time distribution method based on genetic simulated annealing algorithm

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9544277B1 (en) * 2015-09-09 2017-01-10 Roger G Marshall KAFKA: A cellular automation / complex Fibonacci sequences-based technique for encrypting and decrypting audio, video and text messages
CN107342865A (en) * 2017-06-20 2017-11-10 贵州信安创科技有限公司 A kind of authentication encryption algorithm and decipherment algorithm based on SM4
CN109495240A (en) * 2018-12-06 2019-03-19 齐齐哈尔大学 Based on three rank Fibonacci chaos system pseudo-random sequence generator design method of broad sense

Also Published As

Publication number Publication date
CN111464296A (en) 2020-07-28

Similar Documents

Publication Publication Date Title
CN111464296B (en) Sequence cipher generation method, data encryption method and data decryption method
CA2723319C (en) A closed galois field cryptographic system
KR101267109B1 (en) Cryptographic primitives, error coding, and pseudo-random number improvement methods using quasigroups
JP4728657B2 (en) Stream cipher design using rotation buffer
CN109951268B (en) Encryption and decryption method and device based on bit permutation and bit permutation
US8180048B2 (en) Method and system for computational transformation
CN111431716B (en) Data transmission method and device, computer equipment and storage medium
CN112231740B (en) Data encryption method, data decryption method, data encryption device, computer device, and medium
CN111866018B (en) Data information encryption transmission method and device, computer equipment and storage medium
CN109981249B (en) Encryption and decryption method and device based on zipper type dynamic hash and NLFSR
CN112769545B (en) Image encryption method based on adjacent pixel Joseph transformation and Mealy state machine
CN111010266B (en) Message encryption and decryption, reading and writing method and device, computer equipment and storage medium
US20220417000A1 (en) Random position cipher encryption using scrambled ascii strings
WO2023030316A1 (en) Key generation and distribution method, key generation apparatus, and key management system
Zhdanov et al. Block symmetric cryptographic algorithm based on principles of variable block length and many-valued logic
Manucom et al. Analysis of key randomness in improved one-time pad cryptography
CN113098675A (en) Binary data encryption system and method based on polynomial complete homomorphism
Xiong et al. A bit-plane encryption algorithm for RGB image based on modulo negabinary code and chaotic system
Abdo et al. A hybrid approach to secure and compress data streams in cloud computing environment
CN116796345A (en) Encryption and decryption method, device, equipment and storage medium
Dhane et al. A novel high capacity reversible data hiding through encryption scheme by permuting encryption key and entropy analysis
Mangi et al. Encrypting of text based on chaotic map
Mahmood et al. MATLAB Implementation of 128-key length SAFER+ Cipher System
CN117527325B (en) Encryption and decryption method and system for new energy station data
JP2001308846A (en) Stream cipher

Legal Events

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