[go: up one dir, main page]

CN114374504A - Data encryption method, data decryption method, data encryption device, data decryption device and server - Google Patents

Data encryption method, data decryption method, data encryption device, data decryption device and server Download PDF

Info

Publication number
CN114374504A
CN114374504A CN202110937949.4A CN202110937949A CN114374504A CN 114374504 A CN114374504 A CN 114374504A CN 202110937949 A CN202110937949 A CN 202110937949A CN 114374504 A CN114374504 A CN 114374504A
Authority
CN
China
Prior art keywords
base
sequence
data
key
base group
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110937949.4A
Other languages
Chinese (zh)
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.)
Cec Cyberspace Great Wall Co ltd
Original Assignee
Cec Cyberspace Great Wall 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 Cec Cyberspace Great Wall Co ltd filed Critical Cec Cyberspace Great Wall Co ltd
Priority to CN202110937949.4A priority Critical patent/CN114374504A/en
Publication of CN114374504A publication Critical patent/CN114374504A/en
Pending legal-status Critical Current

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/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Power Engineering (AREA)
  • Computing Systems (AREA)
  • Storage Device Security (AREA)

Abstract

The invention provides a data encryption method, which relates to the technical field of communication and comprises the following steps: encrypting each original data in the original data sequence according to a base pairing algorithm to obtain a first base sequence, wherein the first base sequence comprises a first base group corresponding to each original data, and the first base group comprises one or more bases; generating the corresponding relation between the bit sequence of each first base group and each first base group in the first base sequence; encrypting the bit sequence corresponding to each first base group in the first base sequence according to a base pairing algorithm to obtain a second base sequence, wherein the second base sequence comprises a second base group corresponding to the bit sequence of each first base group, and the second base group comprises one or more bases. The invention provides a data encryption method which greatly reduces the computational cost. The invention also provides a data decryption method, a data encryption device, a data decryption device, a server and a computer storage medium.

Description

