CN109413051B - Data encryption method and device, computer equipment and storage medium - Google Patents

Data encryption method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN109413051B
CN109413051B CN201811171780.0A CN201811171780A CN109413051B CN 109413051 B CN109413051 B CN 109413051B CN 201811171780 A CN201811171780 A CN 201811171780A CN 109413051 B CN109413051 B CN 109413051B
Authority
CN
China
Prior art keywords
data
key
bytes
key data
plaintext
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811171780.0A
Other languages
Chinese (zh)
Other versions
CN109413051A (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.)
Shenzhen Southern Dare Automotive Electronic Co Ltd
Original Assignee
Shenzhen Southern Dare Automotive Electronic 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 Shenzhen Southern Dare Automotive Electronic Co Ltd filed Critical Shenzhen Southern Dare Automotive Electronic Co Ltd
Priority to CN201811171780.0A priority Critical patent/CN109413051B/en
Publication of CN109413051A publication Critical patent/CN109413051A/en
Application granted granted Critical
Publication of CN109413051B publication Critical patent/CN109413051B/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
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

The invention relates to a data encryption method, a data encryption device, computer equipment and a storage medium, wherein the method comprises the steps of acquiring plaintext data and secret key data; and carrying out exclusive-or operation and exchange operation according to the plaintext data and the key data to form ciphertext data. The invention carries out XOR operation and exchange operation by utilizing the plaintext data and the key data to encrypt the plaintext data, has the encryption of the key data and the encryption of the operation process, improves the encryption safety, carries out the decomposition, the disorder and the recombination of the results of the XOR operation of the plaintext data and the key data, carries out the decomposition, the disorder and the recombination of the key data, carries out the XOR operation and the exchange operation on two groups of combined data, increases the complexity of the encryption process, ensures the encryption safety and the stability, avoids the information transmitted in the air from being leaked, and achieves the aim of transmission safety.

Description

