DNA encryption method and apparatus based on randomly combined code tables, device, and storage medium
Through the DNA encryption method based on random combination code tables, the problem of poor DNA encryption effect in the prior art is solved, efficient and secure DNA encryption is achieved, and the growth of information storage needs is met.
Patent Information
- Application Number
- PCT/CN2023/141328
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-14
- Filing Date
- 2023-12-23
- Publication Date
- 2025-06-19
AI Technical Summary
In the prior art, DNA encryption effect is poor and cannot effectively cope with the growth of information storage demand.
Using a DNA encryption method based on a random combination code table, a code table composed of screened bases is obtained, and a random number is generated according to the file type of the file to be encoded for code table selection, encoding conversion and base order is adjusted to generate a DNA encryption sequence.
It improves the security and efficiency of DNA encryption, realizes effective encryption of files to be encoded, and enhances the security of information storage.
Smart Images

Figure CN2023141328_19062025_PF_FP_ABST
Abstract
Description
DNA encryption method, device, equipment and storage medium based on random combination code table Technical Field
[0001] The present invention relates to the field of DNA encryption technology, and in particular to a DNA encryption method, device, equipment and storage medium based on a random combination code table. Background Art
[0002] The continuous development of information technology has revolutionized human life. Physical distance no longer limits people, and communication is becoming increasingly frequent, generating vast amounts of data. This explosion of data is driving increasingly demanding requirements for information storage media. Traditional media like disks and optical disks are unable to cope with the rapid growth of information.
[0003] As a result, DNA information storage technology has gradually gained attention. DNA, as a storage medium, offers advantages such as high density, ease of storage, and long storage cycles. A single gram of DNA can store the entire world's information. Despite these advantages, DNA encryption currently offers limited research, resulting in poor results.
[0004] Summary of the Invention
[0005] Based on this, it is necessary to address the technical problem that the DNA encryption effect of the existing technology is poor, and propose a DNA encryption method, device, equipment and storage medium based on a random combination code table.
[0006] In a first aspect, a DNA encryption method based on a random combination code table is provided, the method comprising:
[0007] Obtaining each code table and a file to be encoded, wherein the code table is composed of bases screened according to a preset screening condition;
[0008] generating a random number according to the file type of the to-be-encoded file, selecting a code table from the code tables based on the random number, and using the selected code table as a target code table;
[0009] Performing encoding conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result;
[0010] The base sequence in the DNA encoding result is adjusted according to the random sequence to obtain a DNA encryption sequence.
[0011] In a second aspect, a DNA encryption device based on a random combination code table is provided, the device comprising:
[0012] An acquisition module, configured to acquire each code table and a file to be encoded, wherein the code table is composed of bases selected according to a preset screening condition;
[0013] a selection module, configured to generate a random number according to the file type of the file to be encoded, select a code table from the code tables based on the random number, and use the selected code table as a target code table;
[0014] A coding conversion module, configured to perform coding conversion according to the target code table and the file to be coded to obtain a DNA coding result, and generate a random sequence based on the length corresponding to the DNA coding result;
[0015] The adjustment module is used to adjust the base sequence in the DNA encoding result according to the random sequence to obtain a DNA encrypted sequence.
[0016] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the above-mentioned DNA encryption method based on a random combination code table are implemented.
[0017] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned DNA encryption method based on the random combination code table are implemented.
[0018] The DNA encryption method based on a random combination code table proposed in the present invention obtains each code table and a file to be encoded, wherein the code table is composed of bases screened according to preset screening conditions, and then generates a random number according to the file type of the file to be encoded, and selects a code table from each code table based on the random number, and uses the selected code table as the target code table. Then, code conversion is performed according to the target code table and the file to be encoded to obtain a DNA encoding result, and a random sequence is generated based on the length corresponding to the DNA encoding result. Finally, the base order in the DNA encoding result is adjusted according to the random sequence to obtain a DNA encryption sequence. The code table composed of the screened bases can be used to perform code conversion on the file to be encoded, thereby obtaining a DNA encryption sequence, thereby realizing DNA encryption of the file to be encoded and improving the security and efficiency of encryption. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] in:
[0021] FIG1 is a diagram showing an application environment of a DNA encryption method based on a random combination code table in one embodiment;
[0022] FIG2 is a flow chart of a DNA encryption method based on a random combination code table according to one embodiment;
[0023] FIG3 is a schematic diagram of code conversion of a DNA encryption method based on a random combination code table in one embodiment;
[0024] FIG4 is another schematic diagram of encoding conversion of a DNA encryption method based on a random combination code table in one embodiment;
[0025] FIG5 is a picture of a DNA encryption method based on a random combination code table according to an embodiment of the present invention;
[0026] FIG6 is a picture of a DNA encryption method based on a random combination code table according to an embodiment of the present invention;
[0027] FIG7 is an encrypted image of a picture Lena according to a DNA encryption method based on a random combination code table in one embodiment;
[0028] FIG8 is an encrypted image of a picture of Peppers using a DNA encryption method based on a random combination code table in one embodiment;
[0029] FIG9 is a structural block diagram of a DNA encryption device based on a random combination code table in one embodiment;
[0030] FIG10 is a block diagram of a computer device according to an embodiment;
[0031] FIG11 is a structural block diagram of a computer device in another embodiment. DETAILED DESCRIPTION
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0033] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0034] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0035] The DNA encryption method based on a random combination code table provided in an embodiment of the present invention can be applied in an application environment such as that shown in FIG1 , wherein a client 110 communicates with a server 120 via a network. The server 120 can receive the DNA encryption method based on a random combination code table proposed in this embodiment through the client 110. The server 120 obtains various code tables and a file to be encoded, wherein the code tables are composed of bases selected according to preset screening conditions. The server 120 then generates a random number based on the file type of the file to be encoded, selects a code table from the various code tables based on the random number, and uses the selected code table as a target code table. The server 120 then performs code conversion based on the target code table and the file to be encoded to obtain a DNA encoding result, and generates a random sequence based on the length corresponding to the DNA encoding result. Finally, the server 120 adjusts the base sequence in the DNA encoding result based on the random sequence to obtain a DNA encryption sequence. The server 120 can then perform code conversion on the file to be encoded using the selected base-based code table to obtain a DNA encryption sequence, thereby achieving DNA encryption of the file to be encoded and improving encryption security and efficiency. The client 110 may be, but is not limited to, various personal computers, laptop computers, smartphones, tablet computers, and portable wearable devices. The server 120 may be implemented as an independent server or a server cluster consisting of multiple servers. The present invention will be described in detail below through specific embodiments.
[0036] Please refer to FIG. 2 , which is a flow chart of a DNA encryption method based on a random combination code table according to an embodiment of the present invention, including the following steps:
[0037] Step S101: Obtaining various code tables and files to be encoded, wherein the code tables are composed of bases selected according to preset screening conditions;
[0038] The code tables can be designed based on the GC content and the preset screening conditions of the oligonucleotide (GC content is about 50%, and the length of the oligonucleotide is less than or equal to 3).
[0039] As an example, seven code tables are designed, namely code table a, code table b, code table c, code table d, code table e, code table f, and code table g.
[0040] As an example: code table a: length 2 can be expressed as 2 1 , code table a includes two base combinations r1 and r2, for example, r1 = (A or T), r2 = (C or G), where A, T, C, and G represent bases;
[0041] As an example, the length of code table b is 4, which can be expressed as 2 2,Code table b includes four base combinations r1~r4, for example, r1=A, r2=T, r3=C, r4=G;
[0042] As an example, the length of code table c is 8, which can be expressed as 2 3 , code table c includes eight base combinations from r1 to r8, for example, r1 = AC, r2 = AG, r3 = TC, r4 = TG, r5 = CA, r6 = CT, r7 = GA, r8 = GT
[0043] As an example, the length of code table d is 16, which can be expressed as 2 4 , code table d includes 16 base combinations from r1 to r16. For example, r1 to r16 are shown in the following table:
[0044] As an example, the length of code table e is 32, which can be expressed as 2 5 , code table e includes 32 base combinations from r1 to r32. For example, r1 to r32 are shown in the following table:
[0045] As an example, the code table f with a length of 64 can be expressed as 2 6 , code table e includes 64 base combinations from r1 to r64. For example, r1 to r64 are shown in the following table:
[0046] As an example, the length of code table g is 128, which can be expressed as 2 7 , code table g includes 128 base combinations from r1 to r128. For example, r1 to r128 are shown in the following table:
[0047] Step S102: generating a random number according to the file type of the file to be encoded, and selecting a code table from the various code tables based on the random number, and using the selected code table as a target code table;
[0048] The file type may be a text type, an image type, or other types.
[0049] In this embodiment, a random number corresponding to the file type of the file to be encoded is generated, and a code table is selected from the various code tables based on the random number, and the selected code table is used as the target code table. For example, if the random number is 7, the seventh code table is selected from the various code tables and is used as the target code table.
[0050] In one embodiment, the step of selecting a code table from the code tables according to a preset selection rule corresponding to the file type of the file to be encoded and using the selected code table as the target code table includes:
[0051] Step S1021: generating a random number based on the number of the code tables as a first random number;
[0052] The number refers to the total number of code tables, and the maximum value of the first random number can be equal to the value of the total number. For example, if the number is 7, the first random number can be any number from 0 to 7.
[0053] Step S1022: generating a random number based on the first random number and the file type of the to-be-encoded file as a second random number;
[0054] For example, when a random number from 0 to 7 is randomly generated as the first random number n1, if the file type of the file to be encoded is text, the second random number n2 = 7 - n1; if the file type of the file to be encoded is an image, the second random number n2 satisfies n1 + n2 = 8; if the file type of the file to be encoded is other types, the second random number n2 satisfies n1 + n2 = 8, where n1 refers to the first random number and n2 refers to the second random number.
[0055] Step S1023: Selecting a code table corresponding to the first random number from each of the code tables as a target code table, and selecting a code table corresponding to the second random number from each of the code tables as a target code table.
[0056] For example, when the file type of the file to be encoded is text, the first random number is 1 and the second random number is 6, then the first code table corresponding to the first random number and the sixth code table corresponding to the second random number are selected from each code table, and the first code table is used as the target code table, and the sixth code table is used as the target code table.
[0057] Step S103: performing encoding conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result;
[0058] For example, if the data in the file to be encoded is character data, each character data corresponds to a base combination in the target code table, and the same character data only corresponds to one base combination. Finally, after all the data in the file to be encoded is converted into various base combinations, the DNA encoding result is obtained.
[0059] As an example, a random sequence is generated based on the length corresponding to the DNA encoding result, wherein the length may be the number of base combinations in the DNA encoding result.
[0060] Step S104: adjusting the base sequence in the DNA encoding result according to the random sequence to obtain a DNA encryption sequence.
[0061] The random numbers in the random sequence are used to adjust the base sequence in the DNA encoding result, and the adjusted DNA encoding result is used as the DNA encryption sequence. For example, if the largest random number in the random sequence is 10, the tenth base combination in the DNA encoding result will be ranked first in the DNA encoding result.
[0062] The DNA encryption method based on a random combination code table proposed in this embodiment obtains each code table and a file to be encoded, wherein the code table is composed of bases screened according to preset screening conditions, and then generates a random number according to the file type of the file to be encoded, and selects a code table from each code table based on the random number, and uses the selected code table as the target code table. Then, code conversion is performed according to the target code table and the file to be encoded to obtain a DNA encoding result, and a random sequence is generated based on the length corresponding to the DNA encoding result. Finally, the base order in the DNA encoding result is adjusted according to the random sequence to obtain a DNA encryption sequence. The code table composed of the screened bases can be used to perform code conversion on the file to be encoded, thereby obtaining a DNA encryption sequence, thereby realizing DNA encryption of the file to be encoded and improving the security and efficiency of encryption.
[0063] In one embodiment, the step of performing code conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result includes:
[0064] Step 201: When there is only one target code table, the file to be encoded is converted according to the base combinations in the target code table and the order of the data in the file to be encoded to obtain a first DNA sequence, and the first DNA sequence is used as the DNA encoding result.
[0065] When only one target code table exists, this means that only one code table has been selected as the target code table. Using the target code table, the file to be encoded is transcoded according to the order of the data in the file to be encoded, yielding a first DNA sequence. It should be noted that for text files, the characters are directly read for code table mapping and encoding. For image files, the pixel values of each pixel are directly read for code table mapping and encoding. For other file types, binary information is read for byte encoding.
[0066] As an example, as shown in Figure 3, the data in the file to be encoded is the character strings a, b, c, a, 1, 2, and the code table t0 is the target code table. According to the order of the data in the file to be encoded, a is encoded as ATC, b is encoded as TAC, c is encoded as TGA, a is encoded as ATC, 1 is encoded as ATA, and 2 is encoded as CAA.
[0067] In one embodiment, the step of performing code conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result, further includes:
[0068] Step S301: When there are two target code tables, a matrix is constructed according to each base combination in one target code table and each base combination in the other target code table to obtain a matrix;
[0069] Step S302: performing encoding conversion based on the matrix and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result.
[0070] When there are two target code tables, it means that two code tables are selected as target code tables. A matrix is constructed according to each base combination in one target code table and each base combination in the other target code table to obtain a matrix.
[0071] As an example, as shown in Figure 4, code table t1 is a target code table, code table t2 is another target code table, and a matrix is constructed by the two target code tables, wherein code table t1 includes base combinations TTA, CCA, ATC, GAC, ACC, ATT, and code table t2 includes base combinations ATC, TAC, TGA, CAG, TAT, CAA.
[0072] In one embodiment, the DNA encoding result includes a second DNA sequence and a third DNA sequence. The steps of performing encoding conversion based on the matrix and the file to be encoded to obtain the DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result include:
[0073] Step S401: Storing the data in the file to be encoded in the matrix according to the order of the data in the file to be encoded to determine a first base combination and a second base combination, wherein the first base combination refers to a base combination of the data in the file to be encoded in the matrix corresponding to one of the target code tables, and the second base combination refers to a base combination of the data in the file to be encoded in the matrix corresponding to another of the target code tables;
[0074] For example, as shown in FIG4 , the data in the file to be encoded is a, the first base combination corresponding to a is CCA, and the second base combination corresponding to a is TGA.
[0075] Step S402: combining the first bases into a second DNA sequence and combining the second bases into a third DNA sequence according to the position order of the data in the file to be encoded in the matrix;
[0076] Specifically, according to the position order of the data in the file to be encoded in the matrix, the first base combinations corresponding to all the data in the file to be encoded are combined as the second DNA sequence, and the second base combinations corresponding to all the data in the file to be encoded are combined as the third DNA sequence.
[0077] Step S403: Generate a random sequence based on the second DNA sequence and the third DNA sequence.
[0078] For example, a random sequence is generated by the number of first base combinations in the second DNA sequence and the number of second base combinations in the third DNA sequence.
[0079] In one embodiment, the random sequence includes a first random sequence and a second random sequence, and the step of generating the random sequence based on the second DNA sequence and the third DNA sequence includes:
[0080] Step S501: Generate a first random sequence through a Sine chaotic mapping function, wherein the length of the first random sequence is the same as that of the second DNA sequence;
[0081] Step S502: Generate a second random sequence through a Sine chaotic mapping function, wherein the length of the second random sequence is the same as that of the third DNA sequence.
[0082] As an example, a first random sequence S1 is generated by using a Sine chaotic mapping function, and the starting values s1 and a are saved. The Sine chaotic mapping function is shown in the following formula: S1 = {s1, s2, ..., s n} n = length (second DNA sequence)
[0083] It should be noted that the second random sequence S2 is generated in the same manner as the first random sequence, and will not be described in detail here.
[0084] In one embodiment, the step of adjusting the base sequence in the DNA encoding result according to the random sequence to obtain a DNA encrypted sequence includes:
[0085] Step S601: sorting the first random sequence according to a preset sorting rule, and indexing the sorted first random sequence to adjust the order of each first base combination in the second DNA sequence;
[0086] As an example, the first random sequence is sorted from largest to smallest, and the sorted first random sequence is used as an index to adjust the order of the first base combinations in the second DNA sequence. For example, if the sorted first random sequence is {1, 2, 3, 4}, the fourth first base combination is adjusted to the first position in the second DNA sequence, the first first base combination is adjusted to the last position in the second DNA sequence, and the second first base combination is swapped with the third first base combination in the second DNA sequence.
[0087] Step S602: sorting the second random sequence according to a preset sorting rule, and indexing the sorted second random sequence to adjust the order of each second base combination in the third DNA sequence;
[0088] As an example, the second random sequence is sorted from largest to smallest, and the sorted second random sequence is used as an index to adjust the order of the second base combinations in the third DNA sequence. For example, if the sorted second random sequence is {1, 2, 3, 4}, the fourth second base combination is adjusted to the first position in the third DNA sequence, the first second base combination is adjusted to the last position in the third DNA sequence, and the second second base combination is swapped with the third second base combination in the third DNA sequence.
[0089] Step S603: using the adjusted second DNA sequence and the adjusted third DNA sequence as the DNA encryption sequence.
[0090] As an example, the decryption process is the inverse process of encryption. By generating the first random sequence and the second random sequence using the recorded starting value and parameter a of the Sine function, and selecting the password table using the recorded random numbers n1 and n2, the DNA encryption sequence can be converted into the file to be encrypted.
[0091] As another example, Figures 5 and 6 show two images, Lena and Peppers, commonly used in classic computer vision. These two images were used as files to be encrypted using the DNA encryption method based on a random combination code table of the present invention. The encrypted image of Lena is shown in Figure 7, and the encrypted image of Peppers is shown in Figure 8. The encrypted images have uniform pixel distribution and good randomness, resulting in excellent encryption performance. The encrypted DNA sequences contain no overly long oligonucleotides, and their GC content is between 45% and 60%, with an overall average GC content of approximately 50%, demonstrating excellent biochemical properties.
[0092] Referring to FIG. 9 , in one embodiment, a DNA encryption device based on a random combination code table is provided, the device comprising:
[0093] An acquisition module 10 is used to acquire various code tables and files to be encoded, wherein the code tables are composed of bases selected according to preset screening conditions;
[0094] A selection module 20 is configured to generate a random number according to the file type of the file to be encoded, select a code table from the code tables based on the random number, and use the selected code table as a target code table;
[0095] The encoding conversion module 30 is used to perform encoding conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generate a random sequence based on the length corresponding to the DNA encoding result;
[0096] The adjustment module 40 is used to adjust the base sequence in the DNA encoding result according to the random sequence to obtain a DNA encrypted sequence.
[0097] In one embodiment, the selection module 20 is configured to: generate a random number based on the number of the code tables as a first random number;
[0098] Generate a random number based on the first random number and the file type of the file to be encoded as a second random number;
[0099] A code table corresponding to the first random number is selected from each of the code tables as a target code table, and a code table corresponding to the second random number is selected from each of the code tables as a target code table.
[0100] In one embodiment, the encoding conversion module 30 is used to: when there is only one target code table, perform encoding conversion on the file to be encoded according to the base combinations in the target code table and in the order of the data in the file to be encoded, to obtain a first DNA sequence, and use the first DNA sequence as the DNA encoding result.
[0101] In one embodiment, the encoding conversion module 30 is configured to: when there are two target code tables, construct a matrix based on each base combination in one target code table and each base combination in the other target code table to obtain a matrix;
[0102] Encoding conversion is performed based on the matrix and the file to be encoded to obtain a DNA encoding result, and a random sequence is generated based on the length corresponding to the DNA encoding result.
[0103] In one embodiment, the encoding conversion module 30 is configured to: store the data in the file to be encoded in the matrix according to the order of the data in the file to be encoded, so as to determine a first base combination and a second base combination, wherein the first base combination refers to a base combination of the data in the file to be encoded in the matrix corresponding to one of the target code tables, and the second base combination refers to a base combination of the data in the file to be encoded in the matrix corresponding to another of the target code tables;
[0104] According to the position order of the data in the file to be encoded in the matrix, each of the first base combinations is used as a second DNA sequence, and each of the second base combinations is used as a third DNA sequence;
[0105] A random sequence is generated based on the second DNA sequence and the third DNA sequence.
[0106] In one embodiment, the encoding conversion module 30 is configured to: generate a first random sequence by using a Sine chaotic mapping function, wherein the length of the first random sequence is the same as that of the second DNA sequence;
[0107] A second random sequence is generated through a Sine chaotic mapping function, wherein the length of the second random sequence is the same as that of the third DNA sequence.
[0108] In one embodiment, the adjustment module 40 is configured to: sort the first random sequence according to a preset sorting rule, and index the sorted first random sequence to adjust the order of each of the first base combinations in the second DNA sequence;
[0109] Sorting the second random sequence according to a preset sorting rule, and indexing the sorted second random sequence to adjust the order of each second base combination in the third DNA sequence;
[0110] The adjusted second DNA sequence and the adjusted third DNA sequence are used as the DNA encryption sequence.
[0111] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in FIG10 . The computer device includes a processor, a memory, a network interface, and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a DNA encryption method based on a random combination code table on the server side.
[0112] In one embodiment, a computer device is provided, which may be a client, and its internal structure diagram may be shown in Figure 11. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server via a network connection. When the computer program is executed by the processor, it implements the functions or steps on the client side of a DNA encryption method based on a random combination code table.
[0113] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0114] Obtaining each code table and a file to be encoded, wherein the code table is composed of bases screened according to a preset screening condition;
[0115] generating a random number according to the file type of the to-be-encoded file, selecting a code table from the code tables based on the random number, and using the selected code table as a target code table;
[0116] Performing encoding conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result;
[0117] The base sequence in the DNA encoding result is adjusted according to the random sequence to obtain a DNA encryption sequence.
[0118] The DNA encryption method based on a random combination code table proposed in this embodiment obtains each code table and a file to be encoded, wherein the code table is composed of bases screened according to preset screening conditions, and then generates a random number according to the file type of the file to be encoded, and selects a code table from each code table based on the random number, and uses the selected code table as the target code table. Then, code conversion is performed according to the target code table and the file to be encoded to obtain a DNA encoding result, and a random sequence is generated based on the length corresponding to the DNA encoding result. Finally, the base order in the DNA encoding result is adjusted according to the random sequence to obtain a DNA encryption sequence. The code table composed of the screened bases can be used to perform code conversion on the file to be encoded, thereby obtaining a DNA encryption sequence, thereby realizing DNA encryption of the file to be encoded and improving the security and efficiency of encryption.
[0119] In one embodiment, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0120] Obtaining each code table and a file to be encoded, wherein the code table is composed of bases screened according to a preset screening condition;
[0121] generating a random number according to the file type of the to-be-encoded file, selecting a code table from the code tables based on the random number, and using the selected code table as a target code table;
[0122] Performing encoding conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result;
[0123] The base sequence in the DNA encoding result is adjusted according to the random sequence to obtain a DNA encryption sequence.
[0124] The DNA encryption method based on a random combination code table proposed in this embodiment obtains each code table and a file to be encoded, wherein the code table is composed of bases screened according to preset screening conditions, and then generates a random number according to the file type of the file to be encoded, and selects a code table from each code table based on the random number, and uses the selected code table as the target code table. Then, code conversion is performed according to the target code table and the file to be encoded to obtain a DNA encoding result, and a random sequence is generated based on the length corresponding to the DNA encoding result. Finally, the base order in the DNA encoding result is adjusted according to the random sequence to obtain a DNA encryption sequence. The code table composed of the screened bases can be used to perform code conversion on the file to be encoded, thereby obtaining a DNA encryption sequence, thereby realizing DNA encryption of the file to be encoded and improving the security and efficiency of encryption.
[0125] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can be found in the relevant descriptions of the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0126] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0127] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0128] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. A DNA encryption method based on a random combination code table, characterized in that, The DNA encryption method based on a random combination code table includes: Obtaining each code table and the file to be encoded, where the code table is composed of bases screened according to preset screening conditions; Generating a random number according to the file type of the file to be encoded, and performing code table selection in each of the code tables based on the random number, and taking the selected code table as the target code table; Performing encoding conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result; Adjusting the base order in the DNA encoding result according to the random sequence to obtain a DNA encryption sequence.
2. The DNA encryption method based on a random combination code table according to claim 1, characterized in that, The step of generating a random number according to the file type of the file to be encoded, and performing code table selection in each of the code tables based on the random number, and taking the selected code table as the target code table includes: Generating a random number based on the number of the code tables as the first random number; Generating a random number based on the first random number and the file type of the file to be encoded as the second random number; Selecting the code table corresponding to the first random number in each of the code tables as the target code table, and selecting the code table corresponding to the second random number in each of the code tables as the target code table.
3. The DNA encryption method based on a random combination code table according to claim 2, characterized in that, The step of performing encoding conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result includes: When there is only one target code table, performing encoding conversion on the file to be encoded according to each base combination in the target code table in the order of the data in the file to be encoded to obtain a first DNA sequence, and taking the first DNA sequence as the DNA encoding result.
4. The DNA encryption method based on a random combination code table according to claim 2, characterized in that, The step of performing encoding conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result further includes: When there are two target code tables, constructing a matrix according to each base combination in one target code table and each base combination in the other target code table to obtain a matrix; Performing encoding conversion based on the matrix and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result.
5. The DNA encryption method based on a random combination code table according to claim 4, characterized in that, The DNA encoding result includes a second DNA sequence and a third DNA sequence. The step of performing encoding conversion based on the matrix and the file to be encoded to obtain a DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result includes: Storing the data in the file to be encoded into the matrix in the order of the data in the file to be encoded to determine a first base combination and a second base combination, where the first base combination refers to the base combination in the matrix corresponding to the data in the file to be encoded in one target code table, and the second base combination refers to the base combination in the matrix corresponding to the data in the file to be encoded in the other target code table; According to the position order of the data in the file to be encoded in the matrix, each of the first base combinations is used as the second DNA sequence, and the second base combination is used as the third DNA sequence; Based on the second DNA sequence and the third DNA sequence, a random sequence is generated.
6. The DNA encryption method based on a random combination code table according to claim 5, characterized in that, The random sequence includes a first random sequence and a second random sequence. The step of generating a random sequence based on the second DNA sequence and the third DNA sequence includes: By using the Sine chaotic mapping function, a first random sequence is generated, where the length of the first random sequence is the same as that of the second DNA sequence; By using the Sine chaotic mapping function, a second random sequence is generated, where the length of the second random sequence is the same as that of the third DNA sequence.
7. The DNA encryption method based on a random combination code table according to claim 6, characterized in that, The step of adjusting the base order in the DNA encoding result according to the random sequence to obtain a DNA encrypted sequence includes: According to a preset sorting rule, the first random sequence is sorted, and indexing is performed according to the sorted first random sequence to adjust the order of each of the first base combinations in the second DNA sequence; According to a preset sorting rule, the second random sequence is sorted, and indexing is performed according to the sorted second random sequence to adjust the order of each of the second base combinations in the third DNA sequence; The adjusted second DNA sequence and the adjusted third DNA sequence are used as the DNA encrypted sequence.
8. A DNA encryption device based on a random combination code table, characterized in that, The DNA encryption device based on a random combination code table includes: An acquisition module, configured to acquire each code table and the file to be encoded, where the code table is composed of bases screened according to a preset screening condition; A selection module, configured to generate a random number according to the file type of the file to be encoded, and perform code table selection in each of the code tables based on the random number, and use the selected code table as the target code table; An encoding conversion module, configured to perform encoding conversion according to the target code table and the file to be encoded to obtain a DNA encoding result, and generate a random sequence based on the length corresponding to the DNA encoding result; An adjustment module, configured to adjust the base order in the DNA encoding result according to the random sequence to obtain a DNA encrypted sequence.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the computer program, the steps of the DNA encryption method based on a random combination code table according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, wherein, When the computer program is executed by a processor, the steps of the DNA encryption method based on a random combination code table according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
DNA information storage and coding method meeting biological constraints
CN111243670A
Encoding method and device, decoding method and device, terminal equipment and readable storage medium
CN113539370A
Audio coding and decoding method and device, equipment and storage medium
CN115376532A
Nucleic acid-based data storage
US20180137418A1