CN111865591A - Symmetric encryption method, device, equipment and storage medium - Google Patents

Symmetric encryption method, device, equipment and storage medium Download PDF

Info

Publication number
CN111865591A
CN111865591A CN202010991788.2A CN202010991788A CN111865591A CN 111865591 A CN111865591 A CN 111865591A CN 202010991788 A CN202010991788 A CN 202010991788A CN 111865591 A CN111865591 A CN 111865591A
Authority
CN
China
Prior art keywords
key
binary number
parity
binary
random
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.)
Granted
Application number
CN202010991788.2A
Other languages
Chinese (zh)
Other versions
CN111865591B (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.)
Beijing Huayuan Information Technology Co Ltd
Original Assignee
Beijing Huayuan Information Technology 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 Beijing Huayuan Information Technology Co Ltd filed Critical Beijing Huayuan Information Technology Co Ltd
Priority to CN202010991788.2A priority Critical patent/CN111865591B/en
Publication of CN111865591A publication Critical patent/CN111865591A/en
Application granted granted Critical
Publication of CN111865591B publication Critical patent/CN111865591B/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/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0435Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply symmetric encryption, i.e. same key used for encryption and decryption

Abstract

Embodiments of the present disclosure provide a symmetric encryption method, apparatus, device, and storage medium. The encryption method comprises the steps of obtaining a plaintext binary array input to be encrypted; carrying out exclusive-or encryption on the plaintext binary number group input to be encrypted by using the key binary number group key to generate a ciphertext binary number group output; obtaining a random number b according to the plaintext binary number input to be encrypted; and performing parity random mixing on the ciphertext binary number group output according to the random number b to obtain a parity random mixed encryption result binary number group output'. In this way, the encryption and decryption operation speed can be improved on the premise of ensuring the data security by using a large-capacity key, the XOR data encryption and the data disorder algorithm based on the XOR parity.

Description

