Security encryption method of mobile storage device, electronic device and storage medium

By establishing a chaotic mapping system and generating chaotic sequences, large files in mobile devices are encrypted, which solves the security and efficiency of mobile device data encryption technology in mobile computing environments, and achieves a fast and secure encryption process.

CN119622762AInactive Publication Date: 2025-03-14SHENZHEN LIDA ELECTRONICS CO LTD

Patent Information

Application Number
CN202411670883.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing mobile device data encryption technology is difficult to ensure encryption security in mobile computing environments, and at the same time, the encryption efficiency of large files is low, resulting in slow encryption speed and high energy consumption.

Method used

By establishing a chaotic mapping system, including a first chaotic mapping and a second chaotic mapping, a chaotic sequence is generated for encrypting the file header and file contents. The specific steps include splitting and encrypting the file header, segmenting the file contents and encrypting it based on chaotic sequences.

Benefits of technology

With limited computing power, it is possible to quickly encrypt large files while ensuring encryption security, which improves encryption efficiency and reduces energy consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119622762A_ABST
    Figure CN119622762A_ABST
Patent Text Reader

Abstract

The invention discloses a security encryption method of a mobile storage device, an electronic device and a storage medium, and relates to the technical field of mobile device data encryption, comprising the following steps: establishing a chaotic mapping system including a first chaotic mapping and a second chaotic mapping; establishing a chaotic sequence generation method based on the first chaotic mapping and the second chaotic mapping; splitting a file header of the to-be-encrypted file, and encrypting the file header based on a chaotic sequence generation method; segmenting the file content of the to-be-encrypted file, and encrypting the file content based on a chaotic sequence generation method; the method is used for solving the problem that the existing mobile equipment data encryption technology cannot ensure the encryption security in a mobile computing environment and cannot quickly encrypt a large file in the form of operating a character field at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data encryption for mobile equipment, and in particular to a secure encryption method for a mobile storage device, an electronic device and a storage medium. Background Art

[0002] Mobile device data encryption technology refers to the encryption of data in mobile devices to protect the confidentiality, integrity and security of the data; this technology is widely used in mobile applications to protect users' privacy information and important data and prevent data leakage, illegal access and tampering.

[0003] Traditional security encryption algorithms mainly include symmetric encryption and asymmetric encryption. However, in mobile storage devices and mobile computing environments, due to hardware resource limitations such as limited processing power, storage space, and battery life, traditional security encryption algorithms are often difficult to apply directly. Although these algorithms provide strong security protection, their complex mathematical operations and high computing requirements are a considerable challenge for resource-constrained mobile devices. For example, the commonly used public key encryption algorithms RSA and elliptic curve encryption, while providing high security, require more computing resources and time for key generation and encryption and decryption processes, which may result in significant performance degradation and increased energy consumption on mobile devices that require frequent encryption operations. In addition, existing mobile device data encryption methods are less efficient when facing large files, and the problem of long encryption time is particularly prominent. This is because many encryption technologies are designed to process small numbers. According to the data, when applied to large files, the file needs to be divided into multiple small blocks and encryption operations are performed byte by byte, which is too inefficient and time-consuming, resulting in a very low encryption rate; for example, a patent application with publication number CN111310222A discloses a file encryption method, which is to divide the file into multiple small data blocks for encryption. Although it is divided into multiple small data blocks, it is still necessary to encrypt the small data blocks byte by byte. Although strong security is guaranteed, the encryption rate is not high and the encryption efficiency is too low. The performance of file encryption is mainly security and encryption speed, and both should be taken into consideration; from a practical point of view, under certain encryption algorithms and security conditions, it is particularly important to improve the encryption speed of large files; therefore, the existing mobile device data encryption technology cannot ensure encryption security in a mobile computing environment while quickly encrypting large files by operating character segments. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems in the prior art to a certain extent, by establishing a chaotic mapping system; establishing a chaotic sequence generation method; splitting the file header of the encrypted file and encrypting the file header; segmenting the file content of the encrypted file and encrypting the file content; so as to solve the problem that the existing mobile device data encryption technology cannot ensure encryption security in a mobile computing environment while quickly encrypting large files by operating character segments.

[0005] To achieve the above objectives, in a first aspect, the present application provides a secure encryption method for a mobile storage device, comprising the following steps:

[0006] Establishing a chaotic mapping system, the chaotic mapping system includes: a first chaotic mapping and a second chaotic mapping;

[0007] Establishing a chaotic sequence generation method based on the first chaotic map and the second chaotic map;

[0008] The file header of the file to be encrypted is split and the file header is encrypted based on the chaotic sequence generation method;

[0009] The file content of the file to be encrypted is segmented and encrypted based on a chaotic sequence generation method.

[0010] Furthermore, establishing a chaotic mapping system includes the following sub-steps:

[0011] Establish the first chaotic map: The first chaotic map formula is as follows: Where X n+1 represents the n+1th value; X n represents the nth value; X n-1 represents the n-1th value; α represents the control parameter, and its value range is any non-zero real number; μ represents the control parameter, and its value range is any non-zero real number; The brackets represent floor functions;

[0012] Establish the second chaotic map: The second chaotic map formula is as follows: X n+1 =λsin(βπX n +πX n-1 ), where λ represents the control parameter, and its value range is any non-zero real number; β represents the control parameter, and its value range is any non-zero real number.

[0013] Furthermore, establishing a chaotic sequence generation method based on the first chaotic map and the second chaotic map includes the following sub-steps:

[0014] Set the length N of the required random value sequence, and then randomly generate an initial value X0 as the initial mapping value; substitute the initial mapping value X0 into the first chaotic mapping formula, repeat the iteration, and obtain a random value sequence of length n, marked as the first random sequence; then substitute the initial mapping value X0 into the second chaotic mapping formula, repeat the iteration, and obtain a random value sequence of length n, marked as the second random sequence;

[0015] The values ​​in the first random sequence and the second random sequence are converted into positive integers. After the conversion is completed, all the positive integer values ​​in the first random sequence and the second random sequence are converted into binary values. After the conversion is completed, the first chaotic sequence and the second chaotic sequence are obtained;

[0016] The corresponding digits of the first chaotic sequence and the values ​​of the corresponding positions of the second chaotic sequence are subjected to an XOR operation, and after completion, a third chaotic sequence is obtained.

[0017] Furthermore, splitting the file header of the encrypted file includes the following sub-steps:

[0018] Read the file header sequence of the file to be encrypted, and set the length of the first file header sequence to L1; select the first L1 bits of the read file header sequence of the file to be encrypted, and mark the first file header sequence;

[0019] Convert all the values ​​in the first file header sequence into binary values, mark them as the second file header sequence, perform an AND operation on all the values ​​in the second file header sequence and the binary value 1111111 respectively, and then perform an AND operation on the corresponding digits of the obtained values ​​and 1011111, and finally obtain a third file header sequence;

[0020] Perform an AND operation on the corresponding digits of all the values ​​in the second file header sequence and the binary value 10000000, and convert the obtained binary values ​​into decimal values ​​after completion, and obtain a fourth file header sequence; divide all the values ​​in the fourth file header sequence by the decimal number 4, and convert the obtained decimal values ​​into binary values ​​after completion, and obtain a fifth file header sequence;

[0021] The values ​​at corresponding positions of the third file header sequence and the fifth file header sequence are added to obtain a sixth file header sequence; the third file header sequence and the sixth file header sequence are combined and stored, and marked as the original file header sequence.

[0022] Furthermore, encrypting the file header based on the chaotic sequence generation method includes the following sub-steps:

[0023] A third chaotic sequence with a length of N1 is generated by using a chaotic sequence generation method, and all values ​​in the third chaotic sequence with a length of N1 are converted into decimal values ​​and marked as a file header chaotic sequence;

[0024] Divide the values ​​in the file header chaotic sequence by C1 in turn to obtain the remainder, record the remainder values ​​and the positions of the values ​​in the file header chaotic sequence, and compare the values ​​obtained by each remainder with the data obtained by the remainder. If a repeated value appears, ignore the value and position obtained by this remainder, and obtain the remainder for the next digit until 2*L1 digits of different sizes are obtained, marked as array T1, and the positions of the 2*L1 digits of different sizes in the file header chaotic sequence are marked as array T2; the values ​​of the corresponding positions of array T1 and array T2 correspond to each other;

[0025] Sort the 2*L1 numbers of different sizes in array T1 in ascending order, and mark it as array t1; and adjust the positions of the values ​​in array T2 according to the corresponding relationship with the values ​​in array T1, and mark it as array t2.

[0026] Furthermore, encrypting the file header based on the chaotic sequence generation method also includes the following sub-steps:

[0027] Match array t1 with the original file header sequence; rearrange array t2 into array T2 according to the numerical value, rearrange array t1 into T1 according to the correspondence between array t1 and array t2, and rearrange the original file header sequence according to the correspondence between t1 and the original file header sequence, marking it as array A1;

[0028] According to the last value in array T2, the values ​​in the chaotic sequence of the file header are divided by C1 in turn to obtain the remainder, and then 2*L1 digit numbers of different sizes are obtained, and they are converted into binary values ​​in turn, which are marked as array T3;

[0029] Perform XOR operation on the corresponding digits of the values ​​at the corresponding positions of array A1 and array T3, and convert them into hexadecimal values. After completion, the encrypted file header sequence is obtained, marked as the file header encryption sequence, and the file header encryption sequence is used to replace the file header sequence of the file to be encrypted.