Data encryption method, data decryption method, data encryption device, data decryption device and server
Technical Field
The invention relates to the technical field of computers, in particular to a data encryption method, a data decryption method, a data encryption device, a data decryption device, a server and a computer storage medium.
Background
With the rapid development of network technologies and the continuous precipitation of mass data, privacy protection becomes an important topic, and the privacy protection does not want a third party to acquire unauthorized information.
In the related art, privacy protection may be implemented based on a cryptography method and a joint learning method. In the cryptography method, disturbance is usually added to original data (for example, a part of noise data is added), however, the part of disturbance data also needs to go through an encryption and decryption process, which results in that the system needs to consume more computational resources; in the combined method, due to confidentiality reasons, data cannot penetrate a system, sub-model building and optimization can be realized only locally, parameters are transmitted to a central server, new tasks are distributed through the central server to conduct model iteration and optimization, the more calculation times are passed, the better model effect is achieved, and the calculation resources of the system are occupied more.
Disclosure of Invention
The present invention is directed to at least one of the technical problems in the prior art, and provides a data encryption method, a data decryption method, a data encryption apparatus, a data decryption apparatus, a server, and a computer storage medium.
In a first aspect, the present invention provides a data encryption method, including:
encrypting each original data in an original data sequence according to a base pairing algorithm to obtain a first base sequence, wherein the first base sequence comprises a first base group corresponding to each original data, and the first base group comprises one or more bases;
generating a correspondence relationship between the position sequence of each of the first base groups in the first base sequence and each of the first base groups;
encrypting the bit sequence corresponding to each first base group in the first base sequence according to a base pairing algorithm to obtain a second base sequence, wherein the second base sequence comprises a second base group corresponding to the bit sequence of each first base group, and the second base group comprises one or more bases.
In some embodiments, encrypting each of the raw data in the raw data sequence according to a base pairing algorithm to obtain a first base sequence comprises:
determining a correspondence between the plurality of data expression symbols and the first base group according to a base pairing algorithm;
and replacing the data expression symbol corresponding to each original data in the original data sequence with the first base group corresponding to the data expression symbol according to the corresponding relation between the plurality of data expression symbols and the first base group so as to generate the first base sequence.
In some embodiments, determining the correspondence of the plurality of data expression symbols to the first set of bases according to a base pairing algorithm comprises:
determining a symbol range to which a data expression symbol of each original data in the original data sequence belongs;
judging whether the number of data expression symbols included in the symbol range is less than or equal to the number of bases in the base pairing algorithm;
and if the number of the data expression symbols contained in the symbol range is judged to be less than or equal to the number of the bases in the base pairing algorithm, allocating different bases to different data expression symbols in the symbol range according to the base pairing algorithm so as to determine the corresponding relation between the plurality of data expression symbols and the first base group.
In some embodiments, after determining whether the number of data expression symbols included in the symbol range is less than or equal to the number of bases in the base pairing algorithm, the method further comprises:
if the number of the data expression symbols contained in the symbol range is judged to be larger than the number of the bases in the base pairing algorithm, randomly allocating a base to each data expression symbol in the symbol range according to the base pairing algorithm;
judging whether the current corresponding base groups of all the data expression symbols in the symbol range are different;
if the base groups corresponding to at least two data expression symbols currently are the same, returning to execute the step of randomly allocating a base to each data expression symbol in the symbol range according to the base pairing algorithm;
and if the base groups corresponding to all the data expression symbols currently are different, determining the corresponding relation between the plurality of data expression symbols and the first base group according to all the data expression symbols and the currently corresponding base groups.
In some embodiments, the encrypting the bit sequence corresponding to each first base group in the first base sequence according to a base pairing algorithm to obtain a second base sequence comprises:
generating a corresponding relation between the bit sequence corresponding to each first base group in the first base sequence and a second base group according to a base pairing algorithm;
and generating the second base sequence according to the second base group corresponding to the bit sequence corresponding to each first base group.
In some embodiments, the method further comprises:
and generating a first key according to the corresponding relation between the plurality of data expression symbols and the first base group.
In some embodiments, the method further comprises:
and generating a second key according to the corresponding relation between the bit sequence corresponding to each first base group in the first base sequence and the second base group.
In some embodiments, after the encrypting the bit sequence corresponding to each first base group in the first base sequence according to the base pairing algorithm to obtain a second base sequence, the method further includes:
and carrying out Hash operation on the second base sequence to obtain a third key.
In some embodiments, where the first key, the second key, and the third key are obtained, the method further comprises:
and carrying out Hash operation on the first key, the second key and the third key to obtain a fourth key.
In a second aspect, the present invention further provides a data decryption method, configured to decrypt a data sequence encrypted by using the data encryption method provided by the present invention, where the data decryption method includes:
replacing each second base group in the pre-acquired second base sequence with a bit sequence corresponding to each first base group in the first base sequence according to a pre-acquired second key to obtain a first decrypted sequence; wherein the second key comprises a corresponding relationship between a bit sequence corresponding to each first base group in the first base sequence and the second base group;
replacing the bit sequence corresponding to each first base group in the first decryption sequence with the corresponding first base group according to the corresponding relation between the bit sequence of the first base group and the first base group to obtain a second decryption sequence;
and replacing each first base group included in the second decrypted sequence with corresponding original data according to a first key acquired in advance to obtain an original data sequence, wherein the first key comprises the corresponding relation between the original data and the first base group.
In some embodiments, before replacing each second base group in the second base sequence with a corresponding bit sequence of each first base group in the first base sequence according to the second key obtained in advance to obtain the first decrypted sequence, the method further includes:
acquiring a third key and a fourth key, wherein the third key is obtained by the data encryption device through performing hash operation on the second base sequence, and the fourth key is obtained by the data encryption device through performing hash operation on the first key, the second key and the third key;
performing hash operation on the first key, the second key and the third key to obtain a first hash value;
detecting whether the first hash value is the same as the fourth key;
if the first hash value is detected to be the same as the fourth key, performing hash operation on the second base sequence to obtain a second hash value;
detecting whether the second hash value is the same as the third key;
the replacing, according to a second key obtained in advance, each second base group in the second base sequence obtained in advance with a bit sequence corresponding to each first base group in the first base sequence to obtain a first decrypted sequence includes: and if the second hash value is detected to be the same as the third key, replacing each second base group in the second base sequence with the corresponding bit sequence of each first base group in the first base sequence according to the second key so as to obtain a first decrypted sequence.
In a third aspect, the present invention provides a data encryption apparatus, including:
a first encryption module, configured to encrypt each piece of original data in an original data sequence according to a base pairing algorithm to obtain a first base sequence, where the first base sequence includes a first base group corresponding to each piece of original data, and the first base group includes one or more bases;
a generating module, configured to generate a correspondence between a bit sequence of each first base group in the first base sequence and each first base group;
and the second encryption module is used for encrypting the bit sequences corresponding to the first base groups in the first base sequence according to a base pairing algorithm to obtain a second base sequence, wherein the second base sequence comprises the second base groups corresponding to the bit sequences of the first base groups, and the second base group comprises one or more bases.
In a fourth aspect, the present invention provides a data decryption apparatus for decrypting a data sequence encrypted by a data encryption apparatus provided by the present invention, the data decryption apparatus comprising:
a first decryption module, configured to replace, according to a second key obtained in advance, each second base group in the second base sequence with a bit sequence corresponding to each first base group in the first base sequence to obtain a first decrypted sequence, where the second key includes a correspondence between a bit sequence corresponding to each first base group in the first base sequence and the second base group;
a second decryption module, configured to replace, according to a corresponding relationship between a bit sequence of the first base group and each of the first base groups, the bit sequence corresponding to each of the first base groups in the first decryption sequence with the corresponding first base group to obtain a second decryption sequence;
and the third decryption module is used for replacing each first base group included in the second decryption sequence with corresponding original data according to a first key acquired in advance so as to obtain an original data sequence, wherein the first key includes the corresponding relation between the original data and the first base group.
In a fifth aspect, the present invention provides a server, comprising:
a processor and a storage medium having stored therein a computer program which, when executed by the processor, implements the data encryption method provided by the present invention or implements the data decryption method provided by the present invention.
In a sixth aspect, the present invention provides a computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the data encryption method provided by the present invention or implements the data decryption method provided by the present invention.
According to the data encryption method, the data decryption method, the data encryption device, the data decryption device, the server and the computer storage medium, data are encrypted based on DNA base pair data, and data information and bit sequence information in an original data sequence are encrypted respectively, so that a data receiver can restore the original data sequence automatically according to an encryption rule of the data information and an encryption rule of the bit sequence information in the original data sequence, compared with the prior art, encryption and decryption calculation of disturbance information on private data is not needed, and therefore computing power overhead is greatly reduced, and the data receiver can conveniently and quickly obtain the original data, and user experience of both sides of data transaction is improved.
Drawings
Fig. 1 is a flowchart of a data encryption method according to an embodiment of the present invention;
fig. 2 is a flowchart of another data encryption method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating an embodiment of step S1011 according to the present invention;
fig. 4 is a flowchart of another data encryption method according to an embodiment of the present invention;
fig. 5 is a flowchart of a data decryption method according to an embodiment of the present invention;
fig. 6 is a flowchart of another data decryption method according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a data encryption apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a data decryption apparatus according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the following describes the data encryption method, the data decryption method, the data encryption device, the data decryption device, the server, and the computer storage medium in detail with reference to the accompanying drawings.
Fig. 1 is a flowchart of a data encryption method according to an embodiment of the present invention.
Referring to fig. 1, a data encryption method provided in an embodiment of the present invention includes:
step S101, encrypting each original data in the original data sequence according to a base pairing algorithm to obtain a first base sequence, wherein the first base sequence comprises a first base group corresponding to each original data, and the first base group comprises one or more bases.
In the present embodiment, the base is a base included in a DNA sequence, and preferably, the base in the present embodiment includes A, G, C and T four bases.
Specifically, in step S101, each piece of original data in the original data sequence is encrypted according to a preset base pairing algorithm, so that each piece of original data corresponds to a first base set, and the first base set corresponding to all pieces of original data forms a first base sequence, wherein the first base set may be composed of one base, for example, the first base set is "T", or the first base set may be composed of a plurality of bases, for example, the first base set is "AG". It should be noted that, in an original data sequence, the composition structure of all the first base sets needs to be consistent, for example, all the first base sets are composed of one base, or all the first base sets are composed of two bases.
In the embodiment of the present invention, the raw data may be, for example, data related to privacy protection, such as model parameters, operation results, and the like used for training a model.
In some embodiments, referring to fig. 2, step S101 may specifically include: step S1011 to step S1012.
Step S1011, determining the corresponding relation between the plurality of data expression symbols and the first base group according to a base pairing algorithm.
In an embodiment of the present invention, the original data sequence includes one or more original data, each original data may be represented based on a corresponding data expression symbol, for example, the original data sequence is an arabic number sequence, and the range of the data expression symbols is 0 to 9, wherein according to a base pairing algorithm, one or more bases corresponding to each data expression symbol may be determined, and the one or more bases corresponding to each data expression symbol constitute a first base group, that is, each data expression symbol in the range of the data expression symbols corresponds to one first base group. As shown in the following table:
TABLE 1
0 1 2 3 4 5 6 7 8 9
A A G T C C T G C G
A G G T G A A T C A
Step S1012 is performed to replace the data expression symbol corresponding to each original data in the original data sequence with the first base group corresponding to the data expression symbol according to the correspondence relationship between the plurality of data expression symbols and the first base group, so as to generate the first base sequence.
For example, the original data sequence is D ═ 5,7,4,3,1}, the correspondence relationship shown in table 1 is an encryption rule of the original data sequence, which can be referred to as a first key k1, the original data sequence D is encrypted according to the correspondence relationship between the plurality of data expression symbols and the first base group described in table 1, that is, the first key k1, so that the first base group corresponding to each data expression symbol in the sequence D can be determined, thereby generating a first base sequence, and the first base sequence is D ═ CA, GT, CG, TT, AG }, so that the correspondence relationship between each data expression symbol in the original data sequence and the first base group shown in table 2 is obtained.
TABLE 2
5 7 4 3 1
C G C T A
A T G T G
Further, in some embodiments, referring to fig. 3, step S1011 specifically includes: step S1011a to step S1011 f.
Step S1011a determines the symbol range to which the data expression symbol of each piece of original data in the original data sequence belongs.
For example, the original data sequence is an arabic number sequence, the original data sequence is D ═ {5,7,4,3,1}, and the data expression symbols of the original data belong to symbol ranges of 0 to 9.
Step S1011b, it is determined whether or not the number of data expression symbols included in the symbol range is equal to or less than the number of bases in the base pairing algorithm.
For example, in the present embodiment, the number of the data expression symbols is 10 when the number of the base types is 4 and the symbol range to which the data expression symbols belong is 0 to 9 as determined in step S1011 a.
If it is determined in step S1011b that the number of data expression symbols included in the symbol range is less than or equal to the number of bases in the base pairing algorithm, step S1011c is performed to assign a uniquely identified base to each data expression symbol.
In step S1011b, if it is determined that the number of data expression symbols included in the symbol range is greater than the number of bases in the base pairing algorithm, steps S1011d to S1011f are performed to assign a base set consisting of a plurality of bases to each data expression symbol to uniquely identify each data expression symbol.
Step S1011c, assigning different bases to different data expression symbols within the symbol range according to a base pairing algorithm, so as to determine the corresponding relationship between the plurality of data expression symbols and the first base group.
After step S1011c is executed, step S1012 is executed.
In step S1011d, a base is randomly assigned to each data expression symbol within the symbol range according to the base pairing algorithm.
Step S1011d is the first base pairing process, wherein each base pairing process is performed by base allocation in a random allocation manner, and the result of the first base pairing is shown in Table 3:
TABLE 3
0 1 2 3 4 5 6 7 8 9
A A G T C C T G C G
Step S1011e, it is determined whether the current corresponding nucleotide sets of all data expression symbols within the symbol range are different.
If it is determined that there are at least two data expression symbols that are currently corresponding to the same base group, returning to step S1011d to continue the base allocation; if it is determined that the nucleotide sets corresponding to all the data expression symbols are different, step S1011f is performed.
As shown in Table 3, since the number of data expression symbols within the symbol range is larger than the number of base species, the base and the data expression symbol cannot form a unique correspondence in the first base pairing result, and thus the base pairing algorithm needs to be run again, namely, step S1011d is executed to perform the second base pairing process, and the second base pairing result can be shown in Table 1.
In some embodiments, if it is determined that there are at least two data expression symbols that currently correspond to the same base set, the same base set may be manually changed to change the same base set to a different base set.
Step S1011f, determining the corresponding relationship between the plurality of data expression symbols and the first base group based on all the data expression symbols and the currently corresponding base group.
After step S1011f, step S1012 is performed.
In the embodiment of the present invention, the data expression symbols are not limited to arabic numeral symbols, but may be other types of symbols, such as "#,"% "and the like, and the base assignment replacement may be performed by performing one or more base pairing algorithms regardless of the type of the data expression symbols.
Step S102, generating the corresponding relation between the bit sequence of each first base group and each first base group in the first base sequence.
In the first base sequence, each first base group has a fixed position sequence, the position sequence refers to the arrangement position of each first base group in the first base sequence, and the corresponding relation between the position sequence of each first base group and each first base group in the first base sequence represents the structure of the first base sequence. For example, when the first base sequence is d ═ { CA, GT, CG, TT, AG }, the relationship between the sequence of each first base group in the first base sequence and each first base group is:
Figure BDA0003213569240000101
wherein each of the sequence numbers dx of d1 to d5 represents the position sequence of the first base group in the first base sequence.
Step S103, encrypting the bit sequences corresponding to the first base groups in the first base sequences according to a base pairing algorithm to obtain second base sequences, wherein the second base sequences comprise second base groups corresponding to the bit sequences of the first base groups, and the second base groups comprise one or more bases.
As described above, the second nucleotide sequences are obtained by encrypting the positions d1 to d5 corresponding to the respective first nucleotide groups in the first nucleotide sequence, and each second nucleotide group in the second nucleotide sequence corresponds to one position dx.
With continued reference to fig. 2, in some embodiments, step S103 specifically includes:
and step S1031, generating the corresponding relation between the second base group and the bit sequence corresponding to each first base group in the first base sequence according to the base pairing algorithm.
In this example, one or more bases are randomly assigned to each position (e.g., d1, d2, d3, d4, d5) by running one or more base pairing algorithms to generate a position-to-second base set correspondence for each first base set in the first base sequence, as shown in table 4:
TABLE 4
Figure BDA0003213569240000102
It should be noted that table 4 only illustrates a case where each bit sequence corresponds to one base, and the embodiments of the present invention include but are not limited thereto, and each bit sequence may also correspond to 2 or more bases.
Step S1032 generates a second base sequence from the second base group corresponding to the bit sequence corresponding to each first base group.
The second base sequences corresponding to the respective positions are combined in tandem to form a second base sequence according to the positions corresponding to the respective first base groups, and the second base sequence may be referred to as a single-stranded DNA, and for example, the second base sequence generated in table 4 is "AGCGT".
The data encryption method provided by the embodiment of the invention is based on DNA base pair data encryption, and respectively encrypts the data information and the bit sequence information in the original data sequence, so that a data receiver can subsequently and automatically recover the original data sequence according to the encryption rule of the data information and the encryption rule of the bit sequence information in the original data sequence.
Fig. 4 is a flowchart of another data encryption method according to an embodiment of the present invention.
Referring to fig. 4, in this embodiment, in order to ensure the authenticity of data received by the data receiver, an authentication key is also generated in the data encryption process for the data receiver to verify the correctness of the data according to the authentication key.
Specifically, in this embodiment, in step S1011, a first key is generated according to the correspondence between the plurality of data expression symbols and the first base group, and preferably, the first key is the correspondence between the plurality of data expression symbols and the first base group; similarly, in step S1031, the second key is generated according to the corresponding relationship between the bit sequence and the second base group corresponding to each first base group in the first base sequence, and preferably, the second key is the corresponding relationship between the bit sequence and the second base group corresponding to each first base group in the first base sequence.
In the embodiment of the present invention, after step S103, the method further includes:
and step S104, carrying out Hash operation on the second base sequence to obtain a third key.
Specifically, the second base sequence is subjected to a hash operation (hash algorithm) to obtain a corresponding hash value, and the hash value is a third key.
And S105, carrying out hash operation on the first key, the second key and the third key to obtain a fourth key.
Specifically, a hash operation is performed on the first key, the second key, and the third key to obtain a corresponding hash value, where the hash value is a fourth key.
Wherein the third key is used to verify the authenticity of the second base sequence and the fourth key is used to verify the authenticity of the first key, the second key and the third key.
Specifically, after receiving the fourth key, the data receiving party performs hash operation on the first key, the second key and the third key to obtain a first hash value, and then detects whether the first hash value is the same as the fourth key, and if so, proves that the first key, the second key and the third key are real; and further performing hash operation on the second base sequence to obtain a second hash value, detecting whether the second hash value is the same as the third key, and if so, proving that the second base sequence is real.
Fig. 5 is a flowchart of a data decryption method according to an embodiment of the present invention.
Referring to fig. 5, a data decryption method provided in the embodiment of the present invention is used for decrypting a data sequence encrypted by using the data encryption method provided in the embodiment of the present invention, and the data decryption method includes:
step S201, replacing each second base group in the second base sequence obtained in advance with a bit sequence corresponding to each first base group in the first base sequence according to a second key obtained in advance to obtain a first decrypted sequence; wherein the second key comprises the corresponding relation between the bit sequence corresponding to each first base group in the first base sequence and the second base group.
Corresponding to the above steps S101 to S103, the second base sequence is obtained by encrypting the bit sequence corresponding to each first base group in the first base sequence by the data encryption means, and the first base sequence is obtained by encrypting each piece of original data in the original data sequence by the data encryption means.
Continuing with the above example, for example, the second base sequence is "AGCGT"; correspondingly, the bit sequence of each first base group in the first base sequence corresponds to each first base group in the following relation:
Figure BDA0003213569240000121
the second key is:
Figure BDA0003213569240000122
after replacing each element in the second base sequence "AGCGT" according to the second key, the first decryption sequence is obtained as "d 1d2d3d4d 5".
Step S202, according to the corresponding relation between the bit sequence of the first base group and the first base group, replacing the bit sequence corresponding to each first base group in the first decryption sequence with the corresponding first base group to obtain a second decryption sequence.
The bit sequence of each first base group in the first base sequence corresponds to each first base group in the following relation:
Figure BDA0003213569240000131
and replacing the elements in the first decryption sequence "d 1d2d3d4d 5" according to the corresponding relation between the bit sequence of the first base group and the first base group to obtain a second decryption sequence "CA, GT, CG, TT, AG".
Step S203, replacing each first base group included in the second decrypted sequence with corresponding original data according to a first key obtained in advance to obtain an original data sequence, wherein the first key includes a corresponding relationship between the original data and the first base group.
The first key is:
0 1 2 3 4 5 6 7 8 9
A A G T C C T G C G
A G G T G A A T C A
and after element replacement is carried out on the second decryption sequence 'CA, GT, CG, TT and AG' according to the first key, the original data sequence '57431' is obtained.
In some embodiments, the first key and the second key may be previously informed by the data sender of a key generation method of the data receiver, and the data receiver may generate the keys by itself.
In other embodiments, the first key and the second key may also be obtained by the data receiver from the data sender.
Fig. 6 is a flowchart of another data decryption method according to an embodiment of the present invention.
Referring to fig. 6, in some embodiments, before step S201, the method further includes:
step S200a, obtaining a third key and a fourth key, where the third key is obtained by the data encryption device through performing hash operation on the second base sequence, and the fourth key is obtained by the book encryption device through performing hash operation on the first key, the second key, and the third key.
Step S200b, performing hash operation on the first key, the second key, and the third key to obtain a first hash value.
Step S200c, detecting whether the first hash value is the same as the fourth key.
If the first hash value is detected to be the same as the fourth key, step S200d is executed to perform a subsequent verification process, and if the first hash value is detected to be different from the fourth key, it indicates that the data sent by the data sender has a problem, and the decryption process may be ended.
And step S200d, performing hash operation on the second base sequence to obtain a second hash value.
Step S200e, detecting whether the second hash value is the same as the third key.
If the second hash value is detected to be the same as the third key, it indicates that the data sent by the sender is correct, the subsequent step S201 may be continuously performed to decrypt the data, and if the second hash value is detected to be different from the third key, it indicates that the data sent by the data sender has a problem, and the decryption process may be ended.
In the embodiment, the data receiver firstly verifies the authenticity of the data sent by the data sender based on the third key and the fourth key, and then performs the subsequent decryption process when the verification is passed, so that the data decryption efficiency is improved to a certain extent.
Fig. 7 is a schematic structural diagram of a data encryption apparatus according to an embodiment of the present invention.
Referring to fig. 7, a data encryption apparatus provided in an embodiment of the present invention includes: a first encryption module 11, a generation module 12 and a second encryption module 13.
The first encryption module 11 is configured to encrypt each original data in an original data sequence according to a base pairing algorithm to obtain a first base sequence, where the first base sequence includes a first base group corresponding to each original data, and the first base group includes one or more bases; the generating module 12 is configured to generate a corresponding relationship between the bit sequence of each first base group in the first base sequence and each first base group; the second encryption module 13 is configured to encrypt the bit sequence corresponding to each first base group in the first base sequence according to a base pairing algorithm to obtain a second base sequence, where the second base sequence includes a second base group corresponding to the bit sequence of each first base group, and the second base group includes one or more bases.
The data encryption device provided in the embodiment of the present invention is used to implement the data encryption method provided in the embodiment of the present invention, and specifically, for the functional modules included in the data encryption device and the interaction among the functional modules, reference is made to the description of the corresponding method steps in the data encryption method, and details are not repeated here.
Fig. 8 is a schematic structural diagram of a data decryption apparatus according to an embodiment of the present invention.
Referring to fig. 8, a data decryption apparatus according to an embodiment of the present invention is configured to decrypt a data sequence encrypted by using the data encryption apparatus provided in the present invention, and the data decryption apparatus includes: a first decryption module 21, a second decryption module 22 and a third decryption module 23.
The first decryption module 22 is configured to replace, according to a second key obtained in advance, each second base group in the second base sequence with a bit sequence corresponding to each first base group in the first base sequence to obtain a first decrypted sequence, where the second key includes a correspondence between the bit sequence corresponding to each first base group in the first base sequence and the second base group; the second decryption module 23 is configured to replace, according to the corresponding relationship between the bit sequence of the first base group and each first base group, the bit sequence corresponding to each first base group in the first decryption sequence with the corresponding first base group to obtain a second decryption sequence; the third decryption module 24 is configured to replace each first base group included in the second decrypted sequence with corresponding original data according to a first key obtained in advance, so as to obtain an original data sequence, where the first key includes a corresponding relationship between the original data and the first base group.
The data decryption device provided in the embodiment of the present invention is used to implement the data decryption method provided in the embodiment of the present invention, and specifically, for the functional modules included in the data decryption device and the interaction among the functional modules, reference is made to the description of the corresponding method steps in the data decryption method, and details are not repeated here.
An embodiment of the present invention further provides a server, including:
the data encryption method comprises a processor and a storage medium, wherein a computer program is stored in the storage medium, and when the computer program is executed by the processor, the data encryption method provided by the embodiment of the invention or the data decryption method provided by the embodiment of the invention is realized.
The embodiment of the present invention further provides a computer storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the data encryption method provided in the embodiment of the present invention or the data decryption method provided in the embodiment of the present invention.
It will be understood that the above embodiments are merely exemplary embodiments taken to illustrate the principles of the present invention, which is not limited thereto. It will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the spirit and substance of the invention, and these modifications and improvements are also considered to be within the scope of the invention.