Symmetric encryption method, device, equipment and storage medium
Technical Field
Embodiments of the present disclosure relate generally to the field of symmetric encryption, and more particularly, to a symmetric encryption method, apparatus, device, and storage medium.
Background
The following symmetric encryption algorithms are commonly used in the market at present:
name (R) Key Length (bit) Speed of operation Safety feature Resource consumption
DES 56 Is quicker Is low in In
3DES 112/168 Slow In Height of
AES 128. 192 and 256 bits Fast-acting toy Height of Is low in
AES or related symmetric encryption algorithms are used, the main goal of these algorithms is based on security rather than efficiency.
The prior art can meet the requirements in most scenes, but has performance problems on devices which are particularly sensitive to performance, such as IOT devices, network communication devices with operating systems, and the like. In these devices, data encryption often affects the data communication speed, and the reduction of the key length affects the security.
Disclosure of Invention
According to an embodiment of the present disclosure, a symmetric encryption/decryption scheme is provided.
In a first aspect of the disclosure, a symmetric encryption method is disclosed. The method comprises the steps of obtaining a plaintext binary number group input to be encrypted, and carrying out XOR encryption on the plaintext binary number group input to be encrypted by using a key binary number group key to generate a ciphertext binary number group output; obtaining a random number b according to the plaintext binary number input to be encrypted; and performing parity random mixing on the ciphertext binary number group output according to the random number b to obtain a parity random mixed encryption result binary number group output'.
In a second aspect of the disclosure, a symmetric decryption method is disclosed. The method comprises the steps of receiving a binary group output' of a parity random mixed encryption result; obtaining a random number b according to the binary number group output' of the parity random mixed encryption result and the key binary number group key; and carrying out XOR according to the binary number group output', the key binary number group key and the random number b to obtain plaintext binary data input.
In a third aspect of the disclosure, a symmetric encryption apparatus is disclosed. The device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a plaintext binary array input to be encrypted; the exclusive-or encryption module is used for carrying out exclusive-or encryption on the plaintext binary number group input to be encrypted by using the key binary number group key to generate a ciphertext binary number group output; the random number acquisition module is used for acquiring a random number b according to the plaintext binary number group input to be encrypted; and the parity random mixing module is used for performing parity random mixing on the ciphertext binary number group output according to the random number b to obtain a parity random mixed encryption result binary number group output'.
In a fourth aspect of the disclosure, a symmetric decryption apparatus is disclosed. The device comprises a receiving module, a judging module and a judging module, wherein the receiving module is used for receiving a binary array output' of a parity random mixed encryption result; the random number acquisition module is used for acquiring a random number b according to the binary number group output' of the parity random mixed encryption result and the key binary number group key; and the decryption module is used for carrying out exclusive OR according to the binary number group output, the key binary number group key and the random number b to obtain plaintext binary data input.
In a fifth aspect of the present disclosure, an electronic device is provided. The electronic device includes: a memory having a computer program stored thereon and a processor implementing the method as described above when executing the program.
In a sixth aspect of the present disclosure, a computer readable storage medium is provided, having stored thereon a computer program, which when executed by a processor, implements a method as described above according to the present disclosure.
It should be understood that the statements herein reciting aspects are not intended to limit the critical or essential features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. In the drawings, like or similar reference characters designate like or similar elements, and wherein:
fig. 1 shows a flow diagram of a symmetric encryption method according to an embodiment of the present disclosure;
fig. 2 shows a flow chart of obtaining a random number b in a symmetric encryption method according to an embodiment of the present disclosure;
FIG. 3 shows a flow diagram of a symmetric decryption method according to an embodiment of the present disclosure;
fig. 4 shows a flow chart of obtaining a random number b in a symmetric decryption method according to an embodiment of the present disclosure;
FIG. 5 shows a block diagram of a symmetric encryption device, according to an embodiment of the present disclosure;
FIG. 6 shows a block diagram of a symmetric decryption device, according to an embodiment of the present disclosure;
fig. 7 shows a block diagram of a symmetric encryption/decryption device according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
In addition, the term "and/or" herein is only one kind of association relationship describing an associated object, and means that there may be three kinds of relationships, for example, a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
In the disclosure, the method utilizes design ideas such as a large-capacity key, exclusive-or data encryption, a data disordering algorithm based on exclusive-or parity and the like, and can realize the encryption and decryption performance which is dozens of times of that of the traditional AES on the premise of ensuring the data security.
Exclusive or (XOR), sign ≦ ≦ for two bits b1And b2The exclusive or operation is performed in four cases:
b1 b2 b1⊕b2
0 0 0
0 1 1
1 0 1
1 1 0
that is, two phases take 0 at the same time and do not take 1 at the same time. The above is a bit operation, and when extended to bytes, i.e., 8 bits, the above calculation rule is also satisfied since the respective bits are independent.
Define 1 function one (b), which represents the number of 1 in byte b. The Parity function Parity (b) is defined for determining Parity of numbers, po (b) = Parity (one (b)) is defined for determining Parity of the number of 1 s in byte b, which is called super-Parity of bytes.
According to the above definition, there is an important super-parity conclusion:
if a ≧ b = c, po (a) ≦ po (b) = po (c), i.e., the xor result of the two bytes matches the xor result of their super-parity.
Fig. 1 shows a flow diagram of a symmetric encryption method 100 according to an embodiment of the present disclosure. As shown in fig. 1, the symmetric encryption method specifically includes the following steps:
at block 110, obtaining a plaintext binary array input to be encrypted;
in some embodiments, the plaintext to be encrypted may be any type of file, such as a binary array corresponding to a character string, a picture, or a video.
And if the plaintext to be encrypted is in a non-binary array format, preprocessing the plaintext to be encrypted and converting the plaintext to be encrypted into a binary array format.
Taking the original character string of the plaintext to be encrypted as "Hello, cryptography", the corresponding ASCII code decimal array is [72, 101, 108, 108, 111, 44, 229, 175, 134, 231, 160, 129, 229,173, 166], and the byte length is 15.
At block 120, the key binary number group key is used to perform exclusive-or encryption on the plaintext binary number group input to be encrypted, so as to generate a ciphertext binary number group output;
in some embodiments, the key may be obtained from any type of file and set, and if the key of the predetermined encryption algorithm is a non-binary number, the key is converted into a binary number for processing.
In some embodiments, the length of the key is greater than/equal to the length of the plaintext to be encrypted; the key length can be 10M or more, which depends on the memory limit and is larger than the length of the plaintext to be encrypted, the key can be generated by using a random generation algorithm, or an existing large file can be used, and the basic idea is to make the length of the key long enough. The calculation formula of the encryption algorithm is as follows: output [ i ] = input [ i ] ≦ key [ i ]; where i represents the ith element, i ∈ [0, length (input) ], and the function length () represents the byte length of the input.
Through the above calculation formula, the output ciphertext is a binary array with the same length as the input plaintext, and the ith bit is the xor of the ith bit of the input and the ith bit of the key.
In some embodiments, the length of the key is less than the length of the plaintext to be encrypted; the calculation formula of the encryption algorithm is as follows: output [ i ] = input [ i ] ≦ key [ i% length (key) ]; where i represents the ith element, i ∈ [0, length (input) ], and the function length () represents the byte length of the input.
Through the above calculation formula, the output is a binary number group with the same length as the input, and the ith bit of the binary number group is the exclusive or of the ith bit of the input and the ith% length (key) bit of the key. And when the key length is smaller than the plaintext to be encrypted, adopting a remainder taking mode to ensure that an exclusive OR value can be obtained within the key length range.
The efficiency of the exclusive or encryption algorithm is very high and can reach dozens of times of AES through testing, but the method has the defects that the algorithm is too simple, and the value of the key is easy to calculate through a mode of carrying out reverse deduction through a large amount of input even under the condition that the key does not exist; therefore, the subsequent encryption step needs to be continued.
Taking the character string with the key "0123456789 abcde" as an example, the corresponding decimal array is [48, 49,50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101], and the byte length is 15.
At block 130, a random number b is obtained according to the plaintext binary array input to be encrypted.
In some embodiments, as shown in fig. 2, the random number b is obtained by the following method 200:
at block 210, acquiring the super parity of N bytes of the binary array input according to a preset rule, generating a binary number and converting the binary number into a decimal number; n is a positive integer greater than or equal to 1;
the preset rule is that the encryption party and the decryption party realize agreement and are unified. The preset rule may be that super-parity of the first N bytes of the binary number group input, for example, 8, is obtained, and a binary number is generated and converted into a decimal number according to the super-parity of 0-7 bytes;
for example, bits 0-7 of the binary number input are as follows:
decimal 7210110810811144229175
Binary 0100100001100101011011000110110001101111001011001110010110101111
24446356 number 1
Super-parity: 00000110
Generating a binary number: 01100000 (this is because the super-parity is the parity difference of bytes 0-7, and its corresponding binary number needs to reverse the order of super-parity)
Conversion to decimal number: 96.
the preset rule may also be to obtain the super-parity of any N bytes of the binary array input, where the N bytes may be consecutive N bytes or non-consecutive N bytes.
At block 220, the decimal number is complemented by the value of the decimal number for the byte length of the binary number input, the bytes in the binary number input are located according to the remainder, 8 bytes are continuously taken from the located bytes, and the binary number is generated and converted into the decimal number as the random number b according to the super-parity of the taken 8 bytes;
for example, 96%15=6, the binary number input bytes 6-13 are taken as follows:
decimal 229175134231160129229173
Binary 1110010110101111100001101110011110100000100000011110010110101101
56362255 number 1
Super-parity: 10100011
Generating a binary number: 11000101 (this is because super-parity is the difference in parity of bytes 6-13 whose corresponding binary numbers require the order of super-parity to be reversed)
Conversion to decimal number: 197
In this example, the super-parity of binary number 11000101 is even, so it does not need to be further processed.
In some embodiments, if the super-parity of the random number b takes an odd number, the super-parity thereof is changed to an even number by a fixed algorithm. In order to not change the super-parity of the ciphertext, namely the binary group output, the super-parity value of the random number b is set as an even number, if an odd number is obtained, the super-parity is changed into the even number through a fixed algorithm, for example, the super-parity is changed into the even number in a mode of continuously shifting one bit to the left and zero padding on the right side until the super-parity is changed into the even number.
At block 140, performing parity random mixing on the ciphertext binary number group output according to the random number b to obtain a parity random mixed encryption result binary number group output';
in some embodiments, the calculation formula for the random mixture of parity is as follows:
output′[i]= output [i]⊕ b;
wherein the super-parity value of the parameter b is an even number.
Depending on the super-parity, after a given byte is XOR'd with any byte, the XOR result of the two bytes is consistent with the XOR result of their super-parity and remains unchanged, regardless of the result. By utilizing the characteristic, a number which is similar to randomness is obtained by utilizing parity in the encryption process, and the number is added into the XOR encryption, so that the original rule of the encryption result is lost, and the secret key is prevented from being obtained by carrying out reverse calculation on input and output.
For example, the resulting parity shuffled random encryption result corresponds to the decimal array [189, 145,155, 154, 158, 220, 22, 93, 123,27, 4, 38, 67, 12, 6 ].
In some embodiments, the random number b may also be calculated first, and then an exclusive-or encryption operation may be directly performed according to the plaintext to be encrypted, the secret key, and the random number b. The encryption of the plaintext to be encrypted is not required to be carried out by using a key first, and the ciphertext is generated; and performing parity random mixing on the ciphertext according to the random number b. For example:
if the length of the key is less than the length of the plaintext to be encrypted, output' [ i ] = input [ i ], ] ^ key [ i% length (key) ] ] ^ b;
if the length of the key is greater than or equal to the length of the plaintext to be encrypted, output' [ i ] = input [ i ], [ key [ i ], [ b ].
In some embodiments, the method further comprises:
at block 150, the parity random hybrid encryption result is sent to the receiving end.
By the encryption mode, a large-capacity key, exclusive-or data encryption and a data disorder algorithm based on exclusive-or parity are utilized, a cracking means of inputting a large number of reverse-pushing keys is avoided, the encryption and decryption performance which is dozens of times of that of the traditional AES can be realized on the premise of ensuring the data security, and the data communication speed is ensured.
For example, in encrypting a mkv format video file with a total capacity of 1.9702 GB, the total time is: 6.8696 s, wherein, time for reading 4.153463 s, speed: 0.474347 GB/s; time for encryption 0.371357 s, speed: 5.305362 GB/s; time for writing 2.344742 s, speed: 0.840256 GB/s. The writing means to save the encryption result. Therefore, the encryption speed of the large file is high, and the method can adapt to scenes with requirements on real-time performance and transmission speed.
Fig. 3 shows a flow diagram of a symmetric decryption method 400 according to an embodiment of the present disclosure. As shown in fig. 3, the symmetric decryption method 300 specifically includes the following steps:
at block 310, receiving a parity random hybrid encryption result binary set output'; wherein the parity random hybrid encryption result is generated according to a symmetric encryption method of an embodiment of the present disclosure;
for example, the encrypted content corresponds to the decimal array [189, 145,155, 154, 158, 220, 22, 93, 123,27, 4, 38, 67, 12, 6 ].
At block 320, the random number b is obtained by mixing the encryption result binary number group output' and the key binary number group key according to the parity.
In some embodiments, as shown in fig. 4, the random number b is obtained by the following method 400:
at block 410, respectively obtaining the super parity of N bytes of the parity random mixed encryption result binary number group' and the key binary number group key according to a preset rule, generating a binary number according to a difference value of the super parity and the super parity, and converting the binary number into a decimal number, wherein N is a positive integer greater than or equal to 1;
the preset rule is that the encryptor and the decryptor realize the agreement and are unified. The preset rule may be that super-parity of the first N bytes of the parity random mixed encryption result binary number group output' and the key binary number group key is respectively obtained, binary numbers are generated according to a difference value thereof and converted into decimal numbers, N is a positive integer greater than or equal to 1, for example, 8, and binary numbers are generated according to a super-parity difference value of 0-7 bytes and converted into decimal numbers;
for example, bits 0-7 of the binary number group output' are as follows:
decimal 1891451551541582202293
Binary 1011110110010001100110111001101010011110110111000001011001011101
63545535 for 1 number;
bits 0-7 of the key are as follows:
decimal 4849505152535455
Binary 0011000000110001001100100011001100110100001101010011011000110111
23343445 for 1 number;
super-parity difference: 00000110
Generating a binary number: 01100000 (this is because the super-parity difference is the parity difference of 0-7 bytes, and its corresponding binary number needs to reverse the order of the super-parity differences)
Conversion to decimal number: 96.
the preset rule may also be that super parity of any N bytes of the parity random mixed encryption result binary number group' and the key binary number group key is respectively obtained, where the N bytes may be continuous N bytes or discontinuous N bytes; and generating a binary number according to the difference value and converting the binary number into a decimal number, wherein N is a positive integer greater than or equal to 1.
In some embodiments, when the parity random mix encryption result is that the super-parity of N bytes of the binary group output' is first added 8 and then subtracted by the super-parity of N bytes of the key binary group key to ensure that the difference is a positive number.
At block 420, respectively complementing the byte lengths of the binary number group output 'and the key binary number group key according to the value of the decimal number, respectively positioning the bytes in the binary number group output' and the key binary number group key according to the remainder, continuously taking 8 bytes from the positioning bytes, generating a binary number according to the super-parity difference of the taken 8 bytes, and converting the binary number into the decimal number as the random number b;
for example, 96%15=6,
the binary number group output' bytes 6-13 are taken as follows:
decimal 2293123274386712
Binary 0001011001011101011110110001101100000100001001100100001100001100
35641332 number 1
The binary number group key bits 6-13 are taken as follows:
decimal 54555657979899100
Binary 0011011000110111001110000011100101100001011000100110001101100100
45343343 number 1
Super-parity difference: 10100011
Generating a binary number: 11000101 (this is because the super-parity difference is the parity difference of bytes 6-13 whose corresponding binary number needs to reverse the order of the super-parity differences)
Conversion to decimal number: 197
In some embodiments, when the parity random mixed encryption result binary group output' takes 8 bytes of super-parity, 8 is added first and then 8 bytes of super-parity are subtracted from the key binary group key to ensure that the difference is a positive number.
In some embodiments, if the super-parity of the random number b takes an odd number, the super-parity thereof is changed to an even number by a fixed algorithm. In order to not change the super-parity of the ciphertext, namely the binary group output, the super-parity value of the random number b is set as an even number, if an odd number is obtained, the super-parity is changed into the even number through a fixed algorithm, for example, the super-parity is changed into the even number in a mode of continuously shifting one bit to the left and zero padding on the right side until the super-parity is changed into the even number.
In this example, the super-parity of binary number 11000101 is even, so it does not need to be further processed.
As can be seen from the above steps, we can obtain the same random number b as in the encryption step according to the parity random mixture encryption result output' and the key.
In block 330, an exclusive or is performed according to the binary number group output', the key binary number group key, and the random number b to obtain plaintext binary data input.
input[i]= output[i]⊕ key[i % length(key)]⊕ b
Therefore, the plaintext binary digit group input can be rapidly calculated;
hello, cryptography
Corresponding array [72, 101, 108, 108, 111, 44, 229, 175, 134, 231, 160, 129, 229,173, 166 ].
According to the embodiment of the disclosure, a large-capacity key, an exclusive-or data encryption and a data disorder algorithm based on an exclusive-or parity are utilized, a cracking means of inputting a large number of reverse-push keys is avoided, the encryption and decryption performance which is dozens of times of that of the traditional AES can be realized on the premise of ensuring the data security, and the data communication speed is ensured.
For example, in decrypting a mkv format video file with a total capacity of 1.9702 GB, the total time is: 4.7782 s, wherein, time for reading 2.515991 s, speed: 0.783065 GB/s; time for decryption 0.307825 s, speed: 6.400334 GB/s; time for writing 1.954359 s, speed: 1.008097 GB/s. Wherein, writing means saving the decryption result. Therefore, the decryption speed of the large file is high, and the method can adapt to scenes with requirements on real-time performance and transmission speed.
It is noted that while for simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present disclosure is not limited by the order of acts, as some steps may, in accordance with the present disclosure, occur in other orders and concurrently. Further, those skilled in the art should also appreciate that the embodiments described in the specification are exemplary embodiments and that acts and modules referred to are not necessarily required by the disclosure.
The above is a description of embodiments of the method, and the embodiments of the apparatus are further described below.
FIG. 5 shows a block diagram of a symmetric encryption device, according to an embodiment of the present disclosure; as shown in fig. 5, the apparatus includes:
an obtaining module 510, configured to obtain a plaintext binary array input to be encrypted;
an exclusive-or encryption module 520, configured to perform exclusive-or encryption on the plaintext binary array input to be encrypted by using the key binary array key, and generate a ciphertext binary array output;
a random number obtaining module 530, configured to obtain a random number b according to the plaintext binary array input to be encrypted;
and the parity random mixing module 540 is configured to perform parity random mixing on the ciphertext binary number group output according to the random number b to obtain a parity random mixed encryption result binary number group output'.
FIG. 6 shows a block diagram of a symmetric decryption device, according to an embodiment of the present disclosure; as shown in fig. 6, the apparatus includes:
a receiving module 610, configured to receive a binary group output' of a parity random mixed encryption result;
a random number obtaining module 620, configured to obtain a random number b according to the parity random mixed encryption result binary number group output' and the key binary number group key;
and the decryption module 630 is configured to perform xor according to the binary number group output, the key binary number group key, and the random number b to obtain plaintext binary data input.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of each unit described above may refer to corresponding processes in the foregoing method embodiments, and are not described herein again.
Fig. 7 shows a block diagram of a symmetric encryption/decryption device according to an embodiment of the present disclosure. As shown, the symmetric encryption device includes a processor unit (CPU) that can perform various appropriate actions and processes according to computer program instructions stored in a Read Only Memory (ROM) 702 or computer program instructions loaded from a storage unit 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The CPU701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Various components in the device 700 are connected to the I/O interface 705, including: an input unit 706 such as a keyboard, a mouse, or the like; an output unit 707 such as various types of displays, speakers, and the like; a storage unit 708 such as a magnetic disk, optical disk, or the like; and a communication unit 709 such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processing unit 701 performs the various methods and processes described above, such as the methods 100, 200, 300, 400. For example,
in some embodiments, the methods 100, 200, 300, 400 may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device via ROM. When being loaded and executed, may carry out one or more of the steps of the method described above.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a load programmable logic device (CPLD), and the like.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
Further, while operations are depicted in a particular order, this should be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single implementation. Conversely, various features that are described in the context of a single implementation can also be implemented in multiple implementations separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. A symmetric encryption method, comprising:
acquiring a plaintext binary number group input to be encrypted;
carrying out exclusive-or encryption on the plaintext binary number group input to be encrypted by using the key binary number group key to generate a ciphertext binary number group output;
obtaining a random number b according to the plaintext binary number input to be encrypted;
and performing parity random mixing on the ciphertext binary number group output according to the random number b to obtain a parity random mixed encryption result binary number group output'.
2. The symmetric encryption method according to claim 1, wherein the exclusive-or encrypting the plaintext binary set input to be encrypted using the key binary set key comprises:
if the length of the key binary number group key is larger than or equal to the length of the plaintext binary number group input to be encrypted; output [ i ] = input [ i ] ≦ key [ i ];
if the length of the secret key is smaller than the length of the plaintext to be encrypted; output [ i ] = input [ i ] ≦ key [ i% length (key) ];
where i represents the ith element, i ∈ [0, length (input) ], and the function length () represents the byte length of the input.
3. The symmetric encryption method according to claim 2, wherein obtaining the random number b according to the plaintext binary group input to be encrypted comprises:
acquiring the super parity of N bytes of a binary number group input according to a preset rule, generating a binary number and converting the binary number into a decimal number; n is a positive integer greater than or equal to 1;
and (3) according to the decimal number value, the byte length of the binary number group input is complemented, the bytes in the binary number group input are positioned according to the remainder, 8 bytes are continuously taken from the positioned bytes, and according to the super parity of the taken 8 bytes, a binary number is generated and converted into a decimal number which is used as the random number b.
4. A symmetric encryption method according to claim 3, characterized in that if the super-parity value of said random number b is odd, it is changed by a preset algorithm so that the super-parity value is even.
5. A symmetric decryption method, comprising:
receiving a binary group output' of a parity random mixed encryption result;
obtaining a random number b according to the binary number group output' of the parity random mixed encryption result and the key binary number group key;
and carrying out XOR according to the binary number group output', the key binary number group key and the random number b to obtain plaintext binary data input.
6. The method of claim 5, wherein the randomly mixing the encryption result binary number output' with the key binary number key according to the parity to obtain the random number b comprises:
acquiring super parity of N bytes of the binary number group output' of the parity random mixed encryption result and the key binary number group key according to a preset rule which is the same as encryption, generating binary numbers according to the difference value of the super parity and the super parity, and converting the binary numbers into decimal numbers; n is a positive integer greater than or equal to 1;
and respectively complementing the byte lengths of the binary number group output 'and the key binary number group key according to the value of the decimal number, respectively positioning the bytes in the binary number group output' and the key binary number group key according to the remainder, continuously taking 8 bytes from the positioning bytes, generating the binary number according to the super-parity difference of the respectively taken 8 bytes, and converting the binary number into the decimal number serving as the random number b.
7. The method of claim 6,
and if the super-parity value of the random number b is an odd number, changing the super-parity value of the random number b through a preset algorithm to enable the super-parity value to be an even number.
8. A symmetric encryption apparatus, comprising:
the acquisition module is used for acquiring a plaintext binary array input to be encrypted;
the exclusive-or encryption module is used for carrying out exclusive-or encryption on the plaintext binary number group input to be encrypted by using the key binary number group key to generate a ciphertext binary number group output;
the random number acquisition module is used for acquiring a random number b according to the plaintext binary number group input to be encrypted;
and the parity random mixing module is used for performing parity random mixing on the ciphertext binary number group output according to the random number b to obtain a parity random mixed encryption result binary number group output'.
9. An electronic device comprising a memory unit and a processor unit, the memory unit having a computer program stored thereon, wherein the processor unit, when executing the program, implements the method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
CN202010991788.2A 2020-09-21 2020-09-21 Symmetric encryption method, decryption method, device, equipment and storage medium Active CN111865591B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010991788.2A CN111865591B (en) 2020-09-21 2020-09-21 Symmetric encryption method, decryption method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010991788.2A CN111865591B (en) 2020-09-21 2020-09-21 Symmetric encryption method, decryption method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111865591A true CN111865591A (en) 2020-10-30
CN111865591B CN111865591B (en) 2021-01-15