[0030] Furthermore, segmenting the file content of the file to be encrypted and encrypting the file content based on the chaotic sequence generation method includes the following sub-steps:

[0031] The file content segment size is set to L2 bits, and the file content of the encrypted file is read, and L2 bits of data are read at a time, which is marked as array B1i, where i represents the file content read for the i-th time; based on the chaotic sequence generation method, a first chaotic sequence with a length of N2 is generated, and all values ​​in the first chaotic sequence are converted into binary values, which are marked as file content chaotic sequence.

[0032] Furthermore, segmenting the file content of the file to be encrypted and encrypting the file content based on the chaotic sequence generation method also includes the following sub-steps:

[0033] Multiply each value in the chaotic sequence of the file content by E1 to obtain array H1. Divide the values ​​of array H1 by E2 according to the position number of the value, and take the remainder for the values ​​with odd position numbers, and divide the values ​​with even position numbers by E3 to obtain the remainder. After completion, array H2 is obtained.

[0034] According to array H2, starting from the values ​​with odd position numbers in the i-th position, two values ​​are selected each time, and the values ​​with odd position numbers among the two selected values ​​are used as the segment starting position, and the values ​​with even position numbers are used as the segment length, and the array B1i is segmented and extracted, and the last value of the segment of the extracted array B1i is XORed with the segment length at the corresponding digits, and then stored in array B2i after completion; according to array H2, the operation is repeated on B1i, and when performing segmented extraction, it is determined whether the segment has been extracted, including partial extraction and full extraction. If it has been extracted, two values ​​are re-selected in order until all the values ​​in array B1i are extracted, and array B2i is obtained;

[0035] Repeat the operation until all arrays B2i corresponding to all file contents of the file to be encrypted are obtained, and they are sorted according to the size of i and marked as file encryption contents.

[0036] In a second aspect, the present application provides an electronic device, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the above method are performed.

[0037] In a third aspect, the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the above method are performed.

[0038] Beneficial effects of the present invention: The present invention establishes a chaotic mapping system, which includes: a first chaotic mapping and a second chaotic mapping; a chaotic sequence generation method is established based on the first chaotic mapping and the second chaotic mapping; a file header of a to-be-encrypted file is split and processed, and the file header is encrypted based on the chaotic sequence generation method; the file content of the to-be-encrypted file is segmented and processed, and the file content is encrypted based on the chaotic sequence generation method; in a mobile storage device and a mobile computing environment, relying on limited computing power, large files can be quickly encrypted by operating character segments while ensuring encryption security;

[0039] The present invention is based on the improvement of Logistic chaotic mapping and Sine chaotic mapping, and establishes a new chaotic mapping system, which has significant improvements in terms of chaotic parameter range, mapping interval and randomness compared with the previous improvements, thereby ensuring the security and reliability of data encryption; the present invention divides a large file into a file header and a file content, and encrypts them separately, and uses different encryption algorithms, which can improve the overall encryption efficiency, and encrypts the file header and the file content separately, which can provide different degrees of protection for different parts, thereby enhancing the encryption security; the file content of the large file is processed in sections, and each section is used as an operation unit, and the file content is no longer encrypted byte by byte, and the encryption of the large file can be completed in a short time, which greatly improves the encryption efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 is a flow chart of the steps of the method of the present invention;

[0041] Figure 2 A schematic diagram of a random sequence XOR operation of the present invention;

[0042] Figure 3 It is a schematic diagram of the splitting process flow of the present invention;

[0043] Figure 4 It is a schematic diagram of the segmented extraction process of the present invention;

[0044] Figure 5 It is a schematic structural diagram of the electronic device of the present invention. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0046] Example 1, please refer to Figure 1As shown, the present application provides a secure encryption method for a mobile storage device, comprising the following steps:

[0047] Step S1, establishing a chaotic mapping system, the chaotic mapping system includes: a first chaotic mapping and a second chaotic mapping; Step S1 includes the following sub-steps:

[0048] Step S101, establish a first chaotic mapping: the first chaotic mapping formula is as follows: Where X n+1 represents the n+1th value; X n represents the nth value; X n-1 represents the n-1th value; α represents the control parameter, and its value range is any non-zero real number; μ represents the control parameter, and its value range is any non-zero real number; The brackets represent the floor function, that is, taking the value not greater than The maximum integer in brackets, for example, The first chaotic mapping is improved based on the Logistic chaotic mapping. The Logistic chaotic mapping has the following defects: small chaotic parameter range, mapping interval is limited to (0, 1) and not full mapping at (0, 1), and mapping amplitude has obvious regularity. The security of data encryption is weak. The improved first chaotic mapping has two mapping parameters, μ and α, and their value range is arbitrary. n and X n-1 There are two initial values, which greatly increases the value space of the chaotic sequence; the mapping range of X is arbitrary, and it is fully mapped within any parameter range, which greatly improves the security of data encryption; compared with the Logistic mapping, the distribution of iterative values ​​has also been greatly improved;