Claims (15)

1. A method for data encryption, comprising:
encrypting each original data in an original data sequence according to a base pairing algorithm to obtain a first base sequence, wherein the first base sequence comprises a first base group corresponding to each original data, and the first base group comprises one or more bases;
generating a correspondence relationship between the position sequence of each of the first base groups in the first base sequence and each of the first base groups;
encrypting the bit sequence corresponding to each first base group in the first base sequence according to a base pairing algorithm to obtain a second base sequence, wherein the second base sequence comprises a second base group corresponding to the bit sequence of each first base group, and the second base group comprises one or more bases.
2. The method of claim 1, wherein encrypting each original datum in the sequence of original data according to a base pairing algorithm to obtain a first base sequence comprises:
determining a correspondence between the plurality of data expression symbols and the first base group according to a base pairing algorithm;
and replacing the data expression symbol corresponding to each original data in the original data sequence with the first base group corresponding to the data expression symbol according to the corresponding relation between the plurality of data expression symbols and the first base group so as to generate the first base sequence.
3. The method of claim 2, wherein determining the correspondence of the plurality of data expression symbols to the first set of bases according to a base pairing algorithm comprises:
determining a symbol range to which a data expression symbol of each original data in the original data sequence belongs;
judging whether the number of data expression symbols included in the symbol range is less than or equal to the number of bases in the base pairing algorithm;
and if the number of the data expression symbols contained in the symbol range is judged to be less than or equal to the number of the bases in the base pairing algorithm, allocating different bases to different data expression symbols in the symbol range according to the base pairing algorithm so as to determine the corresponding relation between the plurality of data expression symbols and the first base group.
4. The method according to claim 3, further comprising, after determining whether the number of data expression symbols included in the symbol range is equal to or less than the number of bases in the base pairing algorithm:
if the number of the data expression symbols contained in the symbol range is judged to be larger than the number of the bases in the base pairing algorithm, randomly allocating a base to each data expression symbol in the symbol range according to the base pairing algorithm;
judging whether the current corresponding base groups of all the data expression symbols in the symbol range are different;
if the base groups corresponding to at least two data expression symbols currently are the same, returning to execute the step of randomly allocating a base to each data expression symbol in the symbol range according to the base pairing algorithm;
and if the base groups corresponding to all the data expression symbols currently are different, determining the corresponding relation between the plurality of data expression symbols and the first base group according to all the data expression symbols and the currently corresponding base groups.
5. The method according to claim 1, wherein the encrypting the bit sequence corresponding to each first base group in the first base sequence according to a base pairing algorithm to obtain a second base sequence comprises:
generating a corresponding relation between the bit sequence corresponding to each first base group in the first base sequence and a second base group according to a base pairing algorithm;
and generating the second base sequence according to the second base group corresponding to the bit sequence corresponding to each first base group.
6. The method of claim 2, further comprising:
and generating a first key according to the corresponding relation between the plurality of data expression symbols and the first base group.
7. The method of claim 6, further comprising:
and generating a second key according to the corresponding relation between the bit sequence corresponding to each first base group in the first base sequence and the second base group.
8. The method according to claim 7, further comprising, after said encrypting the bit sequence corresponding to each first base group in the first base sequence according to a base pairing algorithm to obtain a second base sequence:
and carrying out Hash operation on the second base sequence to obtain a third key.
9. The method of claim 8, wherein if the first key, the second key, and the third key are obtained, the method further comprises:
and carrying out Hash operation on the first key, the second key and the third key to obtain a fourth key.
10. A data decryption method for decrypting a data sequence encrypted by the data encryption method according to any one of claims 1 to 9, the data decryption method comprising:
replacing each second base group in the pre-acquired second base sequence with a bit sequence corresponding to each first base group in the first base sequence according to a pre-acquired second key to obtain a first decrypted sequence; wherein the second key comprises a corresponding relationship between a bit sequence corresponding to each first base group in the first base sequence and the second base group;
replacing the bit sequence corresponding to each first base group in the first decryption sequence with the corresponding first base group according to the corresponding relation between the bit sequence of the first base group and the first base group to obtain a second decryption sequence;
and replacing each first base group included in the second decrypted sequence with corresponding original data according to a first key acquired in advance to obtain an original data sequence, wherein the first key comprises the corresponding relation between the original data and the first base group.
11. The method according to claim 10, before replacing each second base group in the pre-obtained second base sequence with a corresponding bit sequence of each first base group in the first base sequence according to the pre-obtained second key to obtain the first decrypted sequence, further comprising:
acquiring a third key and a fourth key, wherein the third key is obtained by the data encryption device through performing hash operation on the second base sequence, and the fourth key is obtained by the data encryption device through performing hash operation on the first key, the second key and the third key;
performing hash operation on the first key, the second key and the third key to obtain a first hash value;
detecting whether the first hash value is the same as the fourth key;
if the first hash value is detected to be the same as the fourth key, performing hash operation on the second base sequence to obtain a second hash value;
detecting whether the second hash value is the same as the third key;
the replacing, according to a second key obtained in advance, each second base group in the second base sequence obtained in advance with a bit sequence corresponding to each first base group in the first base sequence to obtain a first decrypted sequence includes: and if the second hash value is detected to be the same as the third key, replacing each second base group in the second base sequence with the corresponding bit sequence of each first base group in the first base sequence according to the second key so as to obtain a first decrypted sequence.
12. A data encryption apparatus, comprising:
a first encryption module, configured to encrypt each piece of original data in an original data sequence according to a base pairing algorithm to obtain a first base sequence, where the first base sequence includes a first base group corresponding to each piece of original data, and the first base group includes one or more bases;
a generating module, configured to generate a correspondence between a bit sequence of each first base group in the first base sequence and each first base group;
and the second encryption module is used for encrypting the bit sequences corresponding to the first base groups in the first base sequence according to a base pairing algorithm to obtain a second base sequence, wherein the second base sequence comprises the second base groups corresponding to the bit sequences of the first base groups, and the second base group comprises one or more bases.
13. A data decrypting apparatus for decrypting a data sequence encrypted by the data encrypting apparatus according to claim 12, comprising:
a first decryption module, configured to replace, according to a second key obtained in advance, each second base group in the second base sequence with a bit sequence corresponding to each first base group in the first base sequence to obtain a first decrypted sequence, where the second key includes a correspondence between a bit sequence corresponding to each first base group in the first base sequence and the second base group;
a second decryption module, configured to replace, according to a corresponding relationship between a bit sequence of the first base group and each of the first base groups, the bit sequence corresponding to each of the first base groups in the first decryption sequence with the corresponding first base group to obtain a second decryption sequence;
and the third decryption module is used for replacing each first base group included in the second decryption sequence with corresponding original data according to a first key acquired in advance so as to obtain an original data sequence, wherein the first key includes the corresponding relation between the original data and the first base group.
14. A server, comprising:
a processor and a storage medium having stored therein a computer program which, when executed by the processor, implements a data encryption method as claimed in any one of claims 1 to 9, or implements a data decryption method as claimed in claim 10 or 11.
15. A computer storage medium, having a computer program stored thereon, wherein the computer program, when executed by a processor, implements a data encryption method as claimed in any one of claims 1 to 9, or implements a data decryption method as claimed in claim 10 or 11.
CN202110937949.4A 2021-08-16 2021-08-16 Data encryption method, data decryption method, data encryption device, data decryption device and server Pending CN114374504A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110937949.4A CN114374504A (en) 2021-08-16 2021-08-16 Data encryption method, data decryption method, data encryption device, data decryption device and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110937949.4A CN114374504A (en) 2021-08-16 2021-08-16 Data encryption method, data decryption method, data encryption device, data decryption device and server