Family

ID=72968455

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010991788.2A Active CN111865591B (en) 2020-09-21 2020-09-21 Symmetric encryption method, decryption method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111865591B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114598470A (en) * 2022-03-17 2022-06-07 北京启明星辰信息安全技术有限公司 Encryption method, decryption method, device and computer readable storage medium
CN115333868A (en) * 2022-10-14 2022-11-11 安徽华云安科技有限公司 Symmetric encryption method, symmetric decryption method, symmetric encryption device, symmetric decryption device and symmetric encryption equipment based on odd-even round robin

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7808404B1 (en) * 2002-12-09 2010-10-05 Marvell International Ltd. Method and apparatus for generating a seed set in a data dependent seed selector
CN104618092A (en) * 2015-01-05 2015-05-13 浪潮(北京)电子信息产业有限公司 Information encryption method and system
CN104954124A (en) * 2014-03-28 2015-09-30 华为技术有限公司 Encryption and decryption data processing method, device and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7808404B1 (en) * 2002-12-09 2010-10-05 Marvell International Ltd. Method and apparatus for generating a seed set in a data dependent seed selector
CN104954124A (en) * 2014-03-28 2015-09-30 华为技术有限公司 Encryption and decryption data processing method, device and system
CN104618092A (en) * 2015-01-05 2015-05-13 浪潮(北京)电子信息产业有限公司 Information encryption method and system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114598470A (en) * 2022-03-17 2022-06-07 北京启明星辰信息安全技术有限公司 Encryption method, decryption method, device and computer readable storage medium
CN114598470B (en) * 2022-03-17 2023-12-19 北京启明星辰信息安全技术有限公司 Encryption method, decryption method, device, and computer-readable storage medium
CN115333868A (en) * 2022-10-14 2022-11-11 安徽华云安科技有限公司 Symmetric encryption method, symmetric decryption method, symmetric encryption device, symmetric decryption device and symmetric encryption equipment based on odd-even round robin
CN115333868B (en) * 2022-10-14 2022-12-23 安徽华云安科技有限公司 Symmetric encryption method, symmetric decryption method, symmetric encryption device, symmetric decryption device and symmetric encryption device based on odd-even round robin