[0049] Step S102, establish a second chaotic mapping: The second chaotic mapping formula is as follows: n+1 =λsin(βπX n +πX n-1 ), where λ represents the control parameter, and its value range is any non-zero real number; β represents the control parameter, and its value range is any non-zero real number; the second chaotic mapping is improved based on the Sine chaotic mapping. The original Sine chaotic mapping is chaotic only in a very small range, and it is not a full mapping. The mapping range has an obvious linear law, and the parameters are easy to be identified when used for encryption; while the improved second chaotic mapping is chaotic in any parameter range, and it is a full mapping, and the parameters used for encryption are difficult to be identified; the improved second chaotic mapping improves the initial value sensitivity, improves the randomness of the sequence, and thus improves the security of data encryption;

[0050] In the specific implementation process, chaos is a seemingly random irregular motion occurring in a deterministic system. Its basic characteristic is its high sensitivity to initial values, which leads to the unpredictability of its long-term evolutionary behavior. Since some chaotic maps have the advantages of simple structure, fast calculation speed, and easy implementation, these chaotic maps are increasingly used in chaotic encryption systems. However, these advantages of these chaotic maps also lead to various defects, such as small parameter and initial value space, low mathematical structure complexity, etc., which are not conducive to the security of encrypted information. Therefore, such chaotic maps should be improved to overcome these defects, thereby improving the overall performance of chaotic maps and improving the security of data encryption.

[0051] Step S2, establishing a chaotic sequence generation method based on the first chaotic mapping and the second chaotic mapping; Step S2 includes the following sub-steps:

[0052] Step S201, setting the length N of the required random value sequence, and then randomly generating an initial value X0 as the mapping initial value; X0 can be a non-zero real number, in this embodiment X0 = 3;

[0053] Step S202, substitute the initial mapping value X0 into the first chaotic mapping formula, repeat the iteration, and obtain a random value sequence of length n, which is marked as the first random sequence;

[0054] Step S203, substitute the initial mapping value X0 into the second chaotic mapping formula, repeat the iteration, and obtain a random value sequence of length n, which is marked as the second random sequence;

[0055] Because the first chaotic projection formula and the second chaotic projection formula have X n and X n-1 There are two initial values, all generated in the first iteration can be X n-1 Set to 0, or randomly pick a number, for example, randomly generate an initial value X0 = 3, let X 0-1 =0, substitute the first chaotic projection formula and the second chaotic projection formula to generate X1, then use X0 and X1 to generate X2, and repeat the iteration to generate the first random sequence and the second random sequence of the required length N

[0056] Step S204, converting the values ​​in the first random sequence and the second random sequence into positive integers, all the values ​​in the first random sequence and the second random sequence can be multiplied by a positive integer value of a fixed size, for example, when calculating the first random sequence and the second random sequence, 3 decimal places are retained, and then they can be multiplied by 1000 to convert the values ​​in the first random sequence and the second random sequence into positive integers; after the conversion is completed, all the positive integer values ​​in the first random sequence and the second random sequence are converted into binary values, and after completion, the first chaotic sequence and the second chaotic sequence are obtained;

[0057] Step S205, see Figure 2 As shown, the corresponding digits of the first chaotic sequence and the corresponding position of the second chaotic sequence are subjected to XOR operation, and the third chaotic sequence is obtained after completion; the XOR operation follows the following basic rules: 1⊕1=0, 0⊕0=0, 1⊕0=1, 0⊕1=1, that is, if the two numbers are both 1, the result is 0, if they are both 0, the result is also 0, and if they are different 1 or different 0, the results are both 1;

[0058] In the specific implementation process, the XOR operation of the corresponding digits of the values ​​at the corresponding positions of the first chaotic sequence and the second chaotic sequence is performed in order to increase randomness and improve encryption security. By performing the XOR operation on the values ​​at the corresponding positions of the two chaotic sequences, the original data pattern can be effectively disrupted again on the basis of the original chaos, making it difficult for outsiders to extract useful information from it. The reason for using the XOR operation is that the algorithm is simple and reduces the computational burden in mobile devices with limited resources and computing power.

[0059] Step S3, splitting the file header of the to-be-encrypted file, and encrypting the file header based on the chaotic sequence generation method; the purpose of the splitting process is to divide each value in the file header into two, not a simple addition and subtraction split, and the sum of the two split values ​​is not equal to the original value; since the value of the file header is in hexadecimal, its value range is between [0, 255], which is converted into a binary number, that is, an eight-bit binary number, and the eight-bit binary number is split; Step S3 includes the following sub-steps:

[0060] Step S301, read the file header sequence of the file to be encrypted, set the length of the first file header sequence to L1; select the first L1 bits of the read file header sequence of the file to be encrypted, and mark the first file header sequence;

