DNA encryption method and device based on random combination code table, equipment and storage medium
By using a DNA encryption method based on a random combination code table, which encrypts files using a code table composed of selected bases, the problem of poor DNA encryption effect is solved, achieving high security and high efficiency encryption.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN INST OF ADVANCED TECH CHINESE ACAD OF SCI
- Filing Date
- 2023-12-14
- Publication Date
- 2026-04-14
AI Technical Summary
Existing DNA encryption technology is ineffective and fails to meet the security and efficiency requirements of information storage.
A DNA encryption method based on a random combination code table is adopted. By obtaining a code table composed of selected bases, random numbers are generated according to the file type to select the code table, and encoding conversion and base order adjustment are performed to generate a DNA encryption sequence.
It improves the security and efficiency of DNA encryption, achieving highly efficient file encryption.
Smart Images

Figure CN120165830B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of DNA encryption technology, and in particular to a DNA encryption method, apparatus, device, and storage medium based on a random combination code table. Background Technology
[0002] With the continuous development of information technology, human life has undergone a dramatic transformation. The distance between people is no longer limited by physical distance, and communication has become more frequent, generating massive amounts of data. This explosion of data has placed increasingly higher demands on information storage media, rendering traditional media such as hard disks and optical discs unable to keep up with the speed of information growth.
[0003] Therefore, DNA information storage technology has gradually come into people's view. DNA, as a storage medium, has advantages such as high density, ease of preservation, and long storage period; 1g of DNA can store the information of the entire world. Although DNA information storage has many advantages, the encryption effect is currently poor due to limited research. Summary of the Invention
[0004] Therefore, it is necessary to address the technical problem of poor DNA encryption performance in existing technologies by proposing a DNA encryption method, device, equipment, and storage medium based on a random combination code table.
[0005] Firstly, a DNA encryption method based on a random combination code table is provided, the method comprising:
[0006] Obtain each code table and the file to be encoded, wherein the code table is composed of bases selected according to preset screening conditions;
[0007] A random number is generated based on the file type of the file to be encoded, and a code table is selected from each of the code tables based on the random number, and the selected code table is used as the target code table.
[0008] The target code table and the file to be encoded are used to perform encoding conversion to obtain DNA encoding results, and a random sequence is generated based on the length corresponding to the DNA encoding results.
[0009] The base sequence in the DNA encoding result is adjusted according to the random sequence to obtain the encrypted DNA sequence.
[0010] Secondly, a DNA encryption device based on a random combination code table is provided, the device comprising:
[0011] The acquisition module is used to acquire various code tables and the file to be encoded, wherein the code table is composed of bases selected according to preset screening conditions;
[0012] The selection module is used to generate random numbers according to the file type of the file to be encoded, and to select a code table from each of the code tables based on the random numbers, and to use the selected code table as the target code table.
[0013] The encoding conversion module is used to perform encoding conversion according to the target code table and the file to be encoded to obtain DNA encoding results, and generate random sequences based on the length corresponding to the DNA encoding results;
[0014] An 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.
[0015] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the DNA encryption method based on a random combination code table described above.
[0016] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the DNA encryption method based on a random combination code table described above.
[0017] This invention proposes a DNA encryption method based on a random combination code table. The method involves acquiring various code tables and a file to be encoded. The code tables are composed of bases selected according to preset screening conditions. Random numbers are generated based on the file type of the file to be encoded, and code tables are selected from among the code tables based on these random numbers. The selected code table is used as the target code table. Encoding conversion is then performed based on the target code table and the file to be encoded to obtain a DNA encoding result. 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 the encrypted DNA sequence. This method enables DNA encryption of the file to be encoded using code tables composed of selected bases, thereby improving both the security and efficiency of encryption. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] in:
[0020] Figure 1 This is an application environment diagram of a DNA encryption method based on a random combination code table in one embodiment;
[0021] Figure 2 This is a flowchart of a DNA encryption method based on a random combination code table in one embodiment;
[0022] Figure 3 This is a schematic diagram of the encoding conversion of a DNA encryption method based on a random combination code table in one embodiment;
[0023] Figure 4 This is a schematic diagram of another encoding conversion in a DNA encryption method based on a random combination code table in one embodiment;
[0024] Figure 5 Image Lena is an example of a DNA encryption method based on a random combination code table in one embodiment.
[0025] Figure 6 Peppers is an image of a DNA encryption method based on a random combination code table in one embodiment;
[0026] Figure 7 This is an encrypted image of Lena, based on a DNA encryption method using a random combination code table, as described in one embodiment.
[0027] Figure 8 This is an encrypted image of Peppers, an image based on a DNA encryption method using a random combination code table, as described in one embodiment.
[0028] Figure 9 This is a structural block diagram of a DNA encryption device based on a random combination code table in one embodiment;
[0029] Figure 10 This is a structural block diagram of a computer device in one embodiment;
[0030] Figure 11 This is a structural block diagram of a computer device in another embodiment. Detailed Implementation
[0031] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0032] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0033] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0034] The DNA encryption method based on a random combination code table provided in this invention can be applied to applications such as... Figure 1 In this application environment, client 110 communicates with server 120 via a network. Server 120 can receive the DNA encryption method based on random combination code tables proposed in this embodiment from client 110. It obtains various code tables and the file to be encoded, where each code table is composed of bases selected according to preset screening conditions. Server 120 then generates a random number based on the file type of the file to be encoded and selects a code table from each of the code tables based on the random number. The selected code table is used as the target code table. Next, server 120 performs encoding conversion based on the target code table and the file to be encoded to obtain a DNA encoding result. It then generates a random sequence based on the length corresponding to the DNA encoding result. Finally, server 120 adjusts the base order in the DNA encoding result according to the random sequence to obtain a DNA encryption sequence. This method enables the encoding conversion of the file to be encoded using code tables composed of selected bases, thereby obtaining a DNA encryption sequence and achieving DNA encryption of the file to be encoded, improving both the security and efficiency of encryption. Client 110 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server 120 can be implemented using a standalone server or a server cluster consisting of multiple servers. The invention will now be described in detail through specific embodiments.
[0035] Please see Figure 2 As shown, Figure 2 A flowchart illustrating a DNA encryption method based on a random combination code table according to an embodiment of the present invention includes the following steps:
[0036] Step S101: Obtain each code table and the file to be encoded, wherein the code table is composed of bases selected according to preset screening conditions;
[0037] The code tables can be designed based on the GC content and the preset screening conditions of oligonucleotides (GC content of about 50% and oligonucleotide length of less than or equal to 3).
[0038] As an example, seven code tables were designed: code table a, code table b, code table c, code table d, code table e, code table f, and code table g.
[0039] As an example: Code table a: with a length of 2 can be represented as 2 1 The 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.
[0040] As an example: code table b with a length of 4 can be represented as 2. 2 Code table b includes four base combinations from r1 to r4, for example, r1 = A, r2 = T, r3 = C, r4 = G;
[0041] As an example: a code table c with a length of 8 can be represented as 2. 3 The 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.
[0042] As an example: a code table d with a length of 16 can be represented as 2. 4 The code table d includes 16 base combinations from r1 to r16, as shown in the table below:
[0043] AA TA CA GA AT TT CT GT AC TC CC GC AG TG CG GG
[0044] As an example: code table e with a length of 32 can be represented as 2. 5 The code table e includes 32 base combinations from r1 to r32, as shown in the table below:
[0045] ACA ACT ACC ACG AGA AGT AGC AGG TCA TCT TCC TCG TGA TGT TGC TGG CAA CAT CAC CAG CTA CTT CTC CTG GAA GAT GAC GAG GTA GTT GTC GTG
[0046] As an example: a code table f with a length of 64 can be represented as 2. 6 The code table e includes 64 base combinations from r1 to r64, as shown in the table below:
[0047] ACTC ACTG AGAC AGAG TCAG TCAC TGTC TGTG CACA CACT CTCA CTCT GACA GACT GTCA GTCT ACAC ACAG AGTC AGTG TCTC TCTG TGAG TGAC CAGA CAGT CTGA CTGT GAGA GAGT GTGA GTGT ACCA ACCT TCCA TCCT AGCT ACGT AGCA ACGA CAAG CAAC GAAC GAAG TCGA TGCA TGCT TCGT CTTC CTTG GTTC GTTG CATG CTAG GATG GTAG AGGA AGGT TGGA TGGT GATC GTAC CATC CTAC
[0048] As an example: a code table g with a length of 128 can be represented as 2.7 The code table g includes 128 base combinations from r1 to r128, as shown in the table below:
[0049]
[0050]
[0051] Step S102: Generate a random number according to the file type of the file to be encoded, and select a code table from each of the code tables based on the random number, and use the selected code table as the target code table;
[0052] The file type can be text, image, or other types.
[0053] In this embodiment, a random number corresponding to the file type of the file to be encoded is generated according to the different file types. Then, a code table is selected from various code tables based on this random number, and the selected code table is used as the target code table. For example, if the random number is 7, then the seventh code table is selected from the various code tables and used as the target code table.
[0054] In one embodiment, the step of selecting a code table from each of 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:
[0055] Step S1021: Based on the number of code tables, generate a random number as the first random number;
[0056] Here, the quantity refers to the total number of code tables, and the maximum value of the first random number can be equal to the value of this total number. For example, if the quantity is 7, then the first random number can be any number from 0 to 7.
[0057] Step S1022: Based on the first random number and the file type of the file to be encoded, generate a random number as the second random number;
[0058] For example, when a random number between 0 and 7 is randomly generated as the first random number n1, if the file type of the file to be encoded is text, then the second random number n2 = 7 - n1; if the file type of the file to be encoded is an image, then the second random number n2 satisfies n1 + n2 = 8; if the file type of the file to be encoded is other types, then 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.
[0059] Step S1023: Select the code table corresponding to the first random number from each of the code tables as the target code table, and select the code table corresponding to the second random number from each of the code tables as the target code table.
[0060] 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 the code tables. The first code table is used as the target code table, and the sixth code table is used as the target code table.
[0061] Step S103: Perform encoding conversion according to the target code table and the file to be encoded to obtain DNA encoding results, and generate random sequences based on the length corresponding to the DNA encoding results;
[0062] For example, if the data in the file to be encoded is character data, then each character data corresponds to a base combination in the target code table, and the same character data corresponds to only one base combination. Finally, after converting all the data in the file to be encoded into each base combination, the DNA encoding result is obtained.
[0063] 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.
[0064] Step S104: Adjust the base sequence in the DNA encoding result according to the random sequence to obtain the DNA encryption sequence.
[0065] By using random numbers from the random sequence, the base order in the DNA encoding result is adjusted, 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, then the tenth base combination in the DNA encoding result is moved to the first position in ascending order.
[0066] This embodiment proposes a DNA encryption method based on a random combination code table. The method involves acquiring various code tables and a file to be encoded. The code tables are composed of bases selected according to preset screening conditions. Random numbers are generated based on the file type of the file to be encoded, and code tables are selected from among the code tables based on these random numbers. The selected code table is used as the target code table. Encoding conversion is then performed based on the target code table and the file to be encoded to obtain a DNA encoding result. 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 the encrypted DNA sequence. This method enables DNA encryption of the file to be encoded using code tables composed of selected bases, thereby improving both the security and efficiency of encryption.
[0067] In one embodiment, the step of performing encoding conversion based on 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:
[0068] Step 201: When only one target code table exists, according to the base combinations in the target code table, the file to be encoded is encoded and converted according to 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.
[0069] When only one target code table exists, it means that only one code table is selected as the target code table. Using the target code table, the file to be encoded is encoded according to the order of the data in the file to be encoded, resulting in the first DNA sequence. It should be noted that for text files, characters are directly read and mapped to the code table for encoding; for image files, the pixel values of each pixel are read and directly encoded using the code table mapping method; for other file types, the byte data is encoded by reading binary information.
[0070] As an example, such as Figure 3 As shown, the data in the file to be encoded is the string a, b, c, a, 1, 2. 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.
[0071] In one embodiment, the step of performing encoding conversion based on 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:
[0072] Step S301: When there are two target code tables, construct a matrix based on the base combinations in one target code table and the base combinations in the other target code table to obtain a matrix;
[0073] Step S302: Based on the matrix and the file to be encoded, perform encoding conversion to obtain DNA encoding results, and generate a random sequence based on the length corresponding to the DNA encoding results.
[0074] When two target code tables exist, it means that two code tables have been selected as target code tables. A matrix is constructed based on the base combinations in one target code table and the base combinations in the other target code table to obtain a matrix.
[0075] As an example, such as Figure 4 As shown, code table t1 is a target code table, and code table t2 is another target code table. A matrix is constructed from the two target code tables. Code table t1 includes the base combinations TTA, CCA, ATC, GAC, ACC, and ATT, while code table t2 includes the base combinations ATC, TAC, TGA, CAG, TAT, and CAA.
[0076] In one embodiment, 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 the DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result, includes:
[0077] Step S401: According to the order of the data in the file to be encoded, store the data in the file to be encoded into the matrix to determine the first base combination and the second base combination, wherein the first base combination refers to the 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 the base combination of the data in the file to be encoded in the matrix corresponding to another of the target code tables;
[0078] For example, such as Figure 4 As shown, 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.
[0079] Step S402: Based on the position order of the data in the matrix in the file to be encoded, each of the first base combinations is used as the second DNA sequence, and each of the second base combinations is used as the third DNA sequence;
[0080] Specifically, according to the position order of the data in the matrix in the file to be encoded, the first base combination corresponding to each of the data in the file to be encoded is used as the second DNA sequence, and the second base combination corresponding to each of the data in the file to be encoded is used as the third DNA sequence.
[0081] Step S403: Generate a random sequence based on the second DNA sequence and the third DNA sequence.
[0082] For example, a random sequence can be 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.
[0083] In one embodiment, the random sequence includes a first random sequence and a second random sequence, and the step of generating a random sequence based on the second DNA sequence and the third DNA sequence includes:
[0084] Step S501: Generate a first random sequence using the Sine chaotic mapping function, wherein the length of the first random sequence is the same as that of the second DNA sequence;
[0085] Step S502: Generate a second random sequence using the Sine chaotic mapping function, wherein the length of the second random sequence is the same as that of the third DNA sequence.
[0086] As an example, the first random sequence S1 is generated using the Sine chaotic mapping function, and the initial values s1 and a are saved. The Sine chaotic mapping function is shown in the following equation:
[0087] S1={s1,s2,…,s n}
[0088]
[0089] n = length (second DNA sequence)
[0090] It should be noted that the second random sequence S2 is generated in the same way as the first random sequence, and will not be described again here.
[0091] In one embodiment, the step of adjusting the base sequence in the DNA encoding result according to the random sequence to obtain the DNA encrypted sequence includes:
[0092] Step S601: Sort the first random sequence according to the preset sorting rules, and index the sorted first random sequence to adjust the order of each first base combination in the second DNA sequence.
[0093] As an example, the first random sequence is sorted in descending order. The sorted first random sequence is then used as an index to adjust the order of each of the first base combinations in the second DNA sequence. For instance, if the sorted first random sequence is {1, 2, 3, 4}, then in the second DNA sequence, the 4th first base combination is moved to the first position, the 1st first base combination is moved to the last position, and the 2nd and 3rd first base combinations are swapped.
[0094] Step S602: Sort the second random sequence according to the preset sorting rules, and index the sorted second random sequence to adjust the order of each second base combination in the third DNA sequence;
[0095] As an example, the second random sequence is sorted in descending order. The sorted second random sequence is then used as an index to adjust the order of the second base combinations in the third DNA sequence. For instance, if the sorted second random sequence is {1, 2, 3, 4}, then in the third DNA sequence, the fourth second base combination is moved to the first position, the first second base combination is moved to the last position, and the second and third second base combinations are swapped.
[0096] Step S603: Use the adjusted second DNA sequence and the adjusted third DNA sequence as the DNA encryption sequence.
[0097] As an example, the decryption process is the reverse of the encryption process. By generating a first random sequence and a second random sequence using the recorded initial value of the Sine function and parameter a, and selecting a cipher table using the recorded random numbers n1 and n2, the DNA encryption sequence can be converted into a file to be encrypted.
[0098] As yet another example, such as Figure 5 , Figure 6 As shown, these are two classic computer vision images, Lena and Peppers. Using these two images as the file to be encrypted, the DNA encryption method based on a random combination code table of this invention is applied for file encryption. The encrypted image of Lena is shown below. Figure 7 As shown, the encrypted image from Peppers is as follows: Figure 8 As shown, the encrypted image has a uniform pixel distribution with good randomness, indicating good encryption performance. The encrypted DNA sequence does not contain excessively long oligonucleotides, and the GC content is between 45% and 60%, with an overall average GC content of about 50%, demonstrating good biochemical properties.
[0099] Please see Figure 9 As shown, in one embodiment, a DNA encryption device based on a random combination code table is provided, the device comprising:
[0100] The acquisition module 10 is used to acquire various code tables and the file to be encoded, wherein the code table is composed of bases selected according to preset screening conditions;
[0101] The selection module 20 is used to generate random numbers according to the file type of the file to be encoded, and to select a code table from each of the code tables based on the random numbers, and to use the selected code table as the target code table.
[0102] 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 DNA encoding results, and generate random sequences based on the length corresponding to the DNA encoding results;
[0103] The adjustment module 40 is used to adjust the base sequence in the DNA encoding result according to the random sequence to obtain the DNA encryption sequence.
[0104] In one embodiment, the selection module 20 is configured to: generate a random number based on the number of code tables, as a first random number;
[0105] Based on the first random number and the file type of the file to be encoded, a second random number is generated.
[0106] Select the code table corresponding to the first random number from each of the code tables as the target code table, and select the code table corresponding to the second random number from each of the code tables as the target code table.
[0107] In one embodiment, the encoding conversion module 30 is configured to: when only one target code table exists, according to the base combinations in the target code table and in the order of the data in the file to be encoded, encode the file to be encoded to obtain a first DNA sequence, and use the first DNA sequence as the DNA encoding result.
[0108] In one embodiment, the encoding conversion module 30 is used to: when there are two target code tables, construct a matrix based on the base combinations in one target code table and the base combinations in the other target code table to obtain a matrix;
[0109] Based on the matrix and the file to be encoded, an encoding conversion is performed to obtain the DNA encoding result, and a random sequence is generated based on the length corresponding to the DNA encoding result.
[0110] In one embodiment, the encoding conversion module 30 is configured to: store the data in the file to be encoded into 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 in the matrix that corresponds to one of the target code tables for the data in the file to be encoded, and the second base combination refers to a base combination in the matrix that corresponds to another of the target code tables for the data in the file to be encoded;
[0111] Based on the position order of the data in the matrix in the file to be encoded, each of the first base combinations is used as the second DNA sequence, and each of the second base combinations is used as the third DNA sequence;
[0112] A random sequence is generated based on the second DNA sequence and the third DNA sequence.
[0113] In one embodiment, the encoding conversion module 30 is configured to: generate a first random sequence using a Sine chaotic mapping function, wherein the length of the first random sequence is the same as that of the second DNA sequence;
[0114] A second random sequence is generated using the Sine chaotic mapping function, wherein the length of the second random sequence is the same as that of the third DNA sequence.
[0115] In one embodiment, the adjustment module 40 is used 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;
[0116] According to a preset sorting rule, the second random sequence is sorted, and the sorted second random sequence is indexed to adjust the order of each second base combination in the third DNA sequence.
[0117] The adjusted second DNA sequence and the adjusted third DNA sequence are used as the DNA encryption sequence.
[0118] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When executed by the processor, the computer program implements the functions or steps of a server-side DNA encryption method based on a random combination code table.
[0119] In one embodiment, a computer device is provided, which may be a client, and its internal structure diagram may be as follows: Figure 11 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with an external server via a network connection. When executed by the processor, the computer program implements client-side functions or steps of a DNA encryption method based on a random combination code table.
[0120] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, performs the following steps:
[0121] Obtain each code table and the file to be encoded, wherein the code table is composed of bases selected according to preset screening conditions;
[0122] A random number is generated based on the file type of the file to be encoded, and a code table is selected from each of the code tables based on the random number, and the selected code table is used as the target code table.
[0123] The target code table and the file to be encoded are used to perform encoding conversion to obtain DNA encoding results, and a random sequence is generated based on the length corresponding to the DNA encoding results.
[0124] The base sequence in the DNA encoding result is adjusted according to the random sequence to obtain the encrypted DNA sequence.
[0125] This embodiment proposes a DNA encryption method based on a random combination code table. The method involves acquiring various code tables and a file to be encoded. The code tables are composed of bases selected according to preset screening conditions. Random numbers are generated based on the file type of the file to be encoded, and code tables are selected from among the code tables based on these random numbers. The selected code table is used as the target code table. Encoding conversion is then performed based on the target code table and the file to be encoded to obtain a DNA encoding result. 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 the encrypted DNA sequence. This method enables DNA encryption of the file to be encoded using code tables composed of selected bases, thereby improving both the security and efficiency of encryption.
[0126] In one embodiment, a computer-readable storage medium is provided that stores a computer program, which, when executed by a processor, performs the following steps:
[0127] Obtain each code table and the file to be encoded, wherein the code table is composed of bases selected according to preset screening conditions;
[0128] A random number is generated based on the file type of the file to be encoded, and a code table is selected from each of the code tables based on the random number, and the selected code table is used as the target code table.
[0129] The target code table and the file to be encoded are used to perform encoding conversion to obtain DNA encoding results, and a random sequence is generated based on the length corresponding to the DNA encoding results.
[0130] The base sequence in the DNA encoding result is adjusted according to the random sequence to obtain the encrypted DNA sequence.
[0131] This embodiment proposes a DNA encryption method based on a random combination code table. The method involves acquiring various code tables and a file to be encoded. The code tables are composed of bases selected according to preset screening conditions. Random numbers are generated based on the file type of the file to be encoded, and code tables are selected from among the code tables based on these random numbers. The selected code table is used as the target code table. Encoding conversion is then performed based on the target code table and the file to be encoded to obtain a DNA encoding result. 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 the encrypted DNA sequence. This method enables DNA encryption of the file to be encoded using code tables composed of selected bases, thereby improving both the security and efficiency of encryption.
[0132] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0133] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, 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), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0134] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to 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.
[0135] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope 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: Obtain each code table and the file to be encoded, wherein the code table is composed of bases selected according to preset screening conditions; A random number is generated based on the file type of the file to be encoded, and a code table is selected from each of the code tables based on the random number, and the selected code table is used as the target code table. The target code table and the file to be encoded are used to perform encoding conversion to obtain DNA encoding results, and a random sequence is generated based on the length corresponding to the DNA encoding results. The base sequence in the DNA encoding result is adjusted according to the random sequence to obtain the encrypted DNA sequence. The step of generating a random number based on the file type of the file to be encoded, selecting a code table from each of the code tables based on the random number, and using the selected code table as the target code table includes: Based on the number of code tables, a random number is generated as the first random number; Based on the first random number and the file type of the file to be encoded, a second random number is generated. Select the code table corresponding to the first random number from each of the code tables as the target code table, and select the code table corresponding to the second random number from each of the code tables as the target code table.
2. The DNA encryption method based on a random combination code table according to claim 1, characterized in that, The step of performing encoding conversion based on the target code table and the file to be encoded to obtain DNA encoding results, and generating random sequences based on the length corresponding to the DNA encoding results, includes: When only one target code table exists, the file to be encoded is encoded 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.
3. The DNA encryption method based on a random combination code table according to claim 1, characterized in that, The step of performing encoding conversion based on the target code table and the file to be encoded to obtain DNA encoding results, and generating random sequences based on the length corresponding to the DNA encoding results, further includes: When there are two target code tables, a matrix is constructed based on the base combinations in one target code table and the base combinations in the other target code table to obtain a matrix; Based on the matrix and the file to be encoded, an encoding conversion is performed to obtain the DNA encoding result, and a random sequence is generated based on the length corresponding to the DNA encoding result.
4. The DNA encryption method based on a random combination code table according to claim 3, 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 the DNA encoding result, and generating a random sequence based on the length corresponding to the DNA encoding result, includes: According to the order of the data in the file to be encoded, the data in the file to be encoded is stored in the matrix to determine the first base combination and the second base combination. The first base combination refers to the base combination of the data in the file to be encoded in the matrix that corresponds to one of the base combinations of the target code table, and the second base combination refers to the base combination of the data in the file to be encoded in the matrix that corresponds to another of the base combinations of the target code table. Based on the positional order of the data in the matrix in the file to be encoded, 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; A random sequence is generated based on the second DNA sequence and the third DNA sequence.
5. The DNA encryption method based on a random combination code table according to claim 4, 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: A first random sequence is generated using the Sine chaotic mapping function, wherein the length of the first random sequence is the same as that of the second DNA sequence; A second random sequence is generated using the Sine chaotic mapping function, wherein the length of the second random sequence is the same as that of the third DNA sequence.
6. The DNA encryption method based on a random combination code table according to claim 5, characterized in that, The step of adjusting the base sequence in the DNA encoding result according to the random sequence to obtain the encrypted DNA sequence includes: According to a preset sorting rule, the first random sequence is sorted, and the sorted first random sequence is indexed 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 the sorted second random sequence is indexed to adjust the order of each second base combination in the third DNA sequence. The adjusted second DNA sequence and the adjusted third DNA sequence are used as the DNA encryption sequence.
7. A DNA encryption device based on a random combination code table, characterized in that, For performing the DNA encryption method based on a random combination code table according to any one of claims 1 to 6, the DNA encryption device based on the random combination code table comprises: The acquisition module is used to acquire various code tables and the file to be encoded, wherein the code table is composed of bases selected according to preset screening conditions; The selection module is used to generate random numbers according to the file type of the file to be encoded, and to select a code table from each of the code tables based on the random numbers, and to use the selected code table as the target code table. The encoding conversion module is used to perform encoding conversion according to the target code table and the file to be encoded to obtain DNA encoding results, and generate random sequences based on the length corresponding to the DNA encoding results; An 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.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the DNA encryption method based on a random combination code table as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the DNA encryption method based on a random combination code table as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Image encryption method and system based on DNA triploid variation
CN115103080A
Information coding method and apparatus based on DNA storage, and computer device and medium
WO2023201782A1