Also Published As

Publication number Publication date
CN111865591B (en) 2021-01-15

Similar Documents

Publication Publication Date Title
CN111461952B (en) Image encryption method, computer device, and computer-readable storage medium
CN111865591B (en) Symmetric encryption method, decryption method, device, equipment and storage medium
CN108052805B (en) Data encryption and decryption method and device
CN110704854B (en) Stream type encryption method aiming at text data reserved format
CN109787760B (en) Optimized secret key security enhancement method and device based on H1 type hash function family
CN112714112B (en) Data encryption and decryption method for server data storage, storage medium and terminal equipment
Al-Kadei et al. Speed up image encryption by using RSA algorithm
WO2021129470A1 (en) Polynomial-based system and method for fully homomorphic encryption of binary data
Yang et al. Implementation of encryption algorithm and wireless image transmission system on FPGA
CN115426101B (en) Data transmission method of cloud intercommunication platform
CN117640256B (en) Data encryption method, recommendation device and storage medium of wireless network card
CN110336661A (en) AES-GCM data processing method, device, electronic equipment and storage medium
CN107248914B (en) Novel symmetric encryption system and encryption method on iOS device
WO2023236899A1 (en) Data processing method, apparatus, device and storage medium
CN114826560B (en) Lightweight block cipher CREF implementation method and system
CN104636662A (en) Data processing method and terminal device
CN113938270A (en) Data encryption method and device capable of flexibly reducing complexity
CN113452508B (en) Data encryption method, device, equipment and computer readable storage medium
EP3054620A1 (en) System and method for performing block cipher cryptography by implementing a mixer function that includes a substitution-box and a linear transformation using a lookup-table
CN111815723B (en) Data encryption method and device
CN111698208B (en) Method, apparatus and storage medium for encoding multi-tunnel adaptive data stream
CN115426111A (en) Data encryption method and device, electronic equipment and storage medium
CN114124359A (en) Method and device for preserving format encrypted data, electronic equipment and storage medium
CN112994887B (en) Communication encryption method and system suitable for power Internet of things terminal
Eum et al. Implementation of SM4 block cipher on CUDA GPU and its analysis

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