[0061] The file header is essentially data used to store certain information at the beginning of a file; it describes the basic properties of a file. The file header is usually used to help the operating system or application identify and process the file, that is, to tell the operating system or application which program should be used to open the file; common file types include EXE, COM, BMP, GIF, WMV, APE, RMV, etc. The system will identify the file based on the file header information and select the correct program to open the file; for example, common file headers include: ZIP file type, file header is 504B0304; GIF file type, file header is 47494638; XML file type, file header is 3C3F786D6C; PDF file type, file header is 255044462D312E; the data in the file header is stored in hexadecimal form;

[0062] Step S302, convert all the values ​​in the first file header sequence into binary values, mark them as the second file header sequence, perform corresponding digit AND operations on all the values ​​in the second file header sequence and the binary value 1111111, and the operation rule of AND operation is 0&0=0; 0&1=0; 1&0=0; 1&1=1; that is, if both digits are "1" at the same time, the result is "1", otherwise it is 0; the purpose of this is to extract the last seven digits of the original binary value of the file header. Since the original value of the file header is 8 bits Binary number, the value 1111111 is seven bits, and the low-bit alignment is used in the AND operation, that is, 0 is added before the value 1111111 to ensure that the number of bits of the two are consistent. For example, the original value of the file header is 11110101, and the AND operation with the value 01111111 is 01110101, that is, 1110101; after completion, the obtained value is ANDed with 1011111 in the corresponding digits. The purpose of this is to replace the second highest bit of the number with 0, in preparation for the following processing. After completion, the third file header sequence is obtained;

[0063] Step S303, performing a corresponding digit AND operation on all the values ​​in the second file header sequence and the binary value 10000000, so as to extract the highest digit of the original value of the file header in binary form;

[0064] After the completion, the binary value is converted into a decimal value, and the fourth file header sequence is obtained;

[0065] Step S304, all the values ​​in the fourth file header sequence are divided by the decimal number 4 respectively. The binary number is shifted right by two digits, which is equivalent to the decimal form of the number divided by 4. The purpose of shifting right by two digits is to facilitate the combination with the third file header sequence. After completion, the obtained decimal value is converted into a binary value. After completion, the fifth file header sequence is obtained.

[0066] Step S305, add the values ​​of the corresponding positions of the third file header sequence and the fifth file header sequence, and obtain the sixth file header sequence after completion; merge the third file header sequence and the sixth file header sequence and store them together, marking them as the original file header sequence; for example, taking the decimal number 205 as an example, split 205, and refer to the process Figure 3 As shown in the figure, the purpose of splitting is to destroy the file information stored in the file header before encryption, so as to improve the security and reliability of the overall encryption.

[0067] Step S306, using a chaotic sequence generation method to generate a third chaotic sequence with a length of N1, and converting all values ​​in the third chaotic sequence with a length of N1 into decimal values, marking it as a file header chaotic sequence; the generation length is set according to the actual encryption scenario. In this embodiment, N1 is 500, that is, a 500-bit third chaotic sequence is generated;

[0068] Step S307, the values ​​in the file header chaotic sequence are divided by C1 in turn to obtain the remainder, and the remainder values ​​and the positions of the values ​​in the file header chaotic sequence are recorded, and the values ​​obtained by each remainder are compared with the data obtained by the remainder. If a repeated value appears, the value and position obtained by this remainder are ignored, and the remainder is taken for the next digit until 2*L1 digits of different sizes are obtained, which are marked as array T1, and the positions of the 2*L1 digits of different sizes in the file header chaotic sequence are marked as array T2; the values ​​of the corresponding positions of array T1 and array T2 correspond to each other; the remainder values ​​and the positions of the values ​​in the file header chaotic sequence are recorded for subsequent rearrangement;

[0069] Step S308, sort the 2*L1-bit numbers of different sizes in array T1 in ascending order, marked as array t1; and adjust the positions of the values ​​in array T2 according to the corresponding relationship with the values ​​in array T1, marked as array t2; for example, T1 = {5, 18, 3, 41, 9}, T2 = {1, 3, 4, 7, 8}, 5 corresponds to 1, 18 corresponds to 3, 3 corresponds to 4, 41 corresponds to 7, and 9 corresponds to 8, then T1 is sorted in ascending order as t1 = {3, 5, 9, 18, 41}, and the corresponding position of T2 is adjusted to t2 = {4, 1, 8, 3, 7};