Data encryption method and device, computer equipment and storage medium
Technical Field
The present invention relates to data processing methods, and more particularly, to a data encryption method, apparatus, computer device, and storage medium.
Background
The tire pressure sensor is internally provided with a battery, and can periodically acquire tire pressure, temperature, acceleration and internal battery voltage. The collected information can be converted into digital quantity through a main control chip in the tire pressure sensor, and the tire pressure sensor collects acceleration information to judge the motion state of the automobile. The information of the tire temperature, the tire pressure and the like is periodically transmitted through the equipped radio frequency transmitting unit. In addition, the tire pressure sensor is provided with an infrared receiving unit which receives an infrared signal sent by an infrared transmitting unit, so that the tire pressure sensor enters different working modes; at present, the data sent by the radio frequency transmitting unit are transmitted by using plain text, a protocol definition can be analyzed by using a specific device as long as the original data is captured, and the risk that the sensor data can be illegally used exists, such as a counterfeit receiver or a counterfeit sensor.
Therefore, it is necessary to design a method to avoid the information transmitted over the air from being leaked, and achieve the purpose of transmission security.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a data encryption method, a data encryption device, a computer device and a storage medium.
In order to achieve the purpose, the invention adopts the following technical scheme: a data encryption method comprising:
acquiring plaintext data and key data;
and carrying out exclusive-or operation and exchange operation according to the plaintext data and the key data to form ciphertext data.
The further technical scheme is as follows: the plaintext data comprises a unique ID identifier of the tire pressure sensor, tire pressure data, tire temperature data, an alarm identifier and a check code.
The further technical scheme is as follows: the performing an exclusive-or operation and an exchange operation according to the plaintext data and the key data to form ciphertext data includes:
carrying out XOR operation on the plaintext data and the key data to form first intermediate data;
and performing exclusive-or operation and exchange operation on the first intermediate data and the key data to form ciphertext data.
The further technical scheme is as follows: the performing an exclusive-or operation and an exchange operation on the first intermediate data and the key data to form ciphertext data includes:
performing exchange operation on the first intermediate data to obtain second intermediate data;
performing exchange operation on the key data to obtain intermediate key data;
performing exclusive-or operation on the second intermediate data and the intermediate key data to obtain operation data;
and performing exchange operation on the operation data to obtain ciphertext data.
The further technical scheme is as follows: the performing a swap operation on the first intermediate data to obtain second intermediate data includes:
the data of the upper three bytes of the first intermediate data is exchanged with the data of the lower five bytes to obtain second intermediate data.
The further technical scheme is as follows: the performing an exchange operation on the key data to obtain intermediate key data includes:
the upper five bytes of data of the key data are exchanged with the lower three bytes of data to obtain intermediate key data.
The further technical scheme is as follows: the performing an exchange operation on the operation data to obtain ciphertext data includes:
and exchanging the data of the upper four bytes and the data of the lower four bytes of the operation data to obtain the ciphertext data.
The present invention also provides a data encryption apparatus, comprising:
an acquisition unit configured to acquire plaintext data and key data;
and the operation unit is used for carrying out XOR operation and exchange operation according to the plaintext data and the key data so as to form ciphertext data.
The invention also provides computer equipment which comprises a memory and a processor, wherein the memory is stored with a computer program, and the processor realizes the method when executing the computer program.
The invention also provides a storage medium storing a computer program which, when executed by a processor, is operable to carry out the method as described above.
Compared with the prior art, the invention has the beneficial effects that: the invention carries out XOR operation and exchange operation by utilizing the plaintext data and the key data to encrypt the plaintext data, has the encryption of the key data and the encryption of the operation process, improves the encryption safety, carries out the decomposition, the disorder and the recombination of the results of the XOR operation of the plaintext data and the key data, carries out the decomposition, the disorder and the recombination of the key data, carries out the XOR operation and the exchange operation on two groups of combined data, increases the complexity of the encryption process, ensures the encryption safety and the stability, avoids the information transmitted in the air from being leaked, and achieves the aim of transmission safety.
The invention is further described below with reference to the accompanying drawings and specific embodiments.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a data encryption method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a data encryption method according to an embodiment of the present invention;
fig. 3 is a sub-flow diagram of a data encryption method according to an embodiment of the present invention;
fig. 4 is a sub-flow diagram of a data encryption method according to an embodiment of the present invention;
FIG. 5 is a schematic block diagram of a data encryption apparatus provided by an embodiment of the present invention;
fig. 6 is a schematic block diagram of an arithmetic unit of the data encryption device provided in the embodiment of the present invention;
fig. 7 is a schematic block diagram of a ciphertext data forming subunit of the data encryption apparatus provided by the embodiment of the present invention;
FIG. 8 is a schematic block diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view illustrating an application scenario of a data encryption method according to an embodiment of the present invention. Fig. 2 is a schematic flow chart of a data encryption method according to an embodiment of the present invention. The data encryption method is applied to the server. The server can be one server in a distributed service platform, a data encryption platform is deployed in the server, and the terminal sends the plaintext data and the key data to the server, so that the monitoring server can encrypt the plaintext data and the key data, information transmitted in the air is prevented from being leaked, and the purpose of safe transmission is achieved.
It should be noted that fig. 2 only illustrates one server, and in an actual operation process, the server may perform encryption processing on plaintext data and key data transmitted from a plurality of terminals.
Fig. 2 is a schematic flow chart of a data encryption method according to an embodiment of the present invention. As shown in fig. 2, the method includes the following steps S110 to S120.
And S110, acquiring plaintext data and key data.
In this embodiment, the plaintext data refers to data to be transmitted, the key data refers to a key for decrypting the plaintext data, the key data is preset data and is stored in the database of the server, and when encrypting, the corresponding key data is called from the database of the server; in a TPMS (Tire Pressure Monitoring System), the TPMS is a one-way communication System, a transmitter of high-frequency data is a Tire Pressure sensor, and a receiver thereof is a Tire Pressure controller, so that the terminal refers to the Tire Pressure sensor, and the high-frequency data is plaintext data; the fixed length of the plaintext data is 6 bytes, and the plaintext data comprises a unique ID identifier of the tire pressure sensor, tire pressure data, tire temperature data, an alarm identifier and a check code.
In the present embodiment, the key data is also 6 bytes of data.
And S120, performing exclusive OR operation and exchange operation according to the plaintext data and the key data to form ciphertext data.
In this embodiment, the ciphertext data is data formed by decrypting the key data and the plaintext data, the plaintext data is encrypted to become unreadable ciphertext data, and the unreadable ciphertext data is restored to the original data through a reversible algorithm, so that the encryption and decryption purposes are achieved, and the security and the confidentiality in the transmission process are high.
In one embodiment, as shown in fig. 3, the step S120 may include steps S121 to S122.
And S121, carrying out XOR operation on the plaintext data and the key data to form first intermediate data.
In the present embodiment, the first intermediate data refers to data formed by obfuscating plaintext data and key data.
For example: the key is secret _ key [6] {0x23,0x7B,0x65,0x1B,0x3F,0xE5 }; plaintext data is clear _ text _ code [6] {0x2C,0x7B,0x21,0x45,0xC0,0x97 }; the whole exclusive-or operation process is as follows:
tempbuf1[ index ] ═ clear _ text _ code [ index ] < secret _ key [ index ], where what is formed by all tempbuf1[ index ] is the first intermediate data; where index refers to each specific data, such as: clear _ text _ code [0] is 0x2C, and so on.
And S122, carrying out XOR operation and exchange operation on the first intermediate data and the key data to form ciphertext data.
In one embodiment, as shown in FIG. 4, the step S122 may include steps S1221 to S1224.
And S1221, performing exchange operation on the first intermediate data to obtain second intermediate data.
In the present embodiment, the data of the upper three bytes of the first intermediate data is exchanged with the data of the lower five bytes to obtain the second intermediate data.
For the above example, after the first intermediate data tempbuf1 is obtained, the following formula is specifically adopted for exchange to obtain the second intermediate data tempbuf 2:
tempbuf2[0]=(tempbuf1[2]&0xE0)|(tempbuf1[3]&0x1F);
tempbuf2[1]=(tempbuf1[3]&0xE0)|(tempbuf1[1]&0x1F);
tempbuf2[2]=(tempbuf1[1]&0xE0)|(tempbuf1[0]&0x1F);
tempbuf2[3]=(tempbuf1[4]&0xE0)|(tempbuf1[5]&0x1F);
tempbuf2[4]=(tempbuf1[5]&0xE0)|(tempbuf1[2]&0x1F);
tempbuf2[5]=(tempbuf1[0]&0xE0)|(tempbuf1[4]&0x1F)。
the first intermediate data is decomposed by three bytes at the upper position and five bytes at the lower position and then is disorganized to be combined into new second intermediate data of 6 bytes, so that the stability and the complexity of the encryption process are further improved.
S1222, performing an exchange operation on the key data to obtain intermediate key data.
In this embodiment, the upper five bytes of data of the key data are exchanged with the lower three bytes of data to obtain the intermediate key data.
The intermediate key data tempbuf3 may be obtained using the following formula for the key data in the above example:
tempbuf3[0]=(secret_key[5]&0xF8)|(secret_key[2]&0x07);
tempbuf3[1]=(secret_key[1]&0xF8)|(secret_key[3]&0x07);
tempbuf3[2]=(secret_key[3]&0xF8)|(secret_key[0]&0x07);
tempbuf3[3]=(secret_key[0]&0xF8)|(secret_key[4]&0x07);
tempbuf3[4]=(secret_key[2]&0xF8)|(secret_key[5]&0x07);
tempbuf3[5]=(secret_key[4]&0xF8)|(secret_key[1]&0x07)。
the five high-order bytes and the three low-order bytes of the key data are decomposed and disordered and recombined to form intermediate key data, so that the stability and the complexity of the encryption process are further improved.
And S1223, performing exclusive OR operation on the second intermediate data and the intermediate key data to obtain operation data.
In this embodiment, the arithmetic data is data obtained by performing an exclusive or operation on the second intermediate data and the intermediate key data.
The above example may obtain the operation data tempbuf 1' by using the following formula: tempbuf 1' [ index ] ═ tempbuf2[ index ] ^ tempbuf3[ index ].
S1224, performing an exchange operation on the operation data to obtain ciphertext data.
In this embodiment, the data of the upper four bytes of the operation data is exchanged with the data of the lower four bytes of the operation data to obtain the ciphertext data.
For the above example, the following companies may be used to obtain the ciphertext data encrypt _ code:
encrypt_code[0]=(tempbuf1’[1]&0xF0)|(tempbuf1’[2]&0x0F);
encrypt_code[1]=(tempbuf1’[3]&0xF0)|(tempbuf1’[4]&0x0F);
encrypt_code[2]=(tempbuf1’[0]&0xF0)|(tempbuf1’[1]&0x0F);
encrypt_code[3]=(tempbuf1’[2]&0xF0)|(tempbuf1’[3]&0x0F);
encrypt_code[4]=(tempbuf1’[5]&0xF0)|(tempbuf1’[0]&0x0F);
encrypt_code[5]=(tempbuf1’[4]&0xF0)|(tempbuf1’[5]&0x0F)。
specifically, key data of 6 bytes in length is defined first, and the sender and receiver keys are the same. And for the sending party, the data encryption party belongs to. Firstly, 6 bytes of plaintext data needing wireless transmission and 6 bytes of key data are subjected to exclusive OR operation, then 6 bytes of first intermediate data obtained by operation are decomposed and disordered by using high 3 bytes and low 5 bytes to form new 6 bytes of second intermediate data, similarly, the high 5 bytes and the low 3 bytes of the key data are decomposed, disordered and recombined to form intermediate key data, the second intermediate data and the intermediate key data are subjected to exclusive OR operation to obtain 6 bytes of operation data, the operation data are decomposed by using high 4 bytes and low 4 bytes to be disordered and combined, and finally 6 bytes of ciphertext data formed after operation are obtained. Encrypted data ciphertext transmission is adopted, so that the data readability is reduced, and the safety is improved; the encryption algorithm is guaranteed to be secret and secret key is guaranteed to be secret, so that the cracking cost is high; the whole process is simplified and short, and the computing overhead of the embedded equipment is low.
For the receiving party, the receiving party belongs to the data decryption party, and the decryption process is just opposite to the encryption process, and is the inverse operation process of the encryption algorithm. Firstly, 6 bytes of ciphertext data are decomposed and recombined according to high 4 bytes and low 4 bytes, the combination sequence is consistent with the encryption process, similarly, 6 bytes of key data are decomposed and recombined according to high 5 bytes and low 3 bytes, the two groups of combined data are subjected to exclusive-or operation, the obtained data are decomposed and recombined according to high 3 bytes and low 5 bytes, and are subjected to exclusive-or operation with the decomposed key data, and finally 6 bytes of plaintext data are obtained; the reversible algorithm can restore data at the authorized end without distortion.
For the decryption process, the following formula can be used in sequence:
Figure BDA0001822684290000091
Figure BDA0001822684290000101
in the actual application process, the plaintext data is printed firstly, then the plaintext data is encrypted, the ciphertext data is printed, the ciphertext data is decrypted, and finally the decrypted data is printed.
The example plaintext data above is: 44, 123, 33, 69, 192, 151; the ciphertext data is: 52, 209, 187, 21, 43, 4; the decrypted data is: 44, 123, 33, 69, 192, 151; therefore, plaintext data becomes unreadable ciphertext data after being encrypted, and the unreadable ciphertext data can be restored into original data through a reversible algorithm, so that the purpose of encryption and decryption is achieved.
According to the data encryption method, the plaintext data is encrypted by utilizing the XOR operation and the exchange operation of the plaintext data and the key data, the encryption of the key data and the encryption of the operation process are both provided, the encryption safety is improved, the results of the XOR operation of the plaintext data and the key data are decomposed, disturbed and recombined, and the XOR operation and the exchange operation are carried out on the two groups of combined data, so that the complexity of the encryption process is increased, the encryption safety and stability are ensured, the information transmitted in the air is prevented from being leaked, and the purpose of transmission safety is achieved.
Fig. 5 is a schematic block diagram of a data encryption apparatus 300 according to an embodiment of the present invention. As shown in fig. 5, the present invention also provides a data encryption apparatus 300 corresponding to the above data encryption method. The data encryption device 300 includes a unit for executing the above-described data encryption method, and the device may be configured in a server. Specifically, referring to fig. 5, the data encryption apparatus 300 includes:
an acquisition unit 301 configured to acquire plaintext data and key data;
an arithmetic unit 302, configured to perform an exclusive-or operation and an exchange operation according to the plaintext data and the key data to form ciphertext data.
In one embodiment, as shown in FIG. 6, the operation unit 302 comprises
A first operation subunit 3021, configured to perform an exclusive or operation on the plaintext data and the key data to form first intermediate data;
the ciphertext data forming subunit 3022 is configured to perform an exclusive or operation and an exchange operation on the first intermediate data and the key data to form ciphertext data.
In one embodiment, as shown in fig. 7, the ciphertext data forming subunit 3022 includes:
a first exchanging module 30221, configured to perform an exchanging operation on the first intermediate data to obtain second intermediate data;
a second exchanging module 30222, configured to perform exchanging operation on the key data to obtain intermediate key data;
an exclusive or operation module 30223, configured to perform an exclusive or operation on the second intermediate data and the intermediate key data to obtain operation data;
the third exchanging module 30224 is configured to perform an exchanging operation on the operation data to obtain ciphertext data.
It should be noted that, as can be clearly understood by those skilled in the art, the specific implementation processes of the data encryption device 300 and each unit may refer to the corresponding descriptions in the foregoing method embodiments, and for convenience and brevity of description, no further description is provided herein.
The data encryption apparatus 300 may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 8.
Referring to fig. 8, fig. 8 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 is a server. The server may be an independent server or a server cluster composed of a plurality of servers.
Referring to fig. 8, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer programs 5032 include program instructions that, when executed, cause the processor 502 to perform a data encryption method.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be caused to execute a data encryption method.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 8 is a block diagram of only a portion of the configuration relevant to the present teachings and does not constitute a limitation on the computer device 500 to which the present teachings may be applied, and that a particular computer device 500 may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
Wherein the processor 502 is configured to run the computer program 5032 stored in the memory to implement the following steps:
acquiring plaintext data and key data;
and carrying out exclusive-or operation and exchange operation according to the plaintext data and the key data to form ciphertext data.
The plaintext data comprises a unique ID identifier of the tire pressure sensor, tire pressure data, tire temperature data, an alarm identifier and a check code.
In an embodiment, when the processor 502 implements the steps of performing the xor operation and the exchange operation according to the plaintext data and the key data to form the ciphertext data, the following steps are specifically implemented:
carrying out XOR operation on the plaintext data and the key data to form first intermediate data;
and performing exclusive-or operation and exchange operation on the first intermediate data and the key data to form ciphertext data.
In an embodiment, when the processor 502 implements the steps of performing the exclusive or operation and the exchange operation on the first intermediate data and the key data to form the ciphertext data, the following steps are specifically implemented:
performing exchange operation on the first intermediate data to obtain second intermediate data;
performing exchange operation on the key data to obtain intermediate key data;
performing exclusive-or operation on the second intermediate data and the intermediate key data to obtain operation data;
and performing exchange operation on the operation data to obtain ciphertext data.
In an embodiment, when the processor 502 performs the step of performing the exchange operation on the first intermediate data to obtain the second intermediate data, the following steps are specifically implemented:
the data of the upper three bytes of the first intermediate data is exchanged with the data of the lower five bytes to obtain second intermediate data.
In an embodiment, when the processor 502 implements the step of performing the exchange operation on the key data to obtain the intermediate key data, the following steps are specifically implemented:
the upper five bytes of data of the key data are exchanged with the lower three bytes of data to obtain intermediate key data.
In an embodiment, when the processor 502 implements the step of performing the exchange operation on the operation data to obtain the ciphertext data, the following steps are specifically implemented:
and exchanging the data of the upper four bytes and the data of the lower four bytes of the operation data to obtain the ciphertext data.
It should be understood that in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program includes program instructions, and the computer program may be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program, when executed by a processor, causes the processor to perform the steps of:
acquiring plaintext data and key data;
and carrying out exclusive-or operation and exchange operation according to the plaintext data and the key data to form ciphertext data.
The plaintext data comprises a unique ID identifier of the tire pressure sensor, tire pressure data, tire temperature data, an alarm identifier and a check code.
In an embodiment, when the processor executes the computer program to implement the step of performing the xor operation and the exchange operation on the plaintext data and the key data to form the ciphertext data, the following steps are specifically implemented:
carrying out XOR operation on the plaintext data and the key data to form first intermediate data;
and performing exclusive-or operation and exchange operation on the first intermediate data and the key data to form ciphertext data.
In an embodiment, when the processor executes the computer program to implement the step of performing the xor operation and the exchange operation on the first intermediate data and the key data to form the ciphertext data, the following steps are specifically implemented:
performing exchange operation on the first intermediate data to obtain second intermediate data;
performing exchange operation on the key data to obtain intermediate key data;
performing exclusive-or operation on the second intermediate data and the intermediate key data to obtain operation data;
and performing exchange operation on the operation data to obtain ciphertext data.
In an embodiment, when the processor executes the computer program to implement the step of performing the exchange operation on the first intermediate data to obtain the second intermediate data, the following steps are specifically implemented:
the data of the upper three bytes of the first intermediate data is exchanged with the data of the lower five bytes to obtain second intermediate data.
In an embodiment, when the processor executes the computer program to implement the step of performing the exchange operation on the key data to obtain the intermediate key data, the following steps are specifically implemented:
the upper five bytes of data of the key data are exchanged with the lower three bytes of data to obtain intermediate key data.
In an embodiment, when the processor executes the computer program to implement the step of performing the exchange operation on the operation data to obtain the ciphertext data, the following steps are specifically implemented:
and exchanging the data of the upper four bytes and the data of the lower four bytes of the operation data to obtain the ciphertext data.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (6)

