File processing method and device, storage medium and computer device
By saving files to the canvas in one-channel, two-channel, and three-channel formats and encrypting the data with the smallest data size, combined with row and column transformations, the problem of balancing transmission speed and confidentiality is solved, achieving efficient data transmission in a browser environment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN TCL NEW-TECH CO LTD
- Filing Date
- 2022-10-24
- Publication Date
- 2026-05-12
AI Technical Summary
During data transmission, existing technologies struggle to strike a balance between compression and encryption, resulting in long transmission times and easy leakage of private data. This is especially true in poor network environments, where transmission speed and confidentiality are difficult to achieve simultaneously.
By byte-coding the original file into an array and saving it to the canvas in one-channel, two-channel, and three-channel formats for compression, the data with the smallest size is selected for encryption. Combining row and column transformation encryption methods reduces the increase in information entropy and achieves a balance between compression and encryption.
It improves data transmission speed and confidentiality, ensures minimal data volume before encryption, minimizes information entropy, and is suitable for large file processing in a browser environment.
Smart Images

Figure CN117149721B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a document processing method, apparatus, storage medium and computer equipment. Background Technology
[0002] With the development of technology, users have increasingly higher requirements for the confidentiality and speed of data transmission. For example, in some application scenarios where data is sensitive but the network environment is poor and insecure, when it is necessary to transmit private data or upload and download files, problems such as long transmission times, interception of private data or file content during transmission, or file content leakage due to attacks on the server database may occur. To optimize the long transmission time and reduce bandwidth consumption, it is generally necessary to compress the data or files. To prevent data or file leakage, it is generally necessary to encrypt the data or files.
[0003] Compression is a process that reduces information entropy, while encryption is a process that increases information entropy. If the increase in information entropy exceeds the decrease in information entropy, then compression becomes meaningless. Summary of the Invention
[0004] This application provides a file processing method, apparatus, storage medium, and computer device that can achieve a balance between compression and encryption to a certain extent.
[0005] This application provides a document processing method, including:
[0006] Obtain the original file to be transferred;
[0007] The original file is byte-diverted to obtain a byte array;
[0008] The data in the byte array is saved to the canvas according to the one-channel saving method, the two-channel saving method, and the three-channel saving method, respectively, and compressed using the compression method supported by the canvas to obtain compressed one-channel data, two-channel data, and three-channel data. The canvas is used to display multiple pixels.
[0009] The data with the smallest data size among the first channel data, the second channel data, the third channel data, and the byte array is taken as the data to be encrypted corresponding to the byte array;
[0010] The data to be encrypted is then encrypted to obtain the encrypted data of the original file.
[0011] This application also provides a file processing method, including:
[0012] The encrypted data of the original file is obtained by byte-coding the original file to obtain a byte array. The data in the byte array is then saved to the canvas according to one-channel, two-channel, and three-channel saving methods, and compressed using the compression method supported by the canvas to obtain compressed one-channel, two-channel, and three-channel data. The one-channel, two-channel, and three-channel data, along with the data with the smallest data size in the byte array, are then used as the data to be encrypted corresponding to the byte array. This encrypted data is then encrypted.
[0013] The encrypted data is decrypted to obtain the decrypted data of the original file;
[0014] If the decrypted data is compressed, then the decrypted data is written to the canvas for decompression to obtain the byte array corresponding to the decrypted data;
[0015] The byte array is converted according to the file type to obtain the original file.
[0016] This application also provides a document processing apparatus, including:
[0017] The first acquisition module is used to acquire the original file to be transmitted;
[0018] The byteification module converts the original file into bytes to obtain a byte array;
[0019] The compression module is used to save the data in the byte array to the canvas according to the one-channel saving method, the two-channel saving method and the three-channel saving method respectively, and to compress it according to the compression method supported by the canvas to obtain the compressed one-channel data, two-channel data and three-channel data. The canvas is used to display multiple pixels.
[0020] The data determination module is used to select the data with the smallest data size among the first-channel data, the second-channel data, the third-channel data, and the byte array as the data to be encrypted corresponding to the byte array;
[0021] An encryption module is used to encrypt the data to be encrypted in order to obtain encrypted data of the original file.
[0022] This application also provides a document processing apparatus, including:
[0023] The second acquisition module is used to acquire the encrypted data of the original file. The encrypted data is obtained by byte-coding the original file to obtain a byte array, and then saving the data in the byte array to the canvas according to the one-channel saving method, the two-channel saving method, and the three-channel saving method respectively. The compressed data is obtained by the compression method supported by the canvas to obtain the compressed one-channel data, the two-channel data, and the three-channel data. The data with the smallest data volume in the byte array is taken as the data to be encrypted corresponding to the byte array, and then the data to be encrypted is encrypted.
[0024] A decryption module is used to decrypt the encrypted data to obtain the decrypted data of the original file;
[0025] The decompression module is used to write the decompressed data to the canvas for decompression if the decompressed data has been compressed, so as to obtain the byte array corresponding to the decompressed data;
[0026] The conversion module is used to convert the byte array according to the file type to obtain the original file.
[0027] This application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to perform the steps of any of the above-described file processing methods.
[0028] This application also provides a computer device, including a processor and a memory, wherein the processor is electrically connected to the memory, the memory is used to store instructions and data, and the processor is used for steps in the file processing method described above.
[0029] The file processing method, apparatus, storage medium, and computer equipment provided in this application acquire the original file to be transmitted, byte-divide the original file to obtain a byte array, save the data in the byte array to a canvas according to one-channel, two-channel, and three-channel saving methods, and compress it using a compression method supported by the canvas to obtain compressed one-channel data, two-channel data, and three-channel data. The one-channel data, two-channel data, three-channel data, and the data with the smallest data size in the byte array are selected as the data to be encrypted corresponding to the byte array, and the data to be encrypted is then encrypted to obtain... The encrypted data of the original file can be saved to the canvas according to different saving methods, and compressed according to the compression method supported by the canvas. The data with the smallest data size is selected from the compressed data and the original byte array as the data to be encrypted. This ensures that the corresponding data size before encryption is minimized, reducing information entropy to the greatest extent. Even if the data to be encrypted is further encrypted, the increase in information entropy is limited, which can minimize the increase in information entropy. To a certain extent, compression and encryption are balanced. When transmitting the encrypted data of the original file, the transmission speed can be improved and the confidentiality can be enhanced. Attached Figure Description
[0030] The technical solution and other beneficial effects of this application will become apparent from the following detailed description of specific embodiments in conjunction with the accompanying drawings.
[0031] Figure 1 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application.
[0032] Figure 2 A flowchart illustrating the file processing method provided in this application embodiment.
[0033] Figure 3a , Figure 3b , Figure 3c and Figure 3d This is a schematic diagram of file type encoding mapping provided for embodiments of this application.
[0034] Figure 4 This is a flowchart illustrating a document processing method provided in an embodiment of this application.
[0035] Figure 5 This is another schematic diagram of the document processing method provided in the embodiments of this application.
[0036] Figure 6 This is another flowchart illustrating the document processing method provided in the embodiments of this application.
[0037] Figure 7 This is a schematic diagram of the structure of the document processing device provided in the embodiments of this application.
[0038] Figure 8 Another schematic diagram of the document processing apparatus provided in the embodiments of this application.
[0039] Figure 9 A schematic diagram of the structure of a computer device provided in an embodiment of this application.
[0040] Figure 10 Another structural schematic diagram of the computer device provided in the embodiments of this application. Detailed Implementation
[0041] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0042] This application provides a file processing method, apparatus, storage medium, and computer device. Any of the file processing apparatuses provided in this application can be integrated into a computer device, which can be a terminal or a server. The terminal includes, but is not limited to, smartphones, tablets, handheld computers, smart wearable devices, smart robots, smart in-vehicle devices, and personal computers (PCs). The server can be a standalone physical server, a server cluster consisting of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, and big data and artificial intelligence platforms.
[0043] Computer devices exist in environments that support canvases. For example, the canvas can be a canvas, and the environment supporting the canvas can be a browser environment. For instance, a browser exists in the computer device, and the browser supports canvases. Multiple pixels can be displayed through a canvas. In this embodiment, a browser environment and a canvas are used as examples for illustration.
[0044] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of this application. The application scenario includes computer device A and computer device B. Computer device A acts as the sender of a file or data, and computer device B acts as the receiver of the file or data. The sender and receiver communicate via a network. In other embodiments, computer device A can act as the receiver of the file or data, while computer device B can act as the sender of the file or data.
[0045] On the sender side, the original file to be transmitted is obtained, and the original file is byte-divided to obtain a byte array. The data in the byte array is saved to the canvas according to different saving methods, such as one-channel saving, two-channel saving, and three-channel saving. The data is compressed according to the methods supported by the canvas to obtain compressed data, such as one-channel data, two-channel data, and three-channel data. The compressed data, such as one-channel data, two-channel data, and three-channel data, and the data with the smallest data size in the byte array are used as the data to be encrypted. The data to be encrypted is encrypted to obtain the encrypted data of the original file. The encrypted data of the original file is sent to the receiver through the network.
[0046] By using the smallest data in the compressed first-channel, second-channel, and third-channel data and the byte array as the data to be encrypted, the corresponding data size before encryption can be minimized, thus reducing information entropy to the greatest extent. Even if the data to be encrypted is then encrypted, the increase in information entropy is limited, which can minimize the increase in information entropy and achieve a balance between compression and encryption to a certain extent. When transmitting the encrypted data of the original file, the transmission speed can be improved and the confidentiality can be enhanced.
[0047] On the receiving end, the encrypted data corresponding to the original file is received, and the encrypted data is decrypted to obtain the decrypted data. If the decrypted data is not compressed, the corresponding byte array is determined based on the decrypted data. If the decrypted data is compressed, the decrypted data is written to the canvas for decompression to obtain the byte array. The byte array is then converted according to the file type to obtain the original file.
[0048] This application provides an integrated solution for file compression, encryption, decryption, and decompression in a browser environment. It achieves a balance between compression and encryption to a certain extent, has wide applicability, and is particularly suitable for large file processing in a browser environment. It should be noted that existing technologies rarely offer integrated encryption and compression solutions for large file processing on the web.
[0049] The document processing methods, apparatus, storage media, and computer devices described in the embodiments of this application will be described in detail below.
[0050] Figure 2 This is a flowchart illustrating a file processing method provided in an embodiment of this application. The file processing method is written from the sender's perspective and applied to a computer device, specifically including the following steps.
[0051] 101, retrieve the original file to be transferred.
[0052] For example, you can select the original file to be transferred from your local machine. Obtain the file type of the file to be transferred; this file type will be needed later when filling in the identifier code.
[0053] 102. Convert the original file to bytes to obtain a byte array.
[0054] For example, the original file can be byte-divided using system-provided interfaces such as the FileReader interface to obtain a byte array. Alternatively, the FileReader interface can be used to convert the original file to a Blob (binary large object) data type to obtain a Blob object. Data such as ArrayBuffer data can then be read from the Blob object to obtain a byte array.
[0055] 103. Save the data in the byte array to the canvas according to the one-channel saving method, the two-channel saving method, and the three-channel saving method respectively, and compress it according to the compression method supported by the canvas to obtain the compressed one-channel data, two-channel data, and three-channel data. The canvas is used to display multiple pixels.
[0056] The canvas can be a canvas, which can be used to draw a lot of content and display multiple pixels. Each pixel in the canvas includes an R channel, a G channel, a B channel, and an alpha channel. In this embodiment, each channel corresponds to one byte as an example. Correspondingly, the data stored in each byte can be between 0 and 255. In other embodiments, the number of bytes corresponding to each channel can be other, such as two bytes per channel.
[0057] In this embodiment, there is no need to segment the byte data. For example, the canvas has no size limit and can store data of any size. Alternatively, in this embodiment, there are other situations where segmenting the byte array is not required. In some embodiments, the canvas has a size limit, thus requiring segmentation of the byte data. Corresponding embodiments will be described below.
[0058] One-channel saving can be done by saving through any one of the R, G, and B channels; two-channel saving can be done by saving through any two of the R, G, and B channels; and three-channel saving is done by saving through the R, G, and B channels.
[0059] The steps described above for saving the data in the byte array to the canvas according to the one-channel, two-channel, and three-channel saving methods include: determining the target saving channel for each of the one-channel, two-channel, and three-channel saving methods. For example, the target saving channel for the one-channel saving method is any one of the R, G, and B channels, such as the R channel; the target saving channel for the two-channel saving method is any two of the R, G, and B channels, such as the R and G channels; and the target saving channel for the three-channel saving method is the R, G, and B channels. The target saving channel is written into an identifier and the identifier is filled into the first pixel of the canvas. The data in the byte array is saved sequentially to the target saving channels corresponding to the other pixels (not the first pixel) of the canvas.
[0060] The identification code can be represented by a Magic Code. The Magic Code includes four identifiers: the first identifier (Identifier 1): the selected target save channel and / or the number of target save channels; the second identifier (Identifier 2): the file type encoding; the third identifier (Identifier 3), starting from 0: the block number, starting from 0; and the fourth identifier (Identifier 4): 255. Identifiers 1, 2, 3, and 4 can be saved using one pixel, for example, to the R channel, G channel, B channel, and alpha channel respectively. For example, the Magic Code value could be (2, 15, 1, 255), representing: the target save channel number is 2, corresponding to the R and G channels; the file type encoding is 15; the second block of the original file; and the fourth identifier filled with 255. If the block number corresponding to the original file after block division is only 0, it indicates that the original file has only one block.
[0061] In this embodiment, each different type of file is encoded separately to generate a file type encoding mapping table, such as... Figure 3a , Figure 3b , Figure 3c and Figure 3d As shown, these are the encodings corresponding to 191 different types of files. For example, a file with a file type encoding of 15 is of type oda.
[0062] The size of the block number is related to the number of bytes corresponding to each channel. Since each channel in this embodiment corresponds to one byte, if the block number starts from 0, the largest corresponding block number is 255, meaning the original file to be transmitted can be divided into a maximum of 256 blocks. Blocking is necessary because the browser-supported canvas has size limitations. If the browser-supported canvas did not have size limitations, then blocking would not be necessary, and the corresponding block number would be 0.
[0063] Identifier 4 uses the alpha channel of the pixel for storage. Because modern browsers have a mechanism called Premultiplied Alpha, if the value of the alpha channel is not equal to 255, the values of the R, G, and B channels may change after the image is generated due to their involvement in the calculation of the alpha channel value, resulting in data distortion. Therefore, the identifier 4 of the identifier code is 255. At the same time, the channel storage method only involves the R, G, and B channels. That is, the real data can only be stored in the R, G, and B channels, and cannot be stored in the alpha channel.
[0064] If the target save channel corresponding to a channel saving method is the R channel, then the target save channel is written into the first identifier (identifier 1) in the identifier code, and the identifier code is filled into the first pixel of the canvas, that is, inserted at the beginning of the ImageDate. Then, the data in the byte array is saved sequentially into the R channels corresponding to other pixels in the canvas. Since the first pixel has been occupied, the first pixel cannot save the data in the byte array. Starting from the second pixel, the data in the byte array is filled into the first position of the ImageDate, that is, the R channel.
[0065] If the target saving channels corresponding to the two-channel saving method are the R channel and the G channel, then the target saving channels are written into the first identifier (identifier 1) in the identifier code, and the identifier code is filled into the first pixel of the canvas, that is, inserted at the beginning of the ImageDate. Then, starting from the second pixel, the data in the byte array is filled into the first and second bits of the ImageDate, that is, the data in the byte array is saved into the R channel and G channel of the corresponding pixel.
[0066] If the target saving channels corresponding to the three-channel saving method are R channel, G channel and B channel, then the target saving channels are written into the first identifier (identifier 1) in the identifier code, and the identifier code is filled into the first pixel of the canvas. Then, starting from the second pixel, the data in the byte array is filled into the first, second and third bits of ImageDate, that is, the data in the byte array is saved to the R channel and G channel of the corresponding pixel.
[0067] The second identifier (identifier 2) of the identifier code can be determined after acquiring the original file to be transmitted. Specifically, the file type corresponding to the original file is determined, and the file type code corresponding to the file type is determined. The file type code is then filled into the second identifier of the identifier code. The third identifier (identifier 3) has a value of 0 if the file is not divided into blocks. If the file is divided into blocks, the corresponding block number is filled into the third identifier of the identifier code. The block number is the number of the split block. The fourth identifier (identifier 4) is simply filled with 255.
[0068] It should be noted that the identifier can also include other information, such as the unique number of the original file to be transmitted, which can be represented by another pixel.
[0069] The details regarding the identification code will not be repeated later.
[0070] After saving the data in the byte array to the canvas using one-channel, two-channel, and three-channel methods respectively, the data is compressed using a compression method supported by the canvas, such as the canvas's toBlob interface, to obtain compressed one-channel, two-channel, and three-channel data respectively. The compression ratio of the one-channel, two-channel, and three-channel data is calculated, or the data volume corresponding to the one-channel, two-channel, and three-channel data is calculated respectively.
[0071] 104. Take the smallest data from the first channel, second channel, third channel, and byte array as the data to be encrypted corresponding to the byte array.
[0072] The data volume corresponding to the one-channel data, two-channel data, three-channel data, and byte array is determined separately. The data volume with the smallest volume among the one-channel data, two-channel data, three-channel data, and byte array is selected as the data to be encrypted corresponding to the byte array. For example, if the data volume with the smallest volume among the one-channel data, two-channel data, three-channel data, and byte array is the one-channel data, then the one-channel data is selected as the data to be encrypted. If the data volume with the smallest volume among the one-channel data, two-channel data, three-channel data, and byte array is the data in the byte array, it means that the data volume after compression by the three compression schemes is larger than the data volume before compression. In this case, no compression is performed, and the original data, i.e., the data in the byte array, is used. The Magic Code is added to the byte array to obtain the data to be encrypted. The first value of the Magic Code is 0, which means that no compression has been performed.
[0073] 105. Encrypt the data to be encrypted to obtain the encrypted data of the original file.
[0074] In this application embodiment, the encryption process can be any encryption method that is reversible after encryption and results in a relatively small increase in information entropy.
[0075] In this embodiment, the byte array corresponding to the original file is saved to the canvas according to different saving methods, and compressed according to the compression method supported by the canvas. The data with the smallest data size is determined from the compressed data and the original byte array as the data to be encrypted. This ensures that the corresponding data size before encryption is minimized, reducing information entropy to the greatest extent. Even if the data to be encrypted is further encrypted, the increase in information entropy is limited, which can minimize the increase in information entropy to a certain extent and achieve a balance between compression and encryption. When transmitting the encrypted data of the original file, the transmission speed can be improved and the confidentiality can be enhanced.
[0076] In another embodiment provided in this application, the encryption process is illustrated by taking row transformation and / or column transformation as an example. The encryption process of row transformation and / or column transformation has limited entropy increase and does not require iterative calculation for each piece of data (especially when the data volume is large, it can improve speed and effectively reduce entropy increase). The key does not need to participate in network transmission, and the transformation process is kept confidential by not using plaintext directly, while also achieving the effect of encryption. It can achieve an effective balance between compression and encryption to the greatest extent.
[0077] Row transformation refers to swapping one or more rows of data with another row or more rows, while column transformation refers to swapping one or more columns of data with another column or more columns.
[0078] Correspondingly, the above steps for encrypting the data to be encrypted to obtain the encrypted data of the original file include: obtaining the user-encrypted displacement multiplier, key array, and position transformation array, wherein the position transformation array is obtained by sorting the key array; and encrypting the data to be encrypted according to the displacement multiplier, key array, and position transformation array to obtain the encrypted data of the original file.
[0079] In encryption processes such as row and / or column transformations, the number of rows and / or columns in a single transformation is used as the displacement factor. For example, if the encryption method is a row transformation and the number of rows in a single transformation is one, then the displacement factor is 1, corresponding to swapping one row with another row in the data. If the encryption method is a column transformation and the number of columns in a single transformation is two, then the displacement factor is 2, corresponding to swapping two columns with two other columns in the data. If the displacement factor is 2, it can be understood as moving two rows each time. Correspondingly, the first and second rows are treated as a unit or as the first row, the third and fourth rows as a unit or as the second row, the fifth and sixth rows as a unit or as the third row, and so on.
[0080] By default, the displacement factor is 1. When the browser supports a canvas with size limitations, the displacement factor can be calculated. For details on the calculation method, please refer to the corresponding section below.
[0081] Here, the key array refers to the byte array converted from the string using the key ciphertext, and the position transformation array is an array generated by sorting the data in the key array in a certain order, such as a preset order, and recording the position of each data in the key array after sorting.
[0082] The steps of obtaining the key array and the position transformation array include: obtaining the plaintext of the encryption key and encrypting the plaintext of the encryption key using a preset encryption algorithm to obtain the ciphertext of the key; converting the ciphertext of the key into a byte array to obtain the key array; sorting the data in the key array in ascending order, and using the array corresponding to the sorted position of each data in the key array as the position transformation array.
[0083] The encryption key can be input by the user or obtained through other means. The plaintext encryption key can be any character, string, and / or number, but for better encryption, it is recommended to use a plaintext encryption key of at least 8 characters. Then, a preset encryption algorithm, such as MD5, is used to encrypt the plaintext encryption key, generating a ciphertext key of the corresponding length. This ciphertext can be 32 bits, 64 bits, or 128 bits, etc. Converting the ciphertext key of the corresponding length into a byte array generates an ArrayBuffer of the corresponding length, which is the key array. For example, the key array can be 32 bits, and the data in the key array can include [50,101,51,99,102,54,48,54,49,50,48,99,53,98,56,56,53,97,53,48,98,51,52,53,50,97,55,54,98,57,50,99].
[0084] The data in the key array is sorted according to a preset order, such as ascending or descending, while ensuring that the order of identical values remains unchanged before and after sorting. The position of each data item in the key array after sorting is recorded, i.e., its index in the sorted array. Finally, a corresponding array of bits is generated, namely the position transformation array. The corresponding number of bits means that the number of bits in the position transformation array is the same as the number of bits in the key array. If the key array is 32 bits, the position transformation array is also 32 bits and consists of data from 0 to 31.
[0085] The process of obtaining the displacement multiple, key array, and position transformation array, and then encrypting the data to be encrypted, includes the following steps: for the data to be encrypted, mapping the value of each data in the key array to the corresponding row and / or column of the data to be encrypted according to the displacement multiple; determining the position information of each data value in the position transformation array, and determining the target row and / or target column based on the position information and the displacement multiple; and exchanging the data of the corresponding row and / or column of the data to be encrypted with the data of the target row and / or target column.
[0086] Specifically, if the encryption method is row transformation, the corresponding row of the data to be encrypted is mapped to the displacement multiple, the target row is determined based on the position information and displacement multiple, and the data of the corresponding row of the data to be encrypted is exchanged with the data of the target row; if the encryption method is column transformation, the corresponding column of the data to be encrypted is mapped to the displacement multiple, the target column is determined based on the position information and displacement multiple, and the data of the corresponding column of the data to be encrypted is exchanged with the data of the target column.
[0087] Taking the encryption process of row transformation and displacement multiplier of 1 as an example, assuming the first data in the key array is 50, it corresponds to the 50th row of the data to be encrypted. After sorting, it drops to the 10th position, which is the corresponding position information of 10 in the position transformation array. Therefore, the target row is determined to be 10. Accordingly, the data in the 50th row of the data to be encrypted is swapped with the data in the 10th row of the data to be encrypted.
[0088] For each data in the key array, the corresponding row transformation is performed in the corresponding manner. If the key array is 32 bits, then 32 transformations are required to complete the encryption process of the data to be encrypted.
[0089] It's important to note that if the final encrypted data of the original file is saved as an image, since each pixel in an image has four channels, after obtaining the data to be encrypted, padding data is needed. Correspondingly, the file processing method includes: for the data to be encrypted, determining the number of bytes of padding data to be added and the actual padding data; and adding padding data equal to the number of bytes of padding data to the end of the data to be encrypted to obtain the padded data to be encrypted. The padding data to be added can be 255, which is inserted at the end.
[0090] Correspondingly, after obtaining the encrypted data of the original file, the file processing method also includes 106.
[0091] 106. Export and transmit encrypted data as an image, or write encrypted data to a text file and transmit it.
[0092] Once the encrypted data is obtained, it can be imported into a canvas and saved and transmitted as an image, or the image can be saved to a text file and transmitted, or the encrypted data can be converted into a string, saved to a text file, and transmitted.
[0093] This increases the speed of transmission and enhances the confidentiality of file transfers.
[0094] In this embodiment, the byte array corresponding to the original file is saved to the canvas according to different saving methods, and compressed according to the compression method supported by the canvas. The data with the smallest data size is determined from the compressed data and the original byte array as the data to be encrypted. This ensures that the corresponding data size before encryption is minimized, reducing information entropy to the greatest extent. Even if the data to be encrypted is then encrypted, the increase in information entropy is limited, thus minimizing the increase in information entropy. To a certain extent, compression and encryption are balanced. When the encrypted data of the original file is transmitted, the transmission speed can be improved and the confidentiality can be enhanced.
[0095] In practice, since the solution in this embodiment can be applied to a browser environment, and to prevent memory overflow and lag, it is necessary to limit the maximum area of the canvas. Different browsers have different memory usage standards; therefore, the maximum width, height, and area of the canvas supported by different browsers vary. As shown in Table 1, the data in Table 1 is in pixels. For example, the maximum width of the canvas supported by the Chrome browser is 32767 pixels.
[0096] Table 1 shows examples of the maximum width, height, and area of the canvas supported by different browsers.
[0097] Browser Maximum width Maximum height Maximum area Chrome 32767 32767 268435456(16384*16384) Firefox 32767 32767 472907776(22528*20992)
[0098] like Figure 4 The diagram shown is a flowchart of a file processing method provided in an embodiment of this application. This file processing method is written from the perspective of the sender and applied to a computer device, and specifically includes the following steps.
[0099] 201, retrieve the original file to be transferred.
[0100] 202. Convert the original file to bytes to obtain a byte array.
[0101] 203. Based on the maximum fill text data supported by the canvas, split the data in the byte array to obtain at least one single byte array.
[0102] The maximum fill text data supported by the canvas is at least related to the displacement factor, such as the displacement factor and the size of the original file to be transmitted.
[0103] First, determine the maximum processing file size at a shift factor of 1: obtain the size of the original file to be transmitted, the maximum number of bytes supported by the canvas, and the determined maximum number of blocks. Based on the size of the original file, the maximum number of bytes supported by the canvas, and the maximum number of blocks, determine the maximum processing file size corresponding to a shift factor of 1, i.e., the maximum processing file size at a shift factor of 1.
[0104] By default, the displacement multiplier is 1, and the maximum number of bytes supported by a single canvas block is 256*32766*4. One pixel is used to store the identification code, so the number of pixels that can store the byte array is 32766. Each pixel has 4 channels, and each channel corresponds to 256. Since the third identifier of the Magic Code corresponds to one byte, the maximum number of blocks is only 256 (if the computer device supports 10-bit pixel depth, the third identifier corresponds to more than one byte, with a maximum of 1024). Considering the extreme case where all blocks use a one-channel storage method, the theoretically maximum supported processing file size is (256*32766*4*256) / 4 = 256*256*32766 = approximately 2G. This value is recorded as the maximum processing file size under the 1st displacement multiplier.
[0105] Then, the displacement factor is determined based on the maximum processing file size under the first factor and the original file size to be transferred. The displacement factor is equal to the actual original file size to be transferred divided by the maximum processing file size under the first factor and rounded up. The corresponding formula for determining the displacement factor is: Displacement factor = Math.ceil(Original file size to be transferred / (256 * 256 * 32766)).
[0106] Finally, based on the displacement factor, the maximum fill text data supported by the canvas is determined. The maximum fill text data is calculated as: displacement factor * 256 * 32766, where 256 * 32756 represents the maximum fill text data of the canvas in the extreme case of a single-channel storage method with a displacement factor of 1.
[0107] After determining the maximum fill text data supported by the canvas, the data in the byte array is split into at least one single byte array based on this maximum fill text data. Specifically, the number of blocks to be split is determined based on the maximum fill text data supported by the canvas and the size of the byte array; the data in the byte array is then split into at least one single byte array based on the number of blocks.
[0108] The formula for calculating the number of chunks to be split is: Chunk Number = Math.ceil(Original File Size to be Transmitted / (Offset Multiplier * 256 * 32766)). Based on the chunk number, the data in the byte array is split, using the maximum fill text data supported by the canvas as the unit, to obtain one or more single-chunk byte arrays. The chunk number is written into the identifier of each single-chunk byte array, such as the third identifier. Furthermore, the second identifier of each single-chunk byte array needs to be filled with the file type code to be transmitted.
[0109] 204. Save the data in each of the at least one block byte arrays to the canvas according to the one-channel saving method, the two-channel saving method, and the three-channel saving method, respectively, and compress them using the compression method supported by the canvas to obtain the compressed one-channel data, two-channel data, and three-channel data of each block byte array.
[0110] For each single-block byte array in at least one single-block byte array, the target storage channel to be stored for each single-block byte array is determined according to the one-channel storage method, two-channel storage method, and three-channel storage method, respectively. The target storage channel corresponding to the one-channel storage method is any one of the R channel, G channel, and B channel; the target storage channel corresponding to the two-channel storage method is any two of the R channel, G channel, and B channel; and the target storage channel corresponding to the three-channel storage method is the R channel, G channel, and B channel. The target storage channel is written into the identifier code of each single-block byte array, and the identifier code is filled into the first pixel of the canvas. The data in each single-block byte array is saved sequentially to the target storage channels corresponding to the other pixels of the canvas. The data in each single-block byte array corresponding to the target storage channel in the canvas is called the main text data.
[0111] Specifically, for each single byte array, the first identifier of the corresponding identifier code is determined according to the one-channel, two-channel, and three-channel saving methods, respectively. In this way, to determine the complete identifier code, for the one-channel, two-channel, and three-channel saving methods, the corresponding identifier code is inserted at the beginning of the Image Data as the first pixel, and the data in each single byte array is saved sequentially to the target saving channel corresponding to the other pixels of the canvas according to the corresponding one-channel, two-channel, and three-channel saving methods.
[0112] For each single-block byte array, taking the one-channel saving method as an example, assuming the target saving channel for the one-channel saving method is the R channel, the target saving channel and / or the number of target saving channels are saved to the first identifier of the identifier code. This is then combined with the block number filled in during the previous block segmentation, the obtained file type encoding, and the default value of 255 to obtain the complete identifier code corresponding to the single-block byte array. This identifier code is inserted at the beginning of the Image Data as the first pixel. Starting from the second pixel, the data in the single-block byte array is saved sequentially to the R channel of the canvas. Next, the data in the single-block byte array is saved sequentially to the R and G channels of the canvas using the two-channel saving method, and sequentially to the R, G, and B channels of the canvas using the three-channel saving method.
[0113] Among them, the maximum width of the canvas is 32766 when saving with one channel, 32766 / 2 when saving with two channels, and 32766 / 3 when saving with three channels.
[0114] After saving the data in the single byte array to the canvas in one-channel, two-channel, and three-channel saving methods respectively, the data is compressed using the compression methods supported by the canvas to obtain compressed one-channel, two-channel, and three-channel data respectively.
[0115] Each single byte array is processed in the same way to obtain the compressed one-channel data, two-channel data, and three-channel data corresponding to each single byte array.
[0116] 205. The compressed data of each single byte array in the byte array, including the first channel data, the second channel data, the third channel data, and the data with the smallest data size in each single byte array, are taken as the data to be encrypted corresponding to each single byte array in the byte array.
[0117] For each byte block, the compressed first-channel data, second-channel data, third-channel data, and the smallest data in the byte block are used as the data to be encrypted for that byte block. This process is repeated to obtain the data to be encrypted for each byte block. It's important to note that if the byte block has the smallest data, a Magic Code needs to be added to the byte array to obtain the data to be encrypted. The first value of the Magic Code is 0.
[0118] Understandably, the data to be encrypted corresponding to each single byte array can be compressed one-channel, two-channel, or three-channel data, or it can be an identifier plus that single byte array. The data to be encrypted corresponding to each single byte array may not be completely consistent. For example, the data to be encrypted corresponding to the first byte array is one-channel data, the data to be encrypted corresponding to the second byte array is an identifier plus that single byte array, and the data to be encrypted corresponding to the third byte array is three-channel data, and so on.
[0119] In one embodiment, for each piece of data to be encrypted, since the data exported from the canvas must be a multiple of 4, and each piece of canvas to be encrypted needs to have a fixed number of rows to facilitate subsequent encryption processing, it may be necessary to fill in the data with blanks. Correspondingly, the file processing method also includes the following steps 206-207.
[0120] 206. For each block of byte array corresponding to the data to be encrypted, determine the number of blank padding bytes to be filled and the blank padding data to be filled.
[0121] For each block of byte array corresponding to the data to be encrypted, the fixed number of rows of the canvas is determined according to the displacement multiple, the minimum width of the canvas is determined according to the data to be encrypted and the fixed number of rows, and the number of blank padding bytes to be filled in each block of byte array is determined according to the minimum width of the canvas, the displacement multiple and the data to be encrypted.
[0122] For example, the result of 256 * the displacement factor can be used as the fixed number of rows in the canvas to be encrypted. Divide the data to be encrypted by the fixed number of rows, and then round up to obtain the minimum width of the canvas to be encrypted, specifically the number of pixels corresponding to the minimum width of the canvas to be encrypted. The number of bytes of blank data to be filled is determined based on the minimum width of the canvas to be encrypted, the displacement factor, and the data to be encrypted. For example, it can be calculated using the formula: Number of bytes of blank data to be filled = Minimum width of the canvas to be encrypted * 256 * displacement factor * 4 - Data to be encrypted.
[0123] 207. Add blanks to the end of the data to be encrypted, with the number of blanks equal to the number of bytes of the padding data, to obtain the padded data to be encrypted.
[0124] The blank padding data can be 255. Blank padding data is inserted / filled after the data to be encrypted, and the number of bytes inserted / filled is the determined number of blank padding data bytes.
[0125] 208. Each padded piece of data to be encrypted is encrypted to obtain the encrypted data corresponding to each block of byte array in the original file.
[0126] Correspondingly, the key array, position transformation array, and displacement multiple calculated according to the displacement multiple formula are obtained for encryption. The data to be encrypted corresponding to each block byte array is encrypted according to the key array, position transformation array, and displacement multiple to obtain the encrypted data of each block byte array. The encrypted data of each block byte array is used together as the encrypted data of the original file.
[0127] The steps of encrypting the data to be encrypted corresponding to each single byte array based on the key array, the position transformation array, and the displacement multiple to obtain the encrypted data of each single byte array include: for the data to be encrypted corresponding to each single byte array in the byte array, mapping the value of each data in the key array to the corresponding row or column of the data to be encrypted according to the displacement multiple; determining the position information of each data value in the position transformation array, and determining the target row or target column according to the position information and the displacement multiple; exchanging the data of the corresponding row or column of the data to be encrypted with the data of the target row or target column to obtain the encrypted data of each single byte array.
[0128] For example, taking a row transformation and a shift factor of 2 as the encryption method, assuming the first data in the key array is 50, and based on the shift factor corresponding to rows 99 and 100 of the data to be encrypted in a single byte array, the position information of the first data in the transformed data is determined to be 10. Then, based on the position information and the shift factor, the target rows are determined to be 19 and 20. Correspondingly, rows 99 and 100 of the data to be encrypted are swapped with rows 19 and 20. This process continues until each data in the key array has been swapped with its corresponding row and target row, thus completing the encryption process for a single byte array. For a detailed explanation of the encryption process, please refer to the description of the corresponding steps above; it will not be repeated here.
[0129] 209. Export and transmit the encrypted data corresponding to each single byte array as an image, or write the encrypted data corresponding to each single byte array to a text file and transmit it.
[0130] In this embodiment, the data in the byte array is split according to the maximum fill text data supported by the canvas. Then, each byte array in at least one single byte data block obtained after splitting is processed accordingly to avoid memory overflow and lag during processing. After splitting, multiple single byte data blocks can be processed in parallel, improving processing efficiency and transmission efficiency, and enhancing user experience. At the same time, it ensures that the corresponding data volume before encryption is minimized, reducing information entropy to the greatest extent. Even if the data to be encrypted is further encrypted, the increase in information entropy is limited, minimizing the increase in information entropy. To a certain extent, compression and encryption are balanced. When transmitting the encrypted data of the original file, the transmission speed can be improved and the confidentiality can be enhanced.
[0131] The above embodiments involve a compression and encryption process; the decompression and decompression process will be described below. During decompression and decompression, a mirror-reverse operation is performed: first decrypt, then decompress sequentially, finally obtaining the original file.
[0132] Figure 5 This is another schematic flowchart of the document processing method provided in the embodiments of this application. This document processing method is written from the perspective of the recipient and can be combined with... Figure 2 The document processing method, as illustrated in the embodiments shown, is applied in a computer device and specifically includes the following steps.
[0133] 301, retrieves the encrypted data from the original file.
[0134] The encrypted data is obtained according to the method described in the above embodiments, which will not be repeated here. The encrypted data can be sent from the sender to the receiver. The canvas may or may not have a size limit. When the canvas has no size limit, the original file is not segmented, and the corresponding encrypted data is one block. When the canvas has a size limit, the original file may be segmented, and the corresponding encrypted data can be at least one block.
[0135] 302, decrypt the encrypted data to obtain the decrypted data of the original file.
[0136] Correspondingly, the displacement multiple, the inversion key array, and the inversion position transformation array are obtained, wherein the inversion position transformation array is determined based on the inversion key array; the encrypted data is decrypted based on the displacement multiple, the inversion key array, and the inversion position transformation array to obtain the decrypted data.
[0137] The displacement factor can be determined based on the number of rows in the encrypted data. Specifically, the number of rows in the encrypted data is obtained, and the displacement factor is determined according to the fixed formula: number of rows = 256 * displacement factor. The determined displacement factor is the same as the displacement factor determined during the compression and encryption process.
[0138] The steps of obtaining the inverted key array and the inverted position transformation array include: obtaining the plaintext encryption key and encrypting it using a preset encryption algorithm to obtain the ciphertext key; converting the ciphertext key into a byte array to obtain the key array; sorting the data in the key array according to a preset order and using the array storing the position of each data in the key array after sorting as the position transformation array; and inverting the data in the key array and the position transformation array to obtain the inverted key array and the inverted position transformation array, respectively.
[0139] The steps to obtain the key array and position transformation array are the same as described above and will not be repeated here. After obtaining the key array and position transformation array, the data in the key array is reversed to obtain the reversed key array, and the data in the position transformation array is reversed to obtain the reversed position transformation array. The reversal process involves swapping the first and last data in the array, the second and second-to-last data, the third and third-to-last data, and so on, until all data in the array has been swapped. For example, if the data in the key array are 42, 51, 100, 94, ..., 58, 21, 73, 89, then the reversed key array will be 89, 73, 21, 58, ..., 94, 100, 51, 42.
[0140] After obtaining the inversion key array and the inversion position transformation array, the encrypted data is decrypted based on the displacement multiple, the inversion key array, and the inversion position transformation array to obtain the decrypted data. Specifically, for each data value in the inversion key array, the corresponding row and / or column of the encrypted data is mapped to the displacement multiple; the position information of each data value in the inversion transformation array is determined, and the target row and / or target column is determined based on the position information and the displacement multiple. The data in the corresponding row and / or column of the encrypted data is swapped with the data in the target row and / or target column of the encrypted data. The values of each data in the inversion key array are swapped in the same way to finally obtain the decrypted data. Specifically, the swapping method is consistent with the compression and encryption process described above; please refer to the section described above for details.
[0141] The decrypted data corresponds to the data to be encrypted that was filled in during the compression and encryption process.
[0142] 303. If the decrypted data is compressed, write the decrypted data to the canvas for decompression to obtain the byte array corresponding to the decrypted data.
[0143] After obtaining the decrypted data, the identification code included in the decrypted data can be used to determine whether the decrypted data was compressed during the compression and encryption process. When the first identifier of the identification code is 0, it means that the decrypted data was not compressed during the compression and encryption process. Otherwise, for example, when the first identifier of the identification code is 1, 2, 3 or a non-zero value such as R, RG, RGB, it means that the decrypted data was compressed during the compression and encryption process.
[0144] If the decrypted data was compressed during the compression and encryption process, the decrypted data corresponds to the compressed data and padding data from the compression and encryption process. The compressed data includes an identifier and the main text data (a single-block byte array). Decompression is then required, for example, by writing the decrypted data to a canvas for decompression to obtain the corresponding byte array. Specifically, the decrypted data is written to the canvas for decompression to obtain the initial restored data, and the identifier and / or padding data in the initial restored data are removed. The target save channel corresponding to the initial restored data is obtained, and the data in the target save channel is extracted from the canvas to obtain the byte array corresponding to the decrypted data.
[0145] The process involves writing the decrypted data into the canvas, decompressing it using the `canvas.getImageData` interface, and obtaining the initial restored data. This initial restored data consists of the uncompressed identifier, main text data (a single-block byte array), and whitespace padding data from the canvas. The identifier and whitespace padding data are removed from the initial restored data; during whitespace padding removal, all last 255s are deleted. The target storage channel corresponding to the initial restored data is then obtained. Specifically, the identifier corresponding to the initial restored data is obtained, which is the value of the first pixel in the canvas. The first identifier in the identifier is retrieved, and it determines the target storage channel. A first identifier of 1 indicates the R channel, 2 indicates both R and G channels, and 3 indicates R, G, and B channels. The corresponding number of bytes from the target storage channel are extracted from the canvas to obtain the byte array corresponding to the decrypted data.
[0146] 304. If the decrypted data is not compressed, the corresponding byte array is determined directly from the decrypted data.
[0147] If the decrypted data was not compressed during the compression and encryption process, the decrypted data includes an identifier, a byte array, and padding data. The identifier and padding data are removed to obtain the byte array. In other words, if the decrypted data was not compressed during the compression and encryption process, then decompression is unnecessary.
[0148] 305 converts the byte array according to the file type to obtain the original file.
[0149] The file type code is obtained based on the second identifier in the identifier code. The corresponding file type is then looked up in the file type code mapping table based on the file type code. The byte array is then converted according to the file type using the File interface to obtain the original file.
[0150] Figure 6 This is another flowchart illustrating the document processing method provided in this application embodiment. This document processing method is written from the recipient's perspective and can be combined with... Figure 4 The document processing method, as illustrated in the embodiments shown, is applied in a computer device and specifically includes the following steps.
[0151] 401, retrieve at least one block of encrypted data corresponding to the original file.
[0152] The number of blocks corresponding to the encrypted data is determined according to the method described above.
[0153] 402, decrypt each block of encrypted data in at least one block of encrypted data to obtain each decrypted block of data.
[0154] Correspondingly, the displacement multiple, the inversion key array, and the inversion position transformation array are obtained. Based on the displacement multiple, the inversion key array, and the inversion position transformation array, each block of encrypted data in at least one block of encrypted data is decrypted to obtain each block of decrypted data.
[0155] The process for each block of encrypted data is as follows: For each data value in the inverted key array, the corresponding row and / or column of the encrypted data is mapped to the specified row and / or column based on the displacement factor; the position information of each data value in the inverted transformation array is determined, and the target row and / or target column is determined based on the position information and displacement factor; the data of the corresponding row and / or target column of the encrypted data is swapped with the data of the target row and / or target column of the encrypted data; the values of each data in the inverted key array are swapped in the same way, ultimately yielding the decrypted data for that block of encrypted data. This process produces each block of decrypted data corresponding to each block of encrypted data. Each decrypted data corresponds to the data to be encrypted during the compression and encryption process.
[0156] 403. If the decrypted data of the corresponding block is compressed, write the decrypted data of the corresponding block to the canvas for decompression to obtain the single-block byte array corresponding to the decrypted data of the corresponding block.
[0157] Each block of decrypted data includes an identification code, which is used to determine whether each block of decrypted data was compressed during the compression and encryption process.
[0158] If the decryption data of the corresponding block was compressed during the compression and encryption process, the decryption data of the corresponding block includes the compressed data and the blanking data. The compressed data includes the identifier code and the text data (single block byte array).
[0159] Write the decrypted data of the corresponding block to the canvas for decompression to obtain the initial restored data corresponding to the decrypted data of the corresponding block. The initial restored data consists of the uncompressed identifier, the main text data (single-block byte array), and the blanking data in the canvas. Remove the identifier and / or blanking data from the initial restored data. When removing the blanking data, delete all the last 255s in the initial restored data. Obtain the target save channel corresponding to the initial restored data. For example, obtain the first identifier of the identifier in the initial restored data. This first identifier indicates the target save channel used. Extract the data from the target save channel from the canvas to obtain the single-block byte array corresponding to the decrypted data of the corresponding block.
[0160] 404. If there is uncompressed decrypted data for a corresponding block, the corresponding single-block byte array is determined directly based on the decrypted data of that block.
[0161] If there is uncompressed decrypted data in a corresponding block, the decrypted data in that block includes an identifier, text data (a single-block byte array), and padding data. The identifier and padding data in the decrypted data of that block are removed to obtain the corresponding single-block byte array.
[0162] 405. Concatenate each individual byte array in sequence to obtain a byte array.
[0163] Since each block of decrypted data includes an identifier, and the third identifier of the identifier is the block number corresponding to each block of decrypted data, the block number corresponding to each single byte array is obtained, and the data in each single byte array is concatenated according to the order of the block numbers to obtain the byte array before splitting.
[0164] 406 converts the byte array according to the file type to obtain the original file.
[0165] This section describes the decryption and decompression process.
[0166] Based on the method described in the above embodiments, this embodiment will be further described from the perspective of a file processing device. This file processing device can be implemented as a separate entity or integrated into a computer device.
[0167] Please see Figure 7 , Figure 7 This application provides a file processing apparatus that is applied in a computer device, such as a sender, where the computer device has a canvas-supporting environment. For example, the canvas can be a canvas, and the canvas-supporting environment can be a browser environment. The file processing apparatus may include: a first acquisition module 501, a byte-based module 502, a compression module 503, a data determination module 504, and an encryption module 505.
[0168] The first acquisition module 501 is used to acquire the original file to be transmitted.
[0169] The byteification module 502 byteifies the original file to obtain a byte array.
[0170] Compression module 503 is used to save the data in the byte array to the canvas according to the one-channel saving method, the two-channel saving method and the three-channel saving method respectively, and to compress it according to the compression method supported by the canvas to obtain compressed one-channel data, two-channel data and three-channel data. The canvas is used to display multiple pixels.
[0171] The data determination module 504 is used to select the data with the smallest data volume among the first-channel data, the second-channel data, the third-channel data, and the byte array as the data to be encrypted corresponding to the byte array.
[0172] The encryption module 505 is used to encrypt the data to be encrypted in order to obtain the encrypted data of the original file.
[0173] In one embodiment, the file processing device further includes a chunking module 506. The chunking module 506 is used to split the data in the byte array according to the maximum fill text data supported by the canvas, to obtain at least one single-chunk byte array. Correspondingly, the compression module 503 is further used to save the data in each single-chunk byte array to the canvas according to a one-channel saving method, a two-channel saving method, and a three-channel saving method, respectively, and compress them using the compression method supported by the canvas, to obtain the compressed one-channel data, two-channel data, and three-channel data of each single-chunk byte array. The data determination module 504 is further used to select the compressed one-channel data, the two-channel data, the three-channel data, and the data with the smallest data size in each single-chunk byte array as the data to be encrypted corresponding to each single-chunk byte array in the byte array. The encryption module 505 is further used to encrypt the data to be encrypted corresponding to each single-chunk byte array in the byte array, to obtain the encrypted data corresponding to each single-chunk byte array of the original file.
[0174] In one embodiment, the compression module 503 is specifically configured to, for each of the at least one block byte arrays, determine the target storage channel to be stored for each block byte array according to a one-channel storage method, a two-channel storage method, and a three-channel storage method, wherein the target storage channel corresponding to the one-channel storage method is any one of the R channel, G channel, and B channel; the target storage channel corresponding to the two-channel storage method is any two of the R channel, G channel, and B channel; and the target storage channel corresponding to the three-channel storage method is the R channel, G channel, and B channel; write the target storage channel into the identifier code of each block byte array, and fill the identifier code into the first pixel of the canvas; and save the data in each block byte array sequentially to the target storage channels corresponding to the other pixels of the canvas.
[0175] In one embodiment, the chunking module 506 is specifically configured to determine the number of chunks to be split based on the maximum fill text data supported by the canvas and the size of the byte array; and to split the data in the byte array according to the number of chunks to obtain at least one single-chunk byte array. The maximum fill text data supported by the canvas is at least related to the displacement factor, for example, to the displacement factor and the size of the original file to be transmitted.
[0176] In one embodiment, the encryption module 505 is specifically used to obtain a key array, a position transformation array, and a displacement multiple for encryption, wherein the position transformation array is obtained by sorting the key array; and to encrypt the data to be encrypted corresponding to each single byte array in the byte array according to the key array, the position transformation array, and the displacement multiple, so as to obtain the encrypted data of the original file.
[0177] In one embodiment, when the encryption module 505 performs the step of encrypting the data to be encrypted corresponding to each block of byte array in the byte array according to the displacement multiple, the key array, and the position transformation array to obtain the encrypted data of the original file, it is specifically used to: for the data to be encrypted corresponding to each block of byte array in the byte array, map the value of each data in the key array to the corresponding row or column of the data to be encrypted according to the displacement multiple; determine the position information of the value of each data in the position transformation array, and determine the target row or target column according to the position information and the displacement multiple; and exchange the data of the corresponding row or column of the data to be encrypted with the data of the target row or target column.
[0178] In one embodiment, when performing the step of obtaining the displacement multiple, the encryption module 505 is specifically used to obtain the size of the original file, the maximum number of bytes supported by the canvas, and the determined maximum number of blocks; determine the maximum processing file size corresponding to a displacement multiple of one based on the size, the maximum number of bytes, and the maximum number of blocks; and determine the displacement multiple based on the size of the original file and the maximum processing file size.
[0179] In one embodiment, when the encryption module 505 performs the acquisition of the key array and the position transformation array, it specifically acquires the plaintext of the encryption key and encrypts the plaintext of the encryption key using a preset encryption algorithm to obtain the ciphertext of the key; converts the ciphertext of the key into a byte array to obtain the key array; sorts the data in the key array according to a preset order, and uses the array that stores the position of each data in the key array after sorting as the position transformation array.
[0180] In one embodiment, the file processing apparatus further includes a padding module 507, which is used to, after obtaining the data to be encrypted corresponding to each block of the byte array in the byte array, determine the number of blank padding data bytes to be filled and the blank padding data to be filled for the data to be encrypted; and fill the data to be encrypted with the number of blank padding data bytes to the end of the data to be encrypted to obtain the filled data to be encrypted.
[0181] In one embodiment, when the filling module 507 performs the step of determining the number of blank fill data bytes to be filled for the data to be encrypted, it specifically performs the following: determining the fixed number of rows of the canvas based on the displacement multiple; determining the minimum width of the canvas based on the data to be encrypted and the fixed number of rows; and determining the number of blank fill data bytes to be filled based on the minimum width of the canvas, the displacement multiple, and the data to be encrypted.
[0182] In one embodiment, the file processing device further includes a file transfer module 508. The file transfer module 508 is configured to, after obtaining the encrypted data of the original file, export and transmit the encrypted data as an image, or write the encrypted data to a text file and transmit it.
[0183] Please see Figure 8 , Figure 8 This application provides a file processing apparatus that is applied in a computer device, such as a receiving device, where the computer device has a canvas-supporting environment. For example, the canvas can be a canvas, and the canvas-supporting environment can be a browser environment. The file processing apparatus may include: a second acquisition module 601, a decryption module 602, a decompression module 603, and a conversion module 604.
[0184] The second acquisition module 601 is used to acquire the encrypted data of the original file, which is obtained in accordance with the method of the corresponding embodiment described above.
[0185] The decryption module 602 is used to decrypt the encrypted data to obtain the decrypted data of the original file.
[0186] The decompression module 603 is used to write the decompressed data to the canvas for decompression if the decompressed data has been compressed, so as to obtain the byte array corresponding to the decompressed data; if the decompressed data has not been compressed, the corresponding byte array is determined directly based on the decompressed data.
[0187] The conversion module 604 is used to convert the byte array according to the file type to obtain the original file.
[0188] In one embodiment, the file processing device further includes a splicing module 605. Correspondingly, the second acquisition module 601 is used to acquire at least one block of encrypted data corresponding to the original file; the decryption module 602 is used to decrypt each block of encrypted data in the at least one block of encrypted data to obtain each block of decrypted data; the decompression module 603 is used to, if there is a block of decrypted data that has been compressed, write the decrypted data of the corresponding block to the canvas for decompression to obtain a single byte array corresponding to the decrypted data of the corresponding block; if there is a block of decrypted data that has not been compressed, directly determine the corresponding single byte array based on the decrypted data of the corresponding block; the splicing module 605 is used to splice each single byte array in sequence to obtain a byte array; and the conversion module 604 is used to convert the byte array according to the file type to obtain the original file.
[0189] In one embodiment, when the decompression module 603 performs the step of writing the decrypted data of the corresponding block to the canvas for decompression to obtain the single-block byte array corresponding to the decrypted data of the corresponding block, it is specifically used to write the decrypted data of the corresponding block to the canvas for decompression to obtain the initial restored data corresponding to the decrypted data of the corresponding block; remove the identifier code and / or blank padding data in the initial restored data; obtain the target storage channel of the initial restored data from the identifier code, and extract the data in the target storage channel from the canvas to obtain the single-block byte array corresponding to the decrypted data of the corresponding block.
[0190] In one embodiment, when the decryption module 602 performs the step of decrypting each block of encrypted data in at least one block of encrypted data to obtain each decrypted data block, it is specifically used to: obtain a displacement multiple, a reverse key array, and a reverse position transformation array, wherein the reverse position transformation array is determined based on the reverse key array; and decrypt each block of encrypted data in at least one block of encrypted data according to the displacement multiple, the reverse key array, and the reverse position transformation array to obtain each decrypted data block.
[0191] In one embodiment, when the decryption module 602 performs the steps of obtaining the inverted key array and the inverted position transformation array, it is specifically used to: obtain the plaintext of the encryption key and encrypt the plaintext of the encryption key using a preset encryption algorithm to obtain the ciphertext of the key; convert the ciphertext of the key into a byte array to obtain the key array; sort the data in the key array according to a preset order, and use the array that stores the position of each data in the key array after sorting as the position transformation array; and invert the data in the key array and the position transformation array to obtain the inverted key array and the inverted position transformation array, respectively.
[0192] in, Figure 7 and Figure 8 The modules in both embodiments can also be integrated into a single computer device. In specific implementation, the above modules can be implemented as independent entities or arbitrarily combined as the same or several entities. For specific implementation of the above modules, please refer to the preceding method embodiments. For the specific beneficial effects that can be achieved, please also refer to the beneficial effects in the preceding method embodiments, which will not be repeated here.
[0193] In addition, embodiments of this application also provide a computer device, such as... Figure 9 As shown, the computer device 700 includes a processor 701 and a memory 702. This computer device contains an environment that supports a canvas; for example, the canvas can be a canvas, and the environment supporting the canvas can be a browser environment. The processor 701 and the memory 702 are electrically connected.
[0194] The processor 701 is the control center of the computer device 700. It connects various parts of the computer device through various interfaces and lines. By running or loading applications stored in the memory 702 and calling data stored in the memory 702, it performs various functions of the computer device and processes data, thereby monitoring the computer device as a whole.
[0195] In this embodiment, the processor 701 in the computer device 700 loads the instructions corresponding to the processes of one or more application programs into the memory 702 according to the following steps, and the processor 701 runs the application programs / computer programs stored in the memory 702 to realize the various functions applied to the computer device, including various functions implemented in the sender and various functions implemented in the receiver.
[0196] This computer device can implement the steps of any embodiment of the file processing method provided in this application. Therefore, it can achieve the beneficial effects that any file processing method provided in this invention can achieve, as detailed in the preceding embodiments, which will not be repeated here.
[0197] Figure 10 A specific structural block diagram of a computer device provided in an embodiment of the present invention is shown. This computer device can be used to implement the file processing method provided in the above embodiments. The computer device includes the following modules / units.
[0198] RF circuit 810 is used to receive and transmit electromagnetic waves, realizing the mutual conversion between electromagnetic waves and electrical signals, thereby enabling communication with communication networks or other devices. RF circuit 810 may include various existing circuit elements used to perform these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, subscriber identity modules (SIM cards), memory, etc. RF circuit 810 can communicate with various networks such as the Internet, corporate intranets, and wireless networks, or communicate with other devices via wireless networks. The aforementioned wireless networks may include cellular telephone networks, wireless local area networks (WLANs), or metropolitan area networks (MANs). The aforementioned wireless networks may use various communication standards, protocols, and technologies, including but not limited to Global System for Mobile Communication (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (WCDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), Wireless Fidelity (Wi-Fi) (such as IEEE 802.11a, IEEE 802.11b, IEEE 802.11g, and / or IEEE 802.11n), Voice over Internet Protocol (VoIP), Worldwide Interoperability for Microwave Access (Wi-Max), other protocols for email, instant messaging, and short messages, and any other suitable communication protocols, including those that have not yet been developed.
[0199] The memory 820 can be used to store software programs (computer programs) and modules, such as the program instructions / modules corresponding to those in the above embodiments. The processor 880 executes various functional applications and data processing by running the software programs and modules stored in the memory 820. The memory 820 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 820 may further include memory remotely located relative to the processor 880, and these remote memories can be connected to the computer device 800 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0200] The input unit 830 can be used to receive input digital or character information, and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. Specifically, the input unit 830 may include a touch-sensitive surface 831 and other input devices 832. The touch-sensitive surface 831, also known as a touch display screen (touchscreen) or touchpad, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch-sensitive surface 831), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface 831 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 880, and can also receive and execute commands sent by the processor 880. In addition, the touch-sensitive surface 831 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 831, the input unit 830 may also include other input devices 832. Specifically, other input devices 832 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0201] Display unit 840 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of computer device 800. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Display unit 840 may include display panel 841, optionally configured as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or other similar forms. Further, touch-sensitive surface 831 may cover display panel 841. When touch-sensitive surface 831 detects a touch operation on or near it, it transmits the information to processor 880 to determine the type of touch event. Subsequently, processor 880 provides corresponding visual output on display panel 841 according to the type of touch event. Although in the figures, touch-sensitive surface 831 and display panel 841 are implemented as two separate components to achieve input and output functions, it is understood that touch-sensitive surface 831 and display panel 841 can be integrated to achieve input and output functions.
[0202] The computer device 800 may also include at least one sensor 850, such as a light sensor, an orientation sensor, a proximity sensor, and other sensors. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used in applications that identify the phone's posture and vibration recognition functions (such as pedometers and taps). Other sensors that the computer device 800 may also be equipped with, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0203] Audio circuitry 860, speaker 861, and microphone 862 provide an audio interface between the user and computer device 800. Audio circuitry 860 converts received audio data into electrical signals, which are then transmitted to speaker 861, where they are converted into sound signals for output. Conversely, microphone 862 collects sound signals, converts them into electrical signals, which are received by audio circuitry 860, converted back into audio data, and then processed by processor 880 before being transmitted via RF circuitry 810 to, for example, another computer device, or output to memory 820 for further processing. Audio circuitry 860 may also include an earphone jack to facilitate communication between peripheral headphones and computer device 800.
[0204] Computer device 800, through transmission module 870 (e.g., Wi-Fi module), can help users receive requests, send information, etc., providing users with wireless broadband internet access. Although transmission module 870 is shown in the figure, it is understood that it is not an essential component of computer device 800 and can be omitted as needed without changing the essence of the invention.
[0205] The processor 880 is the control center of the computer device 800. It connects to various parts of the mobile phone via various interfaces and lines. By running or executing software programs (computer programs) and / or modules stored in the memory 820, and by calling data stored in the memory 820, it performs various functions of the computer device 800 and processes data, thereby providing overall monitoring of the computer device. Optionally, the processor 880 may include one or more processing cores; in some embodiments, the processor 880 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 880.
[0206] The computer device 800 also includes a power supply 890 (such as a battery) that supplies power to various components. In some embodiments, the power supply may be logically connected to the processor 880 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. The power supply 890 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0207] Although not shown, the computer device 800 also includes cameras (such as front-facing cameras and rear-facing cameras), Bluetooth modules, etc., which will not be described in detail here. Specifically, in this embodiment, the display unit of the computer device is a touch screen display, and the computer device also includes a memory and one or more programs (computer programs). One or more programs are stored in the memory and configured to be executed by one or more processors. One or more programs include the steps for any embodiment of the file processing method provided in the above method embodiments. Therefore, the beneficial effects that any file processing method provided in the embodiments of the present invention can achieve can be realized. For details, please refer to the previous embodiments, which will not be described in detail here.
[0208] In practice, the above modules can be implemented as independent entities or combined in any way to be implemented as the same or several entities. For the specific implementation of the above modules, please refer to the previous method implementation examples, which will not be repeated here.
[0209] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by instructions (computer programs) or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. Therefore, embodiments of the present invention provide a storage medium storing multiple instructions that can be loaded by a processor to execute the steps of any embodiment of the file processing method provided by the present invention.
[0210] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0211] Since the instructions stored in the storage medium can execute the steps in any embodiment of the file processing method provided in the embodiments of the present invention, the beneficial effects that can be achieved in any embodiment of the file processing method provided in the embodiments of the present invention can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0212] The foregoing has provided a detailed description of a file processing method, apparatus, storage medium, and computer device provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A file processing method, characterized in that, include: Obtain the original file to be transferred; The original file is byte-diverted to obtain a byte array; Based on the maximum fill text data supported by the canvas, the data in the byte array is split to obtain at least one single byte array; For each single byte array in at least one single byte array, the target storage channel to be stored for each single byte array is determined according to the one-channel storage method, the two-channel storage method, and the three-channel storage method, respectively. The target storage channel corresponding to the one-channel storage method is any one of the R channel, the G channel, and the B channel; the target storage channel corresponding to the two-channel storage method is any two of the R channel, the G channel, and the B channel; and the target storage channel corresponding to the three-channel storage method is the R channel, the G channel, and the B channel. The target storage channel is written into the identifier of each single byte array, and the identifier is filled into the first pixel of the canvas; The data in each single byte array is saved sequentially to the target save channel corresponding to the other pixels of the canvas; Compression is performed using the compression methods supported by the canvas to obtain one-channel data, two-channel data, and three-channel data of each single byte array after compression. The canvas is used to display multiple pixels. The compressed data of each single byte array in the byte array, the data of the first channel, the data of the second channel, the data of the third channel, and the data with the smallest data size in each single byte array are used as the data to be encrypted corresponding to each single byte array in the byte array; The data to be encrypted corresponding to each block of byte array in the byte array is encrypted to obtain the encrypted data corresponding to each block of byte array in the original file.
2. The method according to claim 1, characterized in that, The step of splitting the data in the byte array according to the maximum fill text data supported by the canvas to obtain at least one single byte array includes: The number of blocks to be split is determined based on the maximum fill text data supported by the canvas and the size of the byte array. The maximum fill text data supported by the canvas is at least related to the displacement multiple. Based on the number of blocks, the data in the byte array is split to obtain at least one single-block byte array.
3. The method according to claim 1, characterized in that, The step of encrypting the data to be encrypted corresponding to each block of byte array in the byte array to obtain the encrypted data corresponding to each block of byte array in the original file includes: Obtain a key array, a position transformation array, and a displacement factor for encryption, wherein the position transformation array is obtained by sorting the key array; Based on the key array, the position transformation array, and the displacement multiple, the data to be encrypted corresponding to each block of byte array in the byte array is encrypted to obtain the encrypted data corresponding to each block of byte array in the original file.
4. The method according to claim 3, characterized in that, The step of encrypting the data to be encrypted corresponding to each block of byte array in the byte array according to the key array, the position transformation array, and the displacement multiple, to obtain the encrypted data corresponding to each block of byte array in the original file, includes: For each block of byte array in the byte array corresponding to the data to be encrypted, the value of each data in the key array is mapped to the corresponding row or column of the data to be encrypted according to the shift factor; Determine the position information of each data value in the position transformation array, and determine the target row or target column based on the position information and the displacement multiple; The data in the corresponding row or column of the data to be encrypted is exchanged with the data in the target row or column to obtain the encrypted data corresponding to the single byte array.
5. The method according to claim 3, characterized in that, The steps to obtain the displacement factor include: Obtain the size of the original file, the maximum number of bytes supported by the canvas, and the determined maximum number of blocks; The maximum file size to be processed is determined based on the size, the maximum number of bytes, and the maximum number of blocks, at a multiple of 1. The displacement factor is determined based on the size of the original file and the maximum size of the file to be processed.
6. The method according to claim 3, characterized in that, Obtain the key array and position transformation array, including: Obtain the plaintext of the encryption key, and encrypt the plaintext of the encryption key using a preset encryption algorithm to obtain the ciphertext of the key; The ciphertext of the key is converted into a byte array to obtain the key array; The data in the key array are sorted according to a preset order, and the array that stores the position of each data in the key array after sorting is used as the position transformation array.
7. The method according to claim 1, characterized in that, After obtaining the data to be encrypted corresponding to each block of byte array in the byte array, the method further includes: For the data to be encrypted, determine the number of bytes of blank padding data to be filled and the blank padding data to be filled; The number of blank padding bytes is filled after the data to be encrypted to obtain the padded data to be encrypted.
8. The method according to claim 7, characterized in that, For the data to be encrypted, the step of determining the number of bytes of blank padding data to be filled includes: The fixed number of rows of the canvas is determined based on the displacement factor; The minimum width of the canvas is determined based on the data to be encrypted and the fixed number of rows; The number of bytes of blank padding data to be filled is determined based on the minimum width of the canvas, the displacement factor, and the data to be encrypted.
9. The method according to claim 1, characterized in that, The method further includes: Write the file type into the identifier of each block of bytes in at least one block of bytes; and / or, After splitting the data in the byte array, the method further includes: Write the split block number into the identifier of each block byte array in at least one block byte array.
10. The method according to any one of claims 1-9, characterized in that, After obtaining the encrypted data corresponding to each block of byte array in the original file, the process also includes: The encrypted data can be exported and transmitted as an image, or written to a text file and transmitted.
11. A file processing method, characterized in that, include: Retrieve the encrypted data from the original file; The encrypted data is decrypted to obtain the decrypted data of the original file; If the decrypted data is compressed, then the decrypted data is written to the canvas for decompression to obtain the byte array corresponding to the decrypted data; The byte array is converted according to the file type to obtain the original file; The encrypted data is obtained in the following way: The original file is byte-diverted to obtain a byte array; Based on the maximum fill text data supported by the canvas, the data in the byte array is split to obtain at least one single byte array; For each single byte array in at least one single byte array, the target storage channel to be stored for each single byte array is determined according to the one-channel storage method, the two-channel storage method, and the three-channel storage method, respectively. The target storage channel corresponding to the one-channel storage method is any one of the R channel, the G channel, and the B channel; the target storage channel corresponding to the two-channel storage method is any two of the R channel, the G channel, and the B channel; and the target storage channel corresponding to the three-channel storage method is the R channel, the G channel, and the B channel. The target storage channel is written into the identifier of each single byte array, and the identifier is filled into the first pixel of the canvas; The data in each single byte array is saved sequentially to the target save channel corresponding to the other pixels of the canvas; Compression is performed using the compression methods supported by the canvas to obtain one-channel data, two-channel data, and three-channel data of each single byte array after compression. The canvas is used to display multiple pixels. The compressed data of each single byte array in the byte array, the data of the first channel, the data of the second channel, the data of the third channel, and the data with the smallest data size in each single byte array are used as the data to be encrypted corresponding to each single byte array in the byte array; The data to be encrypted corresponding to each block of byte array in the byte array is encrypted to obtain the encrypted data corresponding to each block of byte array in the original file.
12. The method according to claim 11, characterized in that, The method further includes: Obtain at least one block of encrypted data corresponding to the original file; Decrypt each block of encrypted data in at least one block of encrypted data to obtain each decrypted block of data; If the decrypted data of the corresponding block is compressed, the decrypted data of the corresponding block is written to the canvas for decompression to obtain the single-block byte array corresponding to the decrypted data of the corresponding block; If there is a block of decrypted data that has not been compressed, then the corresponding single-block byte array is determined directly based on the decrypted data of the corresponding block. Each individual byte array is concatenated in sequence to obtain the byte array; The byte array is converted according to the file type to obtain the original file.
13. The method according to claim 12, characterized in that, The step of writing the decrypted data of the corresponding block to the canvas for decompression to obtain the single-block byte array corresponding to the decrypted data of the corresponding block includes: Write the decrypted data of the corresponding block to the canvas for decompression to obtain the initial restored data corresponding to the decrypted data of the corresponding block; Remove the identifier code and / or blank padding data from the initial restored data; The target storage channel for the initial restored data is obtained from the identifier code, and the data in the target storage channel is extracted from the canvas to obtain the single-block byte array corresponding to the decrypted data of the corresponding block.
14. The method according to claim 12, characterized in that, The step of decrypting each block of encrypted data in at least one block of encrypted data to obtain each decrypted block of encrypted data includes: Obtain the displacement multiple, the inversion key array, and the inversion position transformation array, wherein the inversion position transformation array is determined based on the inversion key array; Based on the displacement multiple, the inversion key array, and the inversion position transformation array, each block of encrypted data in at least one block of encrypted data is decrypted to obtain each block of decrypted data.
15. The method according to claim 14, characterized in that, The steps to obtain the inversion key array and the inversion position transformation array include: Obtain the plaintext of the encryption key, and encrypt the plaintext of the encryption key using a preset encryption algorithm to obtain the ciphertext of the key; The ciphertext of the key is converted into a byte array to obtain the key array; The data in the key array are sorted according to a preset order, and the array that stores the position of each data in the key array after sorting is used as the position transformation array; The data in the key array and the position transformation array are reversed to obtain the reversed key array and the reversed position transformation array, respectively.
16. A document processing device, characterized in that, include: The first acquisition module is used to acquire the original file to be transmitted; The byteification module converts the original file into bytes to obtain a byte array; The compression module is used to split the data in the byte array according to the maximum fill text data supported by the canvas, so as to obtain at least one single byte array; For each single byte array in at least one single byte array, the target storage channel to be stored for each single byte array is determined according to the one-channel storage method, the two-channel storage method, and the three-channel storage method, respectively. The target storage channel corresponding to the one-channel storage method is any one of the R channel, the G channel, and the B channel; the target storage channel corresponding to the two-channel storage method is any two of the R channel, the G channel, and the B channel; and the target storage channel corresponding to the three-channel storage method is the R channel, the G channel, and the B channel. The target storage channel is written into the identifier of each single byte array, and the identifier is filled into the first pixel of the canvas; The data in each single byte array is saved sequentially to the target save channel corresponding to the other pixels of the canvas; Compression is performed using the compression methods supported by the canvas to obtain one-channel data, two-channel data, and three-channel data of each single byte array after compression. The canvas is used to display multiple pixels. The data determination module is used to take the compressed data of each single byte array in the byte array, the data of the first channel, the data of the second channel, the data of the third channel, and the data with the smallest data volume in each single byte array as the data to be encrypted corresponding to each single byte array in the byte array; The encryption module is used to encrypt the data to be encrypted corresponding to each block of byte array in the byte array, so as to obtain the encrypted data corresponding to each block of byte array in the original file.
17. A document processing device, characterized in that, include: The second acquisition module is used to acquire the encrypted data of the original file; A decryption module is used to decrypt the encrypted data to obtain the decrypted data of the original file; The decompression module is used to write the decompressed data to the canvas for decompression if the decompressed data has been compressed, so as to obtain the byte array corresponding to the decompressed data; A conversion module is used to convert the byte array according to the file type to obtain the original file; The encrypted data is obtained in the following way: The original file is byte-diverted to obtain a byte array; Based on the maximum fill text data supported by the canvas, the data in the byte array is split to obtain at least one single byte array; For each single byte array in at least one single byte array, the target storage channel to be stored for each single byte array is determined according to the one-channel storage method, the two-channel storage method, and the three-channel storage method, respectively. The target storage channel corresponding to the one-channel storage method is any one of the R channel, the G channel, and the B channel; the target storage channel corresponding to the two-channel storage method is any two of the R channel, the G channel, and the B channel; and the target storage channel corresponding to the three-channel storage method is the R channel, the G channel, and the B channel. The target storage channel is written into the identifier of each single byte array, and the identifier is filled into the first pixel of the canvas; The data in each single byte array is saved sequentially to the target save channel corresponding to the other pixels of the canvas; Compression is performed using the compression methods supported by the canvas to obtain one-channel data, two-channel data, and three-channel data of each single byte array after compression. The canvas is used to display multiple pixels. The compressed data of each single byte array in the byte array, the data of the first channel, the data of the second channel, the data of the third channel, and the data with the smallest data size in each single byte array are used as the data to be encrypted corresponding to each single byte array in the byte array; The data to be encrypted corresponding to each block of byte array in the byte array is encrypted to obtain the encrypted data corresponding to each block of byte array in the original file.
18. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the file processing method according to any one of claims 1 to 15.
19. A computer device, characterized in that, The method includes a processor and a memory, the processor being electrically connected to the memory, the memory being used to store instructions and data, and the processor being used to perform the steps of the file processing method according to any one of claims 1 to 15.