[0070] Step S309, making the array t1 correspond to the original file header sequence; rearranging the array t2 into array T2 according to the numerical values, rearranging the array t1 into T1 according to the correspondence between the array t1 and the array t2, and rearranging the original file header sequence according to the correspondence between t1 and the original file header sequence, marking it as array A1; for example, the original file header sequence is {12, 5, 36, 45, 87}, t1 = {3, 5, 9, 18, 41}, t1 corresponds to the original file header sequence, that is, 12 corresponds to 3, 5 corresponds to 5, 36 corresponds to 9, 45 corresponds to 18, and 87 corresponds to 41; rearranging the array t1 into T1 = {5, 18, 3, 41, 9}, then the corresponding original file header sequence becomes {5, 45, 12, 87, 36}, that is, A1 = {5, 45, 12, 87, 36};

[0071] Step S310, according to the last value in the array T2, continue to divide the value in the file header chaotic sequence by C1 to obtain the remainder, and then obtain 2*L1 numbers of different sizes, and convert them into binary values ​​in turn, marked as array T3; that is, where the file header chaotic sequence has not yet obtained the remainder, continue to obtain 2*L1 numbers of different sizes, for example, the first time to obtain 32-bit numbers of different sizes, the last value is the 43rd value in the file header chaotic sequence to obtain the remainder, then again from the 44th value in the file header chaotic sequence to obtain the remainder;

[0072] Step S311, perform XOR operation on the corresponding digits of the values ​​at the corresponding positions of the array A1 and the array T3, and convert them into hexadecimal values. After completion, an encrypted file header sequence is obtained, marked as a file header encryption sequence, and the file header encryption sequence is used to replace the file header sequence of the file to be encrypted;

[0073] In the specific implementation process, since the file header lengths of different file types are different, ranging from two to fourteen hexadecimal digits, in order to facilitate encryption processing, a fixed length can be set, and the fixed-length sequence in front of the file header sequence is read as the file header for encryption processing, and the remaining data is processed as file content data; for example, in this embodiment, the first sixteen digits of the read file header sequence are selected as the file header for encryption processing, and the remaining data is processed as file content data; and when designing the encryption algorithm, the file header sequence of the file is first encrypted, so that the mobile device cannot identify or open the file in a correct reading manner.

[0074] Step S4, segmenting the file content of the file to be encrypted, and encrypting the file content based on the chaotic sequence generation method; Step S4 includes the following sub-steps:

[0075] Step S401, setting the file content segment size to L2 bits, which can be set according to the actual application scenario. In this embodiment, L2 is 1024; reading the file content of the file to be encrypted, reading L2 bits of data at a time, marked as array B1i, i represents the file content read for the i-th time;

[0076] Step S402: Generate a first chaotic sequence with a length of N2 based on a chaotic sequence generation method. In this embodiment, N2=500; convert all values ​​in the first chaotic sequence into binary values ​​and mark them as file content chaotic sequences;

[0077] Step S403, multiply each value in the chaotic sequence of the file content by E1 to obtain an array H1, and divide the values ​​of the array H1 by E2 according to the position numbers of the values, and take the remainder for the values ​​with odd position numbers, and take the remainder for the values ​​with even position numbers, and then obtain the array H2; multiplying by E1 is to ensure that all the values ​​in the chaotic sequence of the file content become positive integers, and in this embodiment E1=10^10; because the remainder of the values ​​with odd position numbers divided by E2 is the starting point, it is necessary to ensure that the remainder after division by E2 can contain the content segment size, for example, if the content segment size L2 is 1024, then the range of the remainder of E2 should be [0, 1024], and then E2=1025; the remainder of the values ​​with even position numbers divided by E3 is the segment length, so it cannot be greater than 1024, and should not be close to 1024, so in this embodiment, E3=256;

[0078] Step S404, see Figure 4 As described, according to array H2, starting from the values ​​with odd position numbers in the i positions, two values ​​are selected each time, and the values ​​with odd position numbers among the two selected values ​​are used as the segment starting position, and the values ​​with even position numbers are used as the segment length, and the array B1i is segmented and extracted, and the last value of the segment of the extracted array B1i is XORed with the segment length by corresponding digits, and after completion, it is stored in array B2i;

[0079] Step S405, repeat the operation on B1i according to the array H2, and when performing segmented extraction, determine whether the segment has been extracted, including partial extraction and full extraction. If it has been extracted, reselect two values ​​in order until all the values ​​in the array B1i are extracted to obtain the array B2i; for example, the first two values ​​selected are 15 and 59, then the extraction starts from the 15th number of B1i to the 15th+59=74th number, and the second two values ​​selected are 70 and 20, then it should start from the 70th number of B1i, but the 70th to 74th numbers have been extracted in the first time, so the two values ​​selected in the second time should be discarded, and two values ​​should be selected again for extraction;

[0080] Step S406, repeat the operation until all arrays B2i corresponding to all file contents of the file to be encrypted are obtained, and are sorted according to the size of i and marked as file encryption contents;