1. A data encryption method, comprising:
acquiring plaintext data and key data;
performing exclusive-or operation and exchange operation according to the plaintext data and the key data to form ciphertext data;
the performing an exclusive-or operation and an exchange operation according to the plaintext data and the key data to form ciphertext data includes:
carrying out XOR operation on the plaintext data and the key data to form first intermediate data;
performing an exclusive-or operation and an exchange operation on the first intermediate data and the key data to form ciphertext data;
the performing an exclusive-or operation and an exchange operation on the first intermediate data and the key data to form ciphertext data includes:
performing exchange operation on the first intermediate data to obtain second intermediate data;
performing exchange operation on the key data to obtain intermediate key data;
performing exclusive-or operation on the second intermediate data and the intermediate key data to obtain operation data;
performing exchange operation on the operation data to obtain ciphertext data;
the performing a swap operation on the first intermediate data to obtain second intermediate data includes:
exchanging the data of the upper three bytes and the data of the lower five bytes of the first intermediate data to obtain second intermediate data;
the performing an exchange operation on the key data to obtain intermediate key data includes:
the upper five bytes of data of the key data are exchanged with the lower three bytes of data to obtain intermediate key data.
2. The data encryption method of claim 1, wherein the plaintext data includes a unique ID identifier of the tire pressure sensor, tire pressure data, tire temperature data, an alarm identification, and a check code.
3. The data encryption method according to claim 1, wherein the performing an exchange operation on the operation data to obtain ciphertext data comprises:
and exchanging the data of the upper four bytes and the data of the lower four bytes of the operation data to obtain the ciphertext data.
4. A data encryption apparatus, comprising:
an acquisition unit configured to acquire plaintext data and key data;
the arithmetic unit is used for carrying out XOR operation and exchange operation according to the plaintext data and the key data to form ciphertext data;
the arithmetic unit includes:
the first operation subunit is used for carrying out XOR operation on the plaintext data and the key data to form first intermediate data;
the ciphertext data forming subunit is used for performing exclusive-or operation and exchange operation on the first intermediate data and the key data to form ciphertext data;
the ciphertext data forming subunit includes:
the first exchange module is used for carrying out exchange operation on the first intermediate data to obtain second intermediate data; specifically, data of three upper bytes and data of five lower bytes of the first intermediate data are exchanged to obtain second intermediate data;
the second exchange module is used for carrying out exchange operation on the key data to obtain intermediate key data; specifically, the data of the upper five bytes of the key data is exchanged with the data of the lower three bytes of the key data to obtain intermediate key data;
the XOR operation module is used for carrying out XOR operation on the second intermediate data and the intermediate key data to obtain operation data;
and the third exchange module is used for carrying out exchange operation on the operation data to obtain ciphertext data.
5. A computer device, characterized in that the computer device comprises a memory, on which a computer program is stored, and a processor, which when executing the computer program implements the method according to any of claims 1 to 3.
6. A storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 3.
CN201811171780.0A 2018-10-09 2018-10-09 Data encryption method and device, computer equipment and storage medium Active CN109413051B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811171780.0A CN109413051B (en) 2018-10-09 2018-10-09 Data encryption method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811171780.0A CN109413051B (en) 2018-10-09 2018-10-09 Data encryption method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109413051A CN109413051A (en) 2019-03-01
CN109413051B true CN109413051B (en) 2021-02-26