Publications (1)

Publication Number Publication Date
CN114374504A true CN114374504A (en) 2022-04-19

Family

ID=81138597

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110937949.4A Pending CN114374504A (en) 2021-08-16 2021-08-16 Data encryption method, data decryption method, data encryption device, data decryption device and server

Country Status (1)

Country Link
CN (1) CN114374504A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130044876A1 (en) * 2010-11-09 2013-02-21 National Aeronautics And Space Administration Genomics-based keyed hash message authentication code protocol
WO2014025056A1 (en) * 2012-08-07 2014-02-13 Hitachi Zosen Corporation Method of encryption and decryption using nucleic acid
US20170155503A1 (en) * 2015-12-01 2017-06-01 Ambit Microsystems (Shanghai) Ltd. Encryption system and method based on biometric technology
US9942206B1 (en) * 2016-12-23 2018-04-10 Quintiles Ims Incorporated System and method for privacy-preserving genomic data analysis
US20190311782A1 (en) * 2016-08-30 2019-10-10 Tsinghua University Method for biologically storing and restoring data
CN112084514A (en) * 2020-09-01 2020-12-15 宁波海特技术转移有限公司 Image encryption method and device for chaos sequence and DNA mutation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130044876A1 (en) * 2010-11-09 2013-02-21 National Aeronautics And Space Administration Genomics-based keyed hash message authentication code protocol
WO2014025056A1 (en) * 2012-08-07 2014-02-13 Hitachi Zosen Corporation Method of encryption and decryption using nucleic acid
US20170155503A1 (en) * 2015-12-01 2017-06-01 Ambit Microsystems (Shanghai) Ltd. Encryption system and method based on biometric technology
US20190311782A1 (en) * 2016-08-30 2019-10-10 Tsinghua University Method for biologically storing and restoring data
US9942206B1 (en) * 2016-12-23 2018-04-10 Quintiles Ims Incorporated System and method for privacy-preserving genomic data analysis
CN112084514A (en) * 2020-09-01 2020-12-15 宁波海特技术转移有限公司 Image encryption method and device for chaos sequence and DNA mutation