[0081] In the specific implementation process, for large files, several GB or even larger storage space is required. If the encryption of such files is performed byte by byte, the efficiency is too low. For mobile devices with limited computing power, the encryption will take a long time, resulting in a very low encryption rate. In order to achieve the purpose of fast encryption, the file content data is no longer encrypted byte by byte, but the file is segmented, with each segment as an operation unit, which can greatly improve the encryption efficiency.

[0082] Example 2, please refer to Figure 5 As shown, Figure 5 The structural diagram of an electronic device is illustrated, and the electronic device may include: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the steps in the above-mentioned secure encryption method for a mobile storage device are executed to achieve the following functions: establishing a chaotic mapping system, and the chaotic mapping system includes: a first chaotic mapping and a second chaotic mapping; establishing a chaotic sequence generation method based on the first chaotic mapping and the second chaotic mapping; splitting the file header of the encrypted file, and encrypting the file header based on the chaotic sequence generation method; segmenting the file content of the encrypted file, and encrypting the file content based on the chaotic sequence generation method.

[0083] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0084] Embodiment 4, the present application also provides a computer-readable storage medium, the present application provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned secure encryption method for a mobile storage device are executed to achieve the following functions: establishing a chaotic mapping system, the chaotic mapping system includes: a first chaotic mapping and a second chaotic mapping; establishing a chaotic sequence generation method based on the first chaotic mapping and the second chaotic mapping; splitting the file header of the encrypted file, and encrypting the file header based on the chaotic sequence generation method; segmenting the file content of the encrypted file, and encrypting the file content based on the chaotic sequence generation method.

[0085] Through the description of the above implementation methods, the embodiments of the present invention can be provided as methods, systems or computer program products. Based on such an understanding, the above technical solutions can be essentially or partly contributed to the prior art in the form of software products, which can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and include several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0086] In the embodiments provided in the present application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.