Family

ID=65466878

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811171780.0A Active CN109413051B (en) 2018-10-09 2018-10-09 Data encryption method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109413051B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110213041A (en) * 2019-04-26 2019-09-06 五八有限公司 Data ciphering method, decryption method, device, electronic equipment and storage medium
CN111355748A (en) * 2020-04-13 2020-06-30 猫岐智能科技(上海)有限公司 Data submitting method
CN112528349A (en) * 2020-12-02 2021-03-19 合肥宏晶微电子科技股份有限公司 Data processing method and device, electronic equipment and readable storage medium
CN113297613A (en) * 2021-05-12 2021-08-24 捷德(中国)科技有限公司 Key access method, key processing device, key processing equipment and computer storage medium
CN117131517B (en) * 2023-10-27 2024-03-19 鼎铉商用密码测评技术(深圳)有限公司 Security detection method for encryption algorithm, terminal equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006012638A2 (en) * 2004-07-29 2006-02-02 Vadium Technology, Inc. Techniques to strengthen one-time pad encryption
CN101461173A (en) * 2005-07-28 2009-06-17 朗迅科技公司 Method of symmetric key data encryption
CN103067155A (en) * 2012-12-27 2013-04-24 东南大学 Method and test circuit for preventing data encryption algorithm (DES) attack based on power analysis

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4823904B2 (en) * 2005-03-31 2011-11-24 パナソニック株式会社 Data encryption apparatus and data encryption method
CN101013938B (en) * 2007-01-12 2010-04-07 广州市诚毅科技软件开发有限公司 Encryption method of block cipher
CN101001142A (en) * 2007-01-17 2007-07-18 张建华 Encipher-decipher method based on iterative random number generator
CN102075326B (en) * 2010-12-13 2012-08-22 北京邮电大学 Churning encryption method for high-speed network data
US8767954B2 (en) * 2011-12-01 2014-07-01 Colloid, Llc Methods and systems for deriving a cryptographic framework

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006012638A2 (en) * 2004-07-29 2006-02-02 Vadium Technology, Inc. Techniques to strengthen one-time pad encryption
CN101461173A (en) * 2005-07-28 2009-06-17 朗迅科技公司 Method of symmetric key data encryption
CN103067155A (en) * 2012-12-27 2013-04-24 东南大学 Method and test circuit for preventing data encryption algorithm (DES) attack based on power analysis