Similar Documents

Publication Publication Date Title
CN108390876B (en) Support revocation of outsourcing, verifiable multi-authority center access control method, cloud server
CN113824728B (en) Network communication method and system based on data encryption
US11018875B2 (en) Method and system for secure connected vehicle communication
CN112948784B (en) Internet of Things terminal identity authentication method, computer storage medium and electronic device
CN106209353A (en) Key management method and system thereof
CN112163854B (en) Hierarchical public key searchable encryption method and system based on block chain
CN108183791B (en) Intelligent terminal data security processing method and system applied to cloud environment
JP2015500585A (en) Simplified management of group secrets by group members
CN110351297B (en) Verification method and device applied to block chain
Erkin et al. Privacy-preserving distributed clustering
CN107707514A (en) A kind of method and system for being used between CDN node encrypt and device
GB2587438A (en) Key generation for use in secured communication
US20190044922A1 (en) Symmetric key identity systems and methods
CN114443718A (en) A data query method and system
CN1855815B (en) Systems and methods for generation and validation of isogeny-based signatures
JP5511803B2 (en) Techniques for performing symmetric cryptography
CN114793184A (en) Security chip communication method and device based on third-party key management node
Hong et al. A key-insulated CP-ABE with key exposure accountability for secure data sharing in the cloud
CN102347835A (en) Method for updating private key and equipment thereof, and method for acquiring session key and communication equipment thereof
CN114374504A (en) Data encryption method, data decryption method, data encryption device, data decryption device and server
CN113472734A (en) Identity authentication method and device
CN115865461B (en) Method and system for distributing data in high-performance computing cluster
CN110784318A (en) Group key updating method, device, electronic equipment, storage medium and communication system
CN114048495B (en) A block consensus method and device
CN117118618B (en) Data sharing method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20220419