CN112202548A - Stream encryption key stream generation method, device, circuit and encryption method - Google Patents
Stream encryption key stream generation method, device, circuit and encryption method Download PDFInfo
- Publication number
- CN112202548A CN112202548A CN202011418785.6A CN202011418785A CN112202548A CN 112202548 A CN112202548 A CN 112202548A CN 202011418785 A CN202011418785 A CN 202011418785A CN 112202548 A CN112202548 A CN 112202548A
- Authority
- CN
- China
- Prior art keywords
- sequence
- key
- integer
- stream
- 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.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic 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/065—Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0869—Generation 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 stream encryption key stream generation method, a stream encryption key stream generation device, a stream encryption key stream generation circuit and an encryption method. The method comprises the following steps: determining the serial number of the current element, selecting a first element corresponding to the serial number of the current element from the first pseudorandom integer sequence, and selecting a second element corresponding to the serial number of the current element from the second pseudorandom integer sequence; converting the first element and the second element into Fibonacci binary standard forms to respectively obtain a first standard form and a second standard form, intercepting a first intermediate sequence from the first standard form, and intercepting a second intermediate sequence from the second standard form; performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining the key subsequence of the next round until the pseudo-random integer sequence is traversed; and (4) paralleling each round of key subsequences according to the sequence of the element sequence numbers to obtain the key stream, so that the generation speed of the key stream can be increased.
Description
Technical Field
The present invention relates to the field of encryption technologies, and in particular, to a method, an apparatus, a circuit, and an encryption method for generating a stream encryption key stream.
Background
With the development of encryption technology, stream encryption has emerged. Stream encryption is one of symmetric encryption algorithms, and the same pseudorandom encryption data stream is used as a key on an encryption side and a decryption side, so that plaintext data and the key are correspondingly encrypted to generate ciphertext data during encryption, and the ciphertext data and the key are correspondingly decrypted to obtain the plaintext data during decryption, thereby completing data security transmission.
However, the inventors have found that at least the following problems exist in the conventional techniques: the conventional technology has the problem of slow key stream generation speed.
Disclosure of Invention
In view of the above, it is necessary to provide a stream encryption key stream generation method, apparatus, circuit and encryption method capable of increasing the key stream generation speed, in order to solve the problem of slow key stream generation speed in the conventional technology.
A stream encryption keystream generation method, comprising:
determining a current element serial number, selecting a first element corresponding to the current element serial number from the first pseudorandom integer sequence, and selecting a second element corresponding to the current element serial number from the second pseudorandom integer sequence;
converting the first element and the second element into Fibonacci binary standard forms to respectively obtain a first standard form and a second standard form, intercepting a first intermediate sequence from the first standard form, and intercepting a second intermediate sequence from the second standard form;
performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining the key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed;
and paralleling the key subsequences of each round according to the sequence of the element sequence numbers to obtain the key stream.
In one embodiment, the step of truncating the first intermediate sequence from the first normal form and the step of truncating the second intermediate sequence from the second normal form comprises:
and intercepting the first intermediate sequence from the first standard formula according to the number of preset values in the first standard formula, and intercepting the second intermediate sequence from the second standard formula according to the number of preset values in the second standard formula.
In one embodiment, the predetermined value is 1; the length of the first standard formula and the length of the second standard formula are bothThe number of 1 s in the first standard formula isThe number of 1 s in the first standard formula is;
The steps of intercepting the first intermediate sequence from the first standard form according to the number of preset values in the first standard form, and intercepting the second intermediate sequence from the second standard form according to the number of preset values in the second standard form include:
the first standard formulaIs located toThe sequence between the bits is identified as the first intermediate sequence, and the second standard is identified as the second intermediate sequenceIs located toThe sequence between the bits is identified as the second intermediate sequence.
In one embodiment, before the step of determining the current element sequence number, the method further includes:
acquiring a first pseudorandom integer sequence and a second pseudorandom integer sequence; the number of elements of the first pseudorandom integer sequence is equal to the number of elements of the second pseudorandom integer sequence, and the number of elements of the first pseudorandom integer sequence is determined according to the length of a plaintext.
In one embodiment, the step of obtaining the first pseudo-random integer sequence and the second pseudo-random integer sequence comprises:
obtaining a key pair; the key pair comprises a first key and a second key;
a first pseudorandom integer sequence is generated from the first key and a second pseudorandom integer sequence is generated from the second key.
In one embodiment, the first key comprises a first integer, a second integer, and a third integer; the second key comprises a fourth integer, a fifth integer and a sixth integer;
the steps of generating a first pseudo-random sequence of integers from a first key and a second pseudo-random sequence of integers from a second key include:
processing the first key using the following formula to generate a first pseudorandom integer sequence:
wherein the content of the first and second substances,is a first integer;is a second integer;is a third integer;is the element number;is the first in the first pseudorandom integer sequenceAn element;is the first in the first pseudorandom integer sequenceAn element;is the total number of elements;
processing the second key using the following formula to generate a second pseudorandom integer sequence:
wherein the content of the first and second substances,is a fourth integer;is a fifth integer;is a sixth integer;is the element number;is the first in the second pseudorandom integer sequenceAn element;is the first in the second pseudorandom integer sequenceAn element;is the total number of elements.
An encryption method comprising the steps of:
acquiring plaintext data;
generating a key stream by adopting the stream encryption key stream generation method;
and carrying out exclusive OR operation on the key stream and the plaintext data according to the bit to obtain ciphertext data.
A stream encryption keystream generation apparatus, comprising:
the element selection module is used for determining the serial number of the current element, selecting a first element corresponding to the serial number of the current element from the first pseudorandom integer sequence, and selecting a second element corresponding to the serial number of the current element from the second pseudorandom integer sequence;
the intermediate sequence intercepting module is used for converting the first element and the second element into Fibonacci binary standard forms to respectively obtain a first standard form and a second standard form, intercepting the first intermediate sequence from the first standard form and intercepting the second intermediate sequence from the second standard form;
the key subsequence obtaining module is used for performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining a key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed;
and the key stream acquisition module is used for paralleling each key subsequence according to the sequence of the element sequence numbers to obtain the key stream.
An encryption apparatus comprising:
the plaintext acquisition module is used for acquiring plaintext data;
stream encryption key stream generation means for generating a key stream by the above-described stream encryption key stream generation method;
and the ciphertext acquisition module is used for carrying out XOR operation on the key stream and the plaintext data according to bits to obtain ciphertext data.
A stream cipher key generation circuit, comprising:
the first encoder is used for converting the first element into a Fibonacci binary standard form to obtain a first standard form;
the second encoder is used for converting the second element into a Fibonacci binary standard form to obtain a second standard form;
the key stream generating device determines the serial number of the current element, selects a first element corresponding to the serial number of the current element from the first pseudorandom integer sequence, and selects a second element corresponding to the serial number of the current element from the second pseudorandom integer sequence; intercepting a first intermediate sequence from the first standard formula and intercepting a second intermediate sequence from the second standard formula; performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining the key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed; and paralleling the key subsequences of each round according to the sequence of the element sequence numbers to obtain the key stream.
In one embodiment, the method further comprises the following steps:
a storage device for storing the first 32-bit Fibonacci number; each fibonacci number is used to instruct the first encoder to convert the first element to a fibonacci binary standard form and the second encoder to convert the second element to a fibonacci binary standard form.
In one embodiment, the first encoder, the second encoder and the keystream generation apparatus are all FPGA devices.
An encryption device includes the stream encryption key generation circuit as described above.
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 above-mentioned method.
The stream encryption key stream generation method, the stream encryption key stream generation device, the stream encryption key stream generation circuit and the stream encryption key stream generation method determine a current element serial number, select a first element corresponding to the current element serial number from a first pseudorandom integer sequence, and select a second element corresponding to the current element serial number from a second pseudorandom integer sequence; converting the first element and the second element into Fibonacci binary standard forms to respectively obtain a first standard form and a second standard form, intercepting a first intermediate sequence from the first standard form, and intercepting a second intermediate sequence from the second standard form; performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining the key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed; and (4) paralleling each round of key subsequences according to the sequence of the element sequence numbers to obtain the key stream, so that the generation speed of the key stream can be increased.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments or the conventional technologies of the present application, the drawings used in the descriptions of the embodiments or the conventional technologies will be briefly introduced below, it is obvious that the drawings in the following descriptions are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a first flowchart of a method for generating an encryption key stream according to an embodiment;
FIG. 2 is a flow diagram illustrating the steps in one embodiment for obtaining a pseudorandom integer sequence;
FIG. 3 is a diagram illustrating a second process of a method for generating an encryption key stream according to an embodiment;
FIG. 4 is a flow diagram illustrating an encryption method in one embodiment;
FIG. 5 is a flow diagram illustrating a decryption method in one embodiment;
FIG. 6 is a block diagram showing the structure of a stream cipher key generation circuit in one embodiment;
FIG. 7 is an RTL circuit of a stream cipher key generation circuit in one embodiment;
FIG. 8 is a state transition diagram of the stream cipher key generation circuit of FIG. 7;
FIG. 9 is a block diagram showing the construction of a stream cipher key stream generating apparatus according to an embodiment;
fig. 10 is a block diagram showing the configuration of an encryption device according to an embodiment.
Detailed Description
To facilitate an understanding of the present application, the present application will now be described more fully with reference to the accompanying drawings. Embodiments of the present application are set forth in the accompanying drawings. This application may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
It is understood that "plurality" can be more than two, such as two, three, or five, etc. The terms "first," "second," and the like as used herein may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first resistance may be referred to as a second resistance, and similarly, a second resistance may be referred to as a first resistance, without departing from the scope of the present application. The first resistance and the second resistance are both resistances, but they are not the same resistance.
It is to be understood that "connection" in the following embodiments is to be understood as "electrical connection", "communication connection", and the like if the connected circuits, modules, units, and the like have communication of electrical signals or data with each other.
As used herein, the singular forms "a", "an" and "the" may include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises/comprising," "includes" or "including," etc., specify the presence of stated features, integers, steps, operations, components, parts, or combinations thereof, but do not preclude the presence or addition of one or more other features, integers, steps, operations, components, parts, or combinations thereof. Also, as used in this specification, the term "and/or" includes any and all combinations of the associated listed items.
At present, in stream encryption, an RC4 encryption algorithm is generally used to generate a key stream, and plaintext data is encrypted by using the key stream, so as to obtain ciphertext data. The RC4 encryption algorithm is an encryption method for generating a key stream by using a state vector and a temporary vector, wherein the temporary vector can be generated according to an initial key input by a user, and the position of each element in the state vector is replaced by the temporary vector, so that the key stream with strong randomness can be obtained. However, the inventors have found that when a key stream is generated by an RC4 random stream generator, the key stream generation speed is slow.
In one embodiment, as shown in fig. 1, there is provided a stream encryption key stream generation method, including the steps of:
Wherein the first pseudo-random sequence of integers may include one or more integers, each integer constituting a respective element of the first pseudo-random sequence of integers; the second pseudo-random sequence of integers may include one or more integers, each of which constitutes a respective element of the second pseudo-random sequence of integers. It should be understood that the first pseudo-random integer sequence and the second pseudo-random integer sequence are two separate integer sequences, and there is no necessary relationship between the two.
Further, the number of elements in the first pseudo-random integer sequence, i.e., the number of integers included in the first pseudo-random integer sequence, may be the same as or different from the number of elements in the second pseudo-random integer sequence, i.e., the number of integers included in the second pseudo-random integer sequence. If the number of elements of the first pseudorandom integer sequence is different from the number of elements of the second pseudorandom integer sequence, the first pseudorandom integer sequence and/or the second pseudorandom integer sequence may be adjusted such that the number of elements in the two sequences is the same. For example, a pseudo-random integer sequence with a large number of elements may be truncated, or a pseudo-random integer sequence with a small number of elements may be data-padded.
Specifically, after determining the current element sequence number, the corresponding elements in the first pseudo-random integer sequence and the second pseudo-random integer sequence may be determined by the element sequence number. Taking the first pseudo-random integer sequence as an example, whenThen, the first pseudorandom integer sequence contains 3 elements,is the number of 3, and the number of the carbon atoms is 3,is a mixture of a water-soluble polymer and a water-soluble polymer, and is 5,if the current element number is 2, the element in the first pseudorandom integer sequence corresponding to the current element number is 5. Similarly, the second pseudorandom integer sequence may also determine the element in the sequence corresponding to the current element sequence number through the above-described process.
Further, the embodiment of selecting the first element and the second element from the first pseudorandom integer sequence and the second pseudorandom integer sequence may be implemented by any method in the prior art, for example, the pseudorandom integer sequence may be stored in an array manner, a corresponding storage address may be determined by a current element sequence number, and the corresponding first element and the corresponding second element may be obtained after accessing the storage address.
And step 120, converting the first element and the second element into fibonacci binary standard forms to obtain a first standard form and a second standard form respectively, intercepting the first intermediate sequence from the first standard form, and intercepting the second intermediate sequence from the second standard form.
Specifically, a natural number is represented as one orAnd summing a plurality of mutually-different Fibonacci numbers, and mapping all Fibonacci numbers in position to generate a bit string consisting of 0 s and 1 s, wherein the bit string is a Fibonacci binary representation of the natural number. If Fibonacci is expressed in binary, there is no adjacent 1, and there is no addition(i.e., the first fibonacci number), then the expression is a fibonacci scale standard expression.
For example, the natural number 20 may be expressed as 20 = 2+5+13 =Then its fibonacci binary expression (in the example of an 8-bit length) is 01010100. Fibonacci scale expression of natural number 20And there is no adjacent 1, 01010100 is a fibonacci scale standard of 20.
The first intermediate sequence is part or all of the first standard, that is, the first intermediate sequence may be a continuous bit string between the start bit and the end bit in the first standard, for example, 1010 may be an intermediate sequence of 01010100. Similarly, the second intermediate sequence is part or all of the second standard, that is, the second intermediate sequence may be a continuous bit string between the start bit and the end bit in the second standard. It is to be understood that the length of the first intermediate sequence and the length of the second intermediate sequence may be equal or different, and the lengths of the two intermediate sequences are not necessarily related.
Specifically, after determining the first element and the second element, the first element may be converted into a fibonacci scale standard form to obtain a first standard form, and the second element may be converted into a fibonacci scale standard form to obtain a second standard form. It should be noted that there may be one or more fibonacci scale standard forms for the same natural number, and the first standard form and the second standard form may be any one of them.
After obtaining the first standard, the first intermediate sequence may be truncated from the first standard, and after obtaining the second standard, the second intermediate sequence may be truncated from the second standard. Further, the probability of the occurrence of the preset value (e.g., 0 or 1) in the first intermediate sequence may be constant, and the probability of the occurrence of the preset value in the second intermediate sequence may be constant.
And step 130, performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number for obtaining the key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed.
Wherein the key subsequence may be a component of the key stream; the key stream may be a random stream.
Specifically, the present application may determine the intersection of the first intermediate sequence and the second intermediate sequence according to the position of the first intermediate sequence in the first standard formula and the position of the second intermediate sequence in the second standard formula, for example, if the first intermediate sequence is from 1 st to 3 rd bits (the lowest bit is 1 st bit) in the first standard formula and the second intermediate sequence is from 2 nd to 5 th bits in the second standard formula, the intersection may be from 2 nd to 3 rd bits of the first intermediate sequence (i.e., from 2 nd to 3 rd bits in the first standard formula) and from 1 st to 2 nd bits of the second intermediate sequence (i.e., from 2 nd to 3 rd bits in the second standard formula).
In addition, the method can also determine intersection bits according to the length of the first intermediate sequence and the length of the second intermediate sequence, and the highest bits are aligned or the lowest bits are aligned by taking the intermediate sequence with shorter length as a standard, so that the intersection bits of the first intermediate sequence and the second intermediate sequence can be determined. In the above example, the intersection bits may be the 1-3 bits of the first intermediate sequence (i.e. the 1-3 bits in the first normal form) and the 1-3 bits of the second intermediate sequence (i.e. the 2-4 bits of the second normal form), or the intersection bits may be the 1-3 bits of the first intermediate sequence (i.e. the 1-3 bits in the first normal form) and the 2-4 bits of the second intermediate sequence (i.e. the 3-5 bits of the second normal form).
After determining the intersection bits, performing an OR (OR) operation on the intersection bits in a bit-by-bit manner, and performing OR on a value corresponding to the intersection bit in the first intermediate sequence and a value corresponding to the intersection bit in the second intermediate sequence for each intersection bit until all the intersection bits are processed and the key subsequence of the current round is obtained.
When the key subsequence of the current round is obtained, the sequence number of the current element is incremented, and the step size of the increment can be determined according to the storage formats of the first pseudo-random integer sequence and the second pseudo-random integer sequence, for example, the step size of the increment can be 1. After the current element sequence number is incremented, step 110, step 120 and step 130 are performed, and the key subsequence of the next round is obtained. And repeatedly executing the steps until all elements in the first pseudorandom integer sequence and all elements in the second pseudorandom integer sequence are traversed to obtain the key subsequence corresponding to each element sequence number.
And 140, paralleling the key subsequences of each round according to the sequence of the element sequence numbers to obtain a key stream.
Specifically, after traversing the first pseudorandom integer sequence and the second pseudorandom integer sequence, the key subsequences may be arranged in parallel according to the order of the element sequence numbers, and the key subsequences are sequentially arranged to obtain a string of key streams. Wherein the keystream may be used to encrypt plaintext data. For example, if the key subsequence corresponding to the element number 1 is 123 and the key subsequence corresponding to the element number 2 is 456, the key stream obtained after the parallelization is 123456.
In the stream encryption key stream generation method, the stream encryption key stream generation device, the stream encryption key stream generation circuit and the stream encryption key stream generation method, a current element serial number is determined, a first element corresponding to the current element serial number is selected from a first pseudorandom integer sequence, and a second element corresponding to the current element serial number is selected from a second pseudorandom integer sequence; converting the first element and the second element into Fibonacci binary standard forms to respectively obtain a first standard form and a second standard form, intercepting a first intermediate sequence from the first standard form, and intercepting a second intermediate sequence from the second standard form; performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining the key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed; and (4) paralleling each round of key subsequences according to the sequence of the element sequence numbers to obtain the key stream, so that the generation speed of the key stream can be increased.
In one embodiment, the step of truncating the first intermediate sequence from the first normal form and the step of truncating the second intermediate sequence from the second normal form comprises:
and intercepting the first intermediate sequence from the first standard formula according to the number of preset values in the first standard formula, and intercepting the second intermediate sequence from the second standard formula according to the number of preset values in the second standard formula.
The preset value may be 0 or 1, and the number of the preset values may be the number of the preset values appearing in the standard formula.
Specifically, the first standard form and the second standard form are bit strings composed of 0 and 1, the number of preset numerical values in the first standard form can be obtained, and the first intermediate sequence is intercepted from the first standard form according to the number of the preset numerical values in the first standard form. Similarly, the number of the preset values in the second standard formula may be obtained, and the second intermediate sequence may be extracted from the second standard formula according to the number of the preset values in the second standard formula. It should be noted that the number of the preset numerical values in the first standard formula and the number of the preset numerical values in the second standard formula may be equal or different.
The obtaining of the number of the preset values in the standard formula may be implemented by any method in the prior art, for example, the number of the preset values may be obtained by traversing the standard formula, or the number of the preset values in the standard formula may be counted by using an edge trigger device or a level trigger device.
In one embodiment, the predetermined value is 1; the length of the first standard formula and the length of the second standard formula are bothLThe number of 1 s in the first standard formula isThe number of 1 s in the first standard formula is;
The steps of intercepting the first intermediate sequence from the first standard form according to the number of preset values in the first standard form, and intercepting the second intermediate sequence from the second standard form according to the number of preset values in the second standard form include:
the first standard formulaIs located toThe sequence between the bits is identified as the first intermediate sequence, and the second standard is identified as the second intermediate sequenceIs located toThe sequence between the bits is identified as the second intermediate sequence.
Specifically, the preset value may be 1. The first standard formula isA bit Fibonacci scale, the second standard beingA bit fibonacci scale. For a length of1 is the number ofOf the Fibonacci scale standard 0, 1 sequenceWhen it comes toThe probability of a bit appearing at 1 is constant.
When the number of 1 s in the first standard formulaThen, the first standard formula can be usedThe sequence therebetween is identified as the first intermediate sequence (excluding the secondBit anda bit). When the number of 1 s in the second standard formula isThen, the second standard formulaThe sequence therebetween is confirmed as a second intermediate sequence (excluding the firstBit anda bit).
In the method for generating the stream encryption key stream, the first intermediate sequence is intercepted from the first standard formula according to the number of the preset numerical values in the first standard formula, and the second intermediate sequence is intercepted from the second standard formula according to the number of the preset numerical values in the second standard formula, so that the probability of the preset numerical values at each position in the first intermediate sequence and the second intermediate sequence can be determined, the key stream can be used for stream encryption, and the generation speed of the key stream is increased. Experiments prove that the generation speed of the key generated by adopting the stream encryption key generation method can be improved by 4 times compared with that of RC 4.
In one embodiment, before the step of determining the current element sequence number, the method further includes:
acquiring a first pseudorandom integer sequence and a second pseudorandom integer sequence; the number of elements of the first pseudorandom integer sequence is equal to the number of elements of the second pseudorandom integer sequence, and the number of elements of the first pseudorandom integer sequence is determined according to the length of a plaintext.
Specifically, prior to step 110, a first pseudo-random integer sequence and a second pseudo-random integer sequence may be obtained. The number of elements included in the first pseudo-random integer sequence and the number of elements included in the second pseudo-random integer sequence may be equal, and the number of elements in the first pseudo-random integer sequence and the number of elements in the second pseudo-random integer sequence may be determined according to the length of the plaintext data.
For example, the first pseudorandom integer sequence may beThe second pseudo-random sequence of integers may beNumber of elements thereinCan be based on the length of plaintext dataAnd (4) determining.
In the stream encryption key stream generation method, before the step of determining the current element sequence number, a first pseudorandom integer sequence and a second pseudorandom integer sequence are obtained; the number of elements of the first pseudorandom integer sequence is equal to the number of elements of the second pseudorandom integer sequence, and the number of elements of the first pseudorandom integer sequence is determined according to the plaintext length, so that the key stream can be generated through the first pseudorandom integer sequence and the second pseudorandom integer sequence, the processing steps of the first pseudorandom integer sequence and the second pseudorandom integer sequence are reduced, and the generation speed of the key stream can be further improved.
In one embodiment, as shown in fig. 2, the step of obtaining the first pseudo-random integer sequence and the second pseudo-random integer sequence includes:
step 220 generates a first pseudorandom integer sequence based on the first key and a second pseudorandom integer sequence based on the second key.
In particular, the first key and the second key of the key pair may be the same or different, the step of generating the first pseudo-random sequence of integers from the first key and the step of generating the second pseudo-random sequence of integers from the second key may be the same. For example, the key and the previous element may be modulo to obtain the current element in the pseudorandom integer sequence, and it should be understood that the method for generating the pseudorandom integer sequence according to the key in the present application may also be implemented by other embodiments in the prior art, and is not limited to the manner listed in the above example.
In one embodiment, the first key comprises a first integer, a second integer, and a third integer; the second key comprises a fourth integer, a fifth integer and a sixth integer;
the steps of generating a first pseudo-random sequence of integers from a first key and a second pseudo-random sequence of integers from a second key include:
processing the first key using the following formula to generate a first pseudorandom integer sequence:
wherein the content of the first and second substances,is a first integer;is a second integer;is a third integer;is the element number;is the first in the first pseudorandom integer sequenceAn element;is the first in the first pseudorandom integer sequenceAn element;is the total number of elements;
processing the second key using the following formula to generate a second pseudorandom integer sequence:
wherein the content of the first and second substances,is a fourth integer;is a fifth integer;is a sixth integer;is the element number;is the first in the second pseudorandom integer sequenceAn element;is the first in the second pseudorandom integer sequenceAn element;is the total number of elements.
In particular, the key pair may beWhereinIs a first key to be used for the first time,is the second key. Each key consists of three integers, namely:
wherein the content of the first and second substances,is a first integer;is a second integer;is a third integer;is a fourth integer;is a fifth integer;is a sixth integer. Further, the first initial value can be obtainedAnd a second initial value,Andare integers greater than zero.
Andmay be two prime numbers of the same order of magnitude,<,<,<,<then, each element in the first pseudorandom integer sequence may be generated by the following formula:
wherein the content of the first and second substances,is the element number;is the first in the first pseudorandom integer sequenceAn element;is the first in the first pseudorandom integer sequenceAn element;is the total number of elements, namely the length of the plaintext;modis a modulo operation.
Meanwhile, each element in the second pseudorandom integer sequence may be generated by the following formula:
wherein the content of the first and second substances,is the first in the second pseudorandom integer sequenceAn element;is the first in the second pseudorandom integer sequenceAn element;modis a modulo operation.
For example when all the parameters are as shown below,
the first pseudo-random integer sequences can be generated according to the above formulaAnd a second pseudo-random integer sequenceAnd is denoted as FibonacciSystem of standard typeAnd. WhereinIs the first in the first pseudorandom integer sequenceiFibonacci scale standard form of element with length ofL;Is the first in the second pseudorandom integer sequenceiFibonacci scale standard form of element with length ofL. In each standard formTo pairAndperforming logical OR operation according to bit to obtain a key subsequence。HA sub-sequence of keysParalleling to obtain the key stream。
For convenience of explanation of the solution of the present application, the following description is made by using a specific example, and as shown in fig. 3, there is provided a stream encryption key stream generation method, including:
In particular, a key pairWherein,. First initial valueAnd a second initial valueAre all integers greater than zero and satisfy (1)Andtwo prime numbers which may be of the same order of magnitude; (2),;(3),。
Wherein the first pseudorandom integer sequence is obtainable by the following formula:
the second pseudorandom integer sequence may be obtained by the following equation:
specifically, the total number of elementsHCan be based on the length of plaintext dataDegree PAnd (4) determining.
and 340, intercepting the first intermediate sequence from the first standard formula according to the number of 1 in the first standard formula, and intercepting the second intermediate sequence from the second standard formula according to the number of 1 in the second standard formula.
In particular, for a length of1 is the number ofOf the Fibonacci scale standard 0, 1 sequenceWhen it comes toThe probability of a bit appearing at 1 is constant. Intermediate part for first and second standard formsThe intersection bit of the key is bitwise OR to obtain the key of the current roundSequence of。
And 350, incrementing the current element sequence number to obtain the element sequence number for acquiring the next round of key subsequence until traversing the first pseudorandom integer sequence and the second pseudorandom integer sequence.
And step 360, paralleling the key subsequences of each round according to the sequence of the element sequence numbers to obtain a key stream.
The stream encryption key stream generation method is provided. Generated keystream sequenceCThe assumption of Golomb randomness is satisfied and can be used for stream encryption.
In one embodiment, as shown in fig. 4, there is provided an encryption method comprising the steps of:
step 420, generating a key stream by using the stream encryption key stream generation method in any of the above embodiments;
and 430, performing exclusive or operation on the key stream and the plaintext data according to bits to obtain ciphertext data.
Specifically, after the plaintext data is obtained, a key stream may be generated by using the stream encryption key stream generation method in any of the embodiments, and then, an exclusive or (XOR) operation may be performed on the plaintext data and the key stream according to bits to obtain ciphertext data.
In one embodiment, as shown in fig. 5, there is provided a decryption method comprising the steps of:
and step 530, carrying out exclusive OR operation on the key stream and the ciphertext data according to the bit to obtain plaintext data.
It should be understood that although the various steps in the flowcharts of fig. 1-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 a portion of the steps of fig. 1-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 in turn or alternately with other steps or at least a portion of the other steps or stages.
In one embodiment, as shown in fig. 6, there is provided a stream cipher key generation circuit including:
the first encoder is used for converting the first element into a Fibonacci binary standard form to obtain a first standard form;
the second encoder is used for converting the second element into a Fibonacci binary standard form to obtain a second standard form;
the key stream generating device determines the serial number of the current element, selects a first element corresponding to the serial number of the current element from the first pseudorandom integer sequence, and selects a second element corresponding to the serial number of the current element from the second pseudorandom integer sequence; intercepting a first intermediate sequence from the first standard formula and intercepting a second intermediate sequence from the second standard formula; performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining the key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed; and paralleling the key subsequences of each round according to the sequence of the element sequence numbers to obtain the key stream.
Specifically, the stream encryption key generation circuit may include a first encoder, a second encoder, and a key stream generation device, an output end of the key stream generation device is connected to an input end of the first encoder and an input end of the second encoder, respectively, and an input end of the key stream generation device is connected to an output end of the first encoder and an output end of the second encoder, respectively.
The keystream generation apparatus may select a first element corresponding to a current element number from a first pseudorandom integer sequence and a second element corresponding to the current element number from a second pseudorandom integer sequence, and may transmit the first element to a first encoder and the second element to a second encoder. Further, the first element and the second element may each be 16 binary numbers. The first encoder converts the first element into a Fibonacci binary standard form to obtain a first standard form, and the second encoder converts the second element into a Fibonacci binary standard form to obtain a second standard form.
Or, the keystream generation device may respectively obtain/generate a first pseudorandom integer sequence and a second pseudorandom integer sequence, transmit the obtained first pseudorandom integer sequence to the first encoder, and transmit the obtained second pseudorandom integer sequence to the second encoder. And the second encoder performs Fibonacci standard type coding on the generated second pseudorandom integer sequence to obtain a second standard type.
The first standard formula is input into the key stream generating device sequentially through the output end of the first encoder and the input end of the key stream generating device, and the second standard formula is input into the key stream generating device sequentially through the output end of the second encoder and the input end of the key stream generating device.
The key stream generation device intercepts a first intermediate sequence from the first standard formula, intercepts a second intermediate sequence from the second standard formula, and performs bitwise OR operation on intersection bits of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence corresponding to the current element sequence number. And increasing the sequence number of the current element, transmitting a next first element and a next second element to the first encoder and the second encoder respectively, and acquiring a next round of key subsequence until traversing the first pseudorandom integer sequence and the second pseudorandom integer sequence.
And after traversing the first pseudorandom integer sequence and the second pseudorandom integer sequence, the key stream generation device parallels the key subsequences of each round according to the sequence of the element sequence numbers to obtain the key stream.
In one embodiment, further comprising:
a storage device for storing the first 32-bit Fibonacci number; each fibonacci number is used to instruct the first encoder to convert the first element to a fibonacci binary standard form and the second encoder to convert the second element to a fibonacci binary standard form.
Specifically, referring to fig. 7, fig. 7 shows an RTL (Register Transfer Level) circuit of the stream cipher key generation circuit. The Memory device may be a RAM (Random Access Memory) device in which the first 32-bit fibonacci number is stored, i.e. in which the first 32-bit fibonacci number is stored. The storage device may be connected to the first encoder and the second encoder, respectively.
When the Fibonacci binary coding is performed, the Fibonacci number in the storage device can be read, so that repeated calculation can be avoided, and the key stream generation speed can be further increased.
In one embodiment, the first encoder, the second encoder and the key stream generating device are all FPGA (Field Programmable Gate Array) devices.
For the purpose of illustrating the aspects of the present application, a specific example will be described below. A stream encryption key stream generation circuit, whose RTL stage circuit can be shown in FIG. 7, and state transition diagram can be shown in FIG. 8.
The resource occupation comparison of the stream encryption key stream generation circuit and the RC4 random code stream generator can be shown in table 1, and as can be seen from table 1, the stream encryption key stream generation circuit occupies 3 times of logic gates and register resources, but occupies 1/3 IO pins, compared with the RC4 random code stream generator. Both of them have more emphasis on hardware resource layout and have no obvious advantages and disadvantages.
Table 1 comparison of FPGA resource occupation between stream encryption key stream generation circuit and RC4 random code stream generator
In contrast to the time consumption, when the crystal oscillator is 50MHz (megahertz), for 8 bits of plaintext data, the generation time of the random code stream generated by the present application is 4630ps (picosecond) for 231 clock cycles, and the generation time of the RC4 random code stream is 15694ps (783 clock cycles). That is, the generation speed of the random code stream of the stream encryption key stream generation circuit of the present application is about 3 times faster than the generation speed of the random code stream generator of RC 4.
By integrating the comparison results of resource consumption and time occupation, it can be considered that although the register and logic gate resources occupy a little more, the speed of generating the random code stream of the stream encryption key stream generating circuit is obviously faster, and fewer pins are occupied, so that the random code stream generating method is superior to the random code stream generating method of RC4 in the overall view.
In one embodiment, there is provided an encryption device comprising the stream cipher key generation circuit of any of the above embodiments.
Further, the encryption device may further include a receiving circuit that receives the plaintext data and an encryption circuit that exclusive-ors the keystream and the plaintext data.
In one embodiment, as shown in fig. 9, there is provided a stream encryption key stream generation apparatus including:
and the element selection module is used for determining the serial number of the current element, selecting a first element corresponding to the serial number of the current element from the first pseudorandom integer sequence, and selecting a second element corresponding to the serial number of the current element from the second pseudorandom integer sequence.
And the intermediate sequence intercepting module is used for converting the first element and the second element into Fibonacci binary standard forms to respectively obtain a first standard form and a second standard form, intercepting the first intermediate sequence from the first standard form, and intercepting the second intermediate sequence from the second standard form.
The key subsequence obtaining module is used for performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining a key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed;
and the key stream acquisition module is used for paralleling each key subsequence according to the sequence of the element sequence numbers to obtain the key stream.
In one embodiment, the intermediate sequence clipping module is configured to clip the first intermediate sequence from the first standard form according to the number of preset values in the first standard form, and clip the second intermediate sequence from the second standard form according to the number of preset values in the second standard form.
In one embodiment, the predetermined value is 1; the length of the first standard formula and the length of the second standard formula are bothLThe number of 1 s in the first standard formula isThe number of 1 s in the first standard formula is(ii) a A middle sequence intercepting module for intercepting the second sequence in the first standard formIs located toThe sequence between the bits is identified as the first intermediate sequence, and the second standard is identified as the second intermediate sequenceIs located toThe sequence between the bits is identified as the second intermediate sequence.
In one embodiment, the stream encryption key stream generation apparatus further includes: the pseudo-random code acquisition module is used for acquiring a first pseudo-random integer sequence and a second pseudo-random integer sequence; the number of elements of the first pseudorandom integer sequence is equal to the number of elements of the second pseudorandom integer sequence, and the number of elements of the first pseudorandom integer sequence is determined according to the length of a plaintext.
In one embodiment, the pseudo random code obtaining module is further configured to obtain a key pair; the key pair comprises a first key and a second key; a first pseudorandom integer sequence is generated from the first key and a second pseudorandom integer sequence is generated from the second key.
In one embodiment, the first key comprises a first integer, a second integer, and a third integer; the second key comprises a fourth integer, a fifth integer and a sixth integer; the pseudo-random code acquisition module is further configured to process the first secret key using the following formula to generate a first pseudo-random integer sequence:
wherein the content of the first and second substances,is a first integer;is a second integer;is a third integer;is the element number;is the first in the first pseudorandom integer sequenceAn element;is the first in the first pseudorandom integer sequenceAn element;is the total number of elements;
processing the second key using the following formula to generate a second pseudorandom integer sequence:
wherein the content of the first and second substances,is a fourth integer;is a fifth integer;is a sixth integer;is the element number;is the first in the second pseudorandom integer sequenceAn element;is the first in the second pseudorandom integer sequenceAn element;is the total number of elements.
For specific limitations of the stream encryption key stream generation apparatus, reference may be made to the above limitations of the stream encryption key stream generation method, which will not be described herein again. The respective modules in the stream encryption key stream generation apparatus described above may be implemented in whole or in part by software, hardware, and a combination 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. It should be noted that, in the embodiment of the present application, the division of the module is schematic, and is only one logic function division, and there may be another division manner in actual implementation.
In one embodiment, as shown in fig. 10, there is provided an encryption apparatus including:
the plaintext acquisition module is used for acquiring plaintext data;
a stream encryption key stream generation device, configured to generate a key stream by using the stream encryption key stream generation method in any of the embodiments;
and the ciphertext acquisition module is used for carrying out exclusive OR operation on the key stream and the plaintext data according to bits to obtain ciphertext data.
Specifically, the stream encryption key stream generation apparatus may be as described in any of the above embodiments.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
determining a current element serial number, selecting a first element corresponding to the current element serial number from the first pseudorandom integer sequence, and selecting a second element corresponding to the current element serial number from the second pseudorandom integer sequence;
converting the first element and the second element into Fibonacci binary standard forms to respectively obtain a first standard form and a second standard form, intercepting a first intermediate sequence from the first standard form, and intercepting a second intermediate sequence from the second standard form;
performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining the key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed;
and paralleling the key subsequences of each round according to the sequence of the element sequence numbers to obtain the key stream.
In one embodiment, the computer program when executed by the processor further performs the steps of: and intercepting the first intermediate sequence from the first standard formula according to the number of preset values in the first standard formula, and intercepting the second intermediate sequence from the second standard formula according to the number of preset values in the second standard formula.
In one embodiment, the predetermined value is 1; the length of the first standard formula and the length of the second standard formula are bothLThe number of 1 s in the first standard formula isThe number of 1 s in the first standard formula is(ii) a The computer program when executed by the processor further realizes the steps of: the first standard formulaIs located toThe sequence between the bits is identified as the first intermediate sequence, and the second standard is identified as the second intermediate sequenceIs located toThe sequence between the bits is identified as the second intermediate sequence.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a first pseudorandom integer sequence and a second pseudorandom integer sequence; the number of elements of the first pseudorandom integer sequence is equal to the number of elements of the second pseudorandom integer sequence, and the number of elements of the first pseudorandom integer sequence is determined according to the length of a plaintext.
In one embodiment, the computer program when executed by the processor further performs the steps of: obtaining a key pair; the key pair comprises a first key and a second key; a first pseudorandom integer sequence is generated from the first key and a second pseudorandom integer sequence is generated from the second key.
In one embodiment, the first key comprises a first integer, a second integer, and a third integer; the second key comprises a fourth integer, a fifth integer and a sixth integer; the computer program when executed by the processor further realizes the steps of: processing the first key using the following formula to generate a first pseudorandom integer sequence:
wherein the content of the first and second substances,is a first integer;is a second integer;is a third integer;is the element number;is the first in the first pseudorandom integer sequenceAn element;is the first in the first pseudorandom integer sequenceAn element;is the total number of elements;
processing the second key using the following formula to generate a second pseudorandom integer sequence:
wherein the content of the first and second substances,is a fourth integer;is a fifth integer;is a sixth integer;is the element number;is the first in the second pseudorandom integer sequenceAn element;is the first in the second pseudorandom integer sequenceAn element;is the total number of elements.
In one embodiment, another computer-readable storage medium is provided, having a computer program stored thereon, the computer program, when executed by a processor, implementing the steps of:
acquiring plaintext data;
generating a key stream by adopting a stream encryption key stream generation method in any embodiment;
and carrying out exclusive OR operation on the key stream and the plaintext data according to the bit to obtain ciphertext data.
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 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.
In the description herein, references to the description of "some embodiments," "other embodiments," "desired embodiments," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, a schematic description of the above terminology may not necessarily refer to the same embodiment or example.
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 (14)
1. A stream encryption key stream generation method, comprising:
determining a current element serial number, selecting a first element corresponding to the current element serial number from a first pseudorandom integer sequence, and selecting a second element corresponding to the current element serial number from a second pseudorandom integer sequence;
converting the first element and the second element into Fibonacci binary standard forms to respectively obtain a first standard form and a second standard form, intercepting a first intermediate sequence from the first standard form, and intercepting a second intermediate sequence from the second standard form;
performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining the key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed;
and paralleling the key subsequences of each round according to the sequence of the element sequence numbers to obtain a key stream.
2. The stream cipher key stream generating method of claim 1, wherein the step of cutting out a first intermediate sequence from the first standard and a second intermediate sequence from the second standard comprises:
and intercepting a first intermediate sequence from the first standard formula according to the number of preset values in the first standard formula, and intercepting a second intermediate sequence from the second standard formula according to the number of preset values in the second standard formula.
3. The stream cipher key stream generation method of claim 2, wherein the preset value is 1; the length of the first standard formula and the length of the second standard formula are bothLThe number of 1 s in the first standard formula isThe number of 1 s in the first standard formula is;
The step of truncating a first intermediate sequence from the first normal form according to the number of the preset values in the first normal form, and truncating a second intermediate sequence from the second normal form according to the number of the preset values in the second normal form comprises:
combining the first standard formula with the second standard formulaIs located toThe sequence between the bits is identified as the first intermediate sequence, and the second standard is identified as the second intermediate sequenceIs located toThe sequence between bits is confirmed asThe second intermediate sequence.
4. The stream cipher key stream generating method of claim 1, wherein the step of determining the current element sequence number is preceded by:
acquiring the first pseudorandom integer sequence and the second pseudorandom integer sequence; the number of elements of the first pseudorandom integer sequence is equal to the number of elements of the second pseudorandom integer sequence, and the number of elements of the first pseudorandom integer sequence is determined according to the length of a plaintext.
5. The stream cipher keystream generation method of claim 4, wherein obtaining the first sequence of pseudorandom integers and the second sequence of pseudorandom integers comprises:
obtaining a key pair; the key pair comprises a first key and a second key;
generating the first pseudorandom integer sequence according to the first key and generating the second pseudorandom integer sequence according to the second key.
6. The stream cipher key stream generation method of claim 5, wherein the first key includes a first integer, a second integer, and a third integer; the second key comprises a fourth integer, a fifth integer, and a sixth integer;
the steps of generating the first pseudorandom integer sequence based on the first key and generating the second pseudorandom integer sequence based on the second key include:
processing the first key using the following formula to generate the first pseudorandom integer sequence:
wherein the content of the first and second substances,is a stand forThe first integer;is the second integer;is the third integer;is the element number;is the first in the first pseudorandom integer sequenceAn element;is the first in the first pseudorandom integer sequenceAn element;is the total number of elements;
processing the second key using the following formula to generate the second pseudorandom integer sequence:
wherein the content of the first and second substances,is the fourth integer;is the fifth integer;is the sixth integer;is the element number;is the second in the second pseudorandom integer sequenceAn element;is the second in the second pseudorandom integer sequenceAn element;is the total number of elements.
7. An encryption method, comprising the steps of:
acquiring plaintext data;
generating a keystream using the stream encryption keystream generation method of any of claims 1-6;
and carrying out exclusive OR operation on the key stream and the plaintext data according to the bit to obtain ciphertext data.
8. A stream encryption key stream generation apparatus, comprising:
the element selection module is used for determining the serial number of the current element, selecting a first element corresponding to the serial number of the current element from a first pseudorandom integer sequence, and selecting a second element corresponding to the serial number of the current element from a second pseudorandom integer sequence;
the intermediate sequence intercepting module is used for converting the first element and the second element into Fibonacci binary standard forms to respectively obtain a first standard form and a second standard form, intercepting a first intermediate sequence from the first standard form, and intercepting a second intermediate sequence from the second standard form;
a key subsequence obtaining module, configured to perform bitwise or operation on intersection bits of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increment the current element sequence number to obtain an element sequence number used for obtaining a key subsequence of the next round, until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed;
and the key stream acquisition module is used for paralleling the key subsequences according to the sequence of the element sequence numbers to obtain the key stream.
9. An encryption apparatus, comprising:
the plaintext acquisition module is used for acquiring plaintext data;
stream encryption keystream generation means for generating a keystream using the stream encryption keystream generation method of any one of claims 1 through 6;
and the ciphertext acquisition module is used for carrying out exclusive OR operation on the key stream and the plaintext data according to bits to obtain ciphertext data.
10. A stream cipher key generation circuit, comprising:
the first encoder is used for converting the first element into a Fibonacci binary standard form to obtain a first standard form;
the second encoder is used for converting the second element into a Fibonacci binary standard form to obtain a second standard form;
the key stream generating device determines a current element serial number, selects a first element corresponding to the current element serial number from a first pseudorandom integer sequence, and selects a second element corresponding to the current element serial number from a second pseudorandom integer sequence; intercepting a first intermediate sequence from the first standard formula and intercepting a second intermediate sequence from the second standard formula; performing bitwise OR operation on intersection positions of the first intermediate sequence and the second intermediate sequence to obtain a key subsequence of the current round, increasing the current element sequence number to obtain an element sequence number used for obtaining the key subsequence of the next round until the first pseudorandom integer sequence and the second pseudorandom integer sequence are traversed; and paralleling the key subsequences of each round according to the sequence of the element sequence numbers to obtain a key stream.
11. The stream cipher key generation circuit of claim 10, further comprising:
a storage device for storing the first 32-bit Fibonacci number; each of the fibonacci numbers is to instruct the first encoder to convert the first element to a fibonacci binary standard form and the second encoder to convert the second element to a fibonacci binary standard form.
12. The stream cipher key generation circuit of claim 10, wherein the first encoder, the second encoder, and the keystream generation device are all FPGA devices.
13. An encryption device comprising the stream cipher key generation circuit according to any one of claims 10 to 12.
14. 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.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011418785.6A CN112202548A (en) | 2020-12-07 | 2020-12-07 | Stream encryption key stream generation method, device, circuit and encryption method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011418785.6A CN112202548A (en) | 2020-12-07 | 2020-12-07 | Stream encryption key stream generation method, device, circuit and encryption method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112202548A true CN112202548A (en) | 2021-01-08 |
Family
ID=74034499
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011418785.6A Pending CN112202548A (en) | 2020-12-07 | 2020-12-07 | Stream encryption key stream generation method, device, circuit and encryption method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112202548A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116527233A (en) * | 2023-03-13 | 2023-08-01 | 安徽合工质能双碳科技有限公司 | Energy monitoring data management system based on cloud computing |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN201936335U (en) * | 2011-01-20 | 2011-08-17 | 广东商学院 | RFID (radio frequency identification) electronic tag chip with encryption function |
CN102752107A (en) * | 2011-04-19 | 2012-10-24 | 中国科学院微电子研究所 | Device and method for realizing RC4 encryption/decryption |
EP3316125A1 (en) * | 2016-10-26 | 2018-05-02 | Nxp B.V. | Method of generating an elliptic curve cryptographic key pair |
CN111431716A (en) * | 2020-03-30 | 2020-07-17 | 卓尔智联(武汉)研究院有限公司 | Data transmission method and device, computer equipment and storage medium |
CN111464296A (en) * | 2020-03-30 | 2020-07-28 | 卓尔智联(武汉)研究院有限公司 | Sequence cipher generation method, data encryption method and data decryption method |
-
2020
- 2020-12-07 CN CN202011418785.6A patent/CN112202548A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN201936335U (en) * | 2011-01-20 | 2011-08-17 | 广东商学院 | RFID (radio frequency identification) electronic tag chip with encryption function |
CN102752107A (en) * | 2011-04-19 | 2012-10-24 | 中国科学院微电子研究所 | Device and method for realizing RC4 encryption/decryption |
EP3316125A1 (en) * | 2016-10-26 | 2018-05-02 | Nxp B.V. | Method of generating an elliptic curve cryptographic key pair |
CN111431716A (en) * | 2020-03-30 | 2020-07-17 | 卓尔智联(武汉)研究院有限公司 | Data transmission method and device, computer equipment and storage medium |
CN111464296A (en) * | 2020-03-30 | 2020-07-28 | 卓尔智联(武汉)研究院有限公司 | Sequence cipher generation method, data encryption method and data decryption method |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116527233A (en) * | 2023-03-13 | 2023-08-01 | 安徽合工质能双碳科技有限公司 | Energy monitoring data management system based on cloud computing |
CN116527233B (en) * | 2023-03-13 | 2023-09-19 | 安徽合工质能双碳科技有限公司 | Energy monitoring data management system based on cloud computing |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Beaulieu et al. | The SIMON and SPECK lightweight block ciphers | |
Li et al. | Chaotic encryption scheme for real-time digital video | |
TWI739090B (en) | Puf-based true random number generator | |
US5835600A (en) | Block encryption algorithm with data-dependent rotations | |
KR101246490B1 (en) | A closed galois field cryptographic system | |
US8320557B2 (en) | Cryptographic system including a mixed radix number generator with chosen statistical artifacts | |
EP1583278B1 (en) | Stream Cipher Design with Revolving Buffers | |
JPH04250490A (en) | Encrypting system based on chaos theory | |
US20090296928A1 (en) | Pseudorandom number generating system, encryption system, and decryption system | |
WO2006033013A2 (en) | Substitution boxes | |
US8229108B2 (en) | Pseudo-random number generation based on periodic sampling of one or more linear feedback shift registers | |
JP2005215688A (en) | Hardware encryption/decryption apparatus using s-box operation, and method for the same | |
WO2004032098A1 (en) | Pseudo-random number generation method and pseudo-random number generator | |
Cheung et al. | Tradeoffs in parallel and serial implementations of the international data encryption algorithm IDEA | |
WO2000001111A1 (en) | Secure data encoder and decoder | |
Paar et al. | Stream ciphers | |
Ghazi et al. | Robust and efficient dynamic stream cipher cryptosystem | |
CN112202548A (en) | Stream encryption key stream generation method, device, circuit and encryption method | |
WO2004086673A1 (en) | Device, method, and program for random number generation, encryption, and decryption, and recording medium | |
Maximov | Some words on cryptanalysis of stream ciphers | |
Younes et al. | CeTrivium: A Stream Cipher Based on Cellular Automata for Securing Real-TimeMultimedia Transmission. | |
Abumuala et al. | A new method for generating cryptographically strong sequences of pseudo random bits for stream cipher | |
Singh et al. | Analysis of 64-bit RC5 Encryption Algorithm for Pipelined Architecture | |
Hendricks et al. | Polysizemic Encryption: Towards a Variable-Length Output Symmetric-Key Cryptosystem | |
Sonawane et al. | Synthesis and simulation of FPGA based hardware design of RC4 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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210108 |
|
RJ01 | Rejection of invention patent application after publication |