Also Published As

Publication number Publication date
CN109413051A (en) 2019-03-01

Similar Documents

Publication Publication Date Title
CN109413051B (en) Data encryption method and device, computer equipment and storage medium
WO2021093334A1 (en) Vehicle upgrade packet processing method and apparatus
CN112913189B (en) OTA (over the air) upgrading method and device
CN109218010A (en) Data ciphering method and device, data decryption method and device
CN111614608A (en) Hybrid cryptographic system and method for encrypting data
CN107454590A (en) A kind of data ciphering method, decryption method and wireless router
CN113595744B (en) Network access method, device, electronic equipment and storage medium
CN112653719A (en) Automobile information safety storage method and device, electronic equipment and storage medium
CN113132082A (en) Communication method and device based on vehicle intranet
CN109314644A (en) Data providing system, data protecting device, data offering method and computer program
CN104239808A (en) Method and device for encryption transmission of data
CN112039922B (en) Encryption communication method and device
CN113259901B (en) Message protection method and device for Internet of vehicles
US10764285B2 (en) Method and system for encryption using a radio frequency fingerprint
CN110312232B (en) Vehicle communication system and vehicle communication method
CN111294211A (en) USB network card data encryption and decryption method based on RNDIS
CN114039771B (en) Data processing method, device and system, electronic equipment and storage medium
CN112333699B (en) Internet of things communication protocol encryption method, equipment and storage medium
CN114745114A (en) Key agreement method, device, equipment and medium based on password derivation
CN110035032A (en) Unlocked by fingerprint method and unlocked by fingerprint system
CN111093169B (en) Communication establishing method and device
Bella et al. Are you secure in your car? poster
US20150124967A1 (en) Method to detect an ota (over the air) standard message affected by an error
CN111314287A (en) Public key encryption communication mode and device
CN116669019B (en) Unmanned vehicle track communication encryption method

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