[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application 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. However, 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 embodiments of the present application.

Claims

1. A secure encryption method for a mobile storage device, characterized in that: The steps include: Establishing a chaotic mapping system, the chaotic mapping system includes: a first chaotic mapping and a second chaotic mapping; Establishing a chaotic sequence generation method based on the first chaotic map and the second chaotic map; The file header of the file to be encrypted is split and the file header is encrypted based on the chaotic sequence generation method; The file content of the file to be encrypted is segmented and encrypted based on a chaotic sequence generation method.

2. A secure encryption method for a mobile storage device according to claim 1, characterized in that: Establishing a chaotic mapping system includes the following sub-steps: Establish the first chaotic map: The first chaotic map formula is as follows: Where X n+1 represents the n+1th value; X n represents the nth value; X n-1 represents the n-1th value; α represents the control parameter, and its value range is any non-zero real number; μ represents the control parameter, and its value range is any non-zero real number; The brackets represent the floor function; Establish the second chaotic map: The second chaotic map formula is as follows: X n+1 =λsin(βπX n +πX n-1 ), where λ represents the control parameter, and its value range is any non-zero real number; β represents the control parameter, and its value range is any non-zero real number.

3. A secure encryption method for a mobile storage device according to claim 2, characterized in that: The method for generating a chaotic sequence based on the first chaotic map and the second chaotic map comprises the following sub-steps: Set the length N of the required random value sequence, and then randomly generate an initial value X0 as the mapping initial value; substitute the mapping initial value X0 into the first chaotic mapping formula, repeat the iteration, and obtain a random value sequence of length n, which is marked as the first random sequence; Then substitute the initial value X0 of the mapping into the second chaotic mapping formula, repeat the iteration, and obtain a random value sequence of length n, which is marked as the second random sequence; The values ​​in the first random sequence and the second random sequence are converted into positive integers. After the conversion is completed, all the positive integer values ​​in the first random sequence and the second random sequence are converted into binary values. After the conversion is completed, the first chaotic sequence and the second chaotic sequence are obtained; The corresponding digits of the first chaotic sequence and the values ​​of the corresponding positions of the second chaotic sequence are subjected to an XOR operation, and after completion, a third chaotic sequence is obtained.

4. A secure encryption method for a mobile storage device according to claim 3, characterized in that: The splitting process of the file header of the encrypted file includes the following sub-steps: Read the file header sequence of the file to be encrypted, and set the length of the first file header sequence to L1; select the first L1 bits of the read file header sequence of the file to be encrypted, and mark the first file header sequence; Convert all the values ​​in the first file header sequence into binary values, mark them as the second file header sequence, perform an AND operation on all the values ​​in the second file header sequence and the binary value 1111111 respectively, and then perform an AND operation on the corresponding digits of the obtained values ​​and 1011111, and finally obtain a third file header sequence; Perform an AND operation on the corresponding digits of all the values ​​in the second file header sequence and the binary value 10000000, and convert the obtained binary values ​​into decimal values ​​after completion, and obtain a fourth file header sequence; divide all the values ​​in the fourth file header sequence by the decimal number 4, and convert the obtained decimal values ​​into binary values ​​after completion, and obtain a fifth file header sequence; The values ​​at corresponding positions of the third file header sequence and the fifth file header sequence are added to obtain a sixth file header sequence; the third file header sequence and the sixth file header sequence are combined and stored, and marked as the original file header sequence.

5. A secure encryption method for a mobile storage device according to claim 4, characterized in that: Encrypting the file header based on the chaotic sequence generation method includes the following sub-steps: A third chaotic sequence with a length of N1 is generated by using a chaotic sequence generation method, and all values ​​in the third chaotic sequence with a length of N1 are converted into decimal values ​​and marked as a file header chaotic sequence; Divide the values ​​in the file header chaotic sequence by C1 in turn to obtain the remainder, record the remainder values ​​and the positions of the values ​​in the file header chaotic sequence, and compare the values ​​obtained by each remainder with the data obtained by the remainder. If a repeated value appears, ignore the value and position obtained by this remainder, and obtain the remainder for the next digit until 2*L1 digits of different sizes are obtained, marked as array T1, and the positions of the 2*L1 digits of different sizes in the file header chaotic sequence are marked as array T2; the values ​​of the corresponding positions of array T1 and array T2 correspond to each other; Sort the 2*L1 numbers of different sizes in array T1 in ascending order, and mark it as array t1; and adjust the positions of the values ​​in array T2 according to the corresponding relationship with the values ​​in array T1, and mark it as array t2.

6. A secure encryption method for a mobile storage device according to claim 5, characterized in that: Encrypting the file header based on the chaotic sequence generation method also includes the following sub-steps: Match array t1 with the original file header sequence; rearrange array t2 into array T2 according to the numerical value, rearrange array t1 into T1 according to the correspondence between array t1 and array t2, and rearrange the original file header sequence according to the correspondence between t1 and the original file header sequence, marking it as array A1; According to the last value in array T2, the values ​​in the chaotic sequence of the file header are divided by C1 in turn to obtain the remainder, and then 2*L1 digit numbers of different sizes are obtained, and they are converted into binary values ​​in turn, which are marked as array T3; Perform XOR operation on the corresponding digits of the values ​​at the corresponding positions of array A1 and array T3, and convert them into hexadecimal values. After completion, the encrypted file header sequence is obtained, marked as the file header encryption sequence, and the file header encryption sequence is used to replace the file header sequence of the file to be encrypted.

7. A secure encryption method for a mobile storage device according to claim 6, characterized in that: The file content of the to-be-encrypted file is processed in segments, and the file content is encrypted based on the chaotic sequence generation method, including the following sub-steps: The file content segment size is set to L2 bits, and the file content of the encrypted file is read, and L2 bits of data are read at a time, which is marked as array B1i, where i represents the file content read for the i-th time; based on the chaotic sequence generation method, a first chaotic sequence with a length of N2 is generated, and all values ​​in the first chaotic sequence are converted into binary values, which are marked as file content chaotic sequence.

8. A secure encryption method for a mobile storage device according to claim 7, characterized in that: The process of segmenting the file content of the file to be encrypted and encrypting the file content based on the chaotic sequence generation method also includes the following sub-steps: Multiply each value in the chaotic sequence of the file content by E1 to obtain array H1. Divide the values ​​of array H1 by E2 according to the position number of the value, and take the remainder for the values ​​with odd position numbers, and divide the values ​​with even position numbers by E3 to obtain the remainder. After completion, array H2 is obtained. According to array H2, starting from the values ​​with odd position numbers in the i-th position, two values ​​are selected each time, and the values ​​with odd position numbers among the two selected values ​​are used as the segment starting position, and the values ​​with even position numbers are used as the segment length, and the array B1i is segmented and extracted, and the last value of the segment of the extracted array B1i is XORed with the segment length at the corresponding digits, and then stored in array B2i after completion; according to array H2, the operation is repeated on B1i, and when performing segmented extraction, it is determined whether the segment has been extracted, including partial extraction and full extraction. If it has been extracted, two values ​​are re-selected in order until all the values ​​in array B1i are extracted, and array B2i is obtained; Repeat the operation until all arrays B2i corresponding to all file contents of the file to be encrypted are obtained, and they are sorted according to the size of i and marked as file encryption contents.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 8 are executed.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are executed.

Citation Information

Patent Citations

  • File encryption method

    CN111310222A

  • Image encryption method based on sine mapping and Logistic chaos sequence

    CN103530571A

  • File encryption method and device and file decryption method and device

    CN107153794A

  • Pseudo random permutation based data encryption method in OPC UA edge computation

    CN109586894A

  • Image encryption method based on composite chaotic system and image processing device

    CN109977686A

Cited By

  • Storage device data security backup migration method and device and storage medium

    CN120448185A