CN112818367B - File encryption method, device, storage medium and processor - Google Patents
File encryption method, device, storage medium and processor Download PDFInfo
- Publication number
- CN112818367B CN112818367B CN202110150698.5A CN202110150698A CN112818367B CN 112818367 B CN112818367 B CN 112818367B CN 202110150698 A CN202110150698 A CN 202110150698A CN 112818367 B CN112818367 B CN 112818367B
- Authority
- CN
- China
- Prior art keywords
- key value
- file
- data block
- data
- pseudorandom
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6209—Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/21—Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/2107—File encryption
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
The application discloses a file encryption method, device, storage medium and processor. The method comprises the following steps: generating a first set of pseudorandom numbers according to a first pseudorandom seed, wherein the first set of pseudorandom numbers comprises a plurality of pseudorandom numbers, each pseudorandom number being used to represent a data block size; splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks; formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content; and carrying out aggregation treatment on the plurality of target key value pairs to obtain the encrypted file. By the method and the device, the problem that the encryption processing mode of the data in the file is difficult to ensure the safe transmission of the data in the file in the related technology is solved.
Description
Technical Field
The present invention relates to the field of file data encryption, and in particular, to a method, an apparatus, a storage medium, and a processor for encrypting a file.
Background
The existing encryption technology mainly adopts a single-machine single node for encryption, and can meet the production requirement by adopting a high-performance server under the condition of smaller data volume, but along with the development and the age progress of business, the data volume required for encryption transmission is larger and larger, and the data taking TB as a unit is required to be encrypted every day, so that the file encryption transmission for ensuring the data security is required.
In addition, in the Map process of the Map Reduce framework, the data in the file needs to be split into Key Value pair formats which are easy to operate, but in the prior art, the splitting mode is to split by sequentially reading bytes, the Key is the position of a byte cursor, and the Value is the data content, so that the split data slice still contains sensitive information with part of readability, and the data safety in the file cannot be completely ensured.
Aiming at the problem that the encryption processing mode of the data in the file is difficult to ensure the safe transmission of the data in the file in the related technology, no effective solution is proposed at present.
Disclosure of Invention
The main purpose of the present application is to provide a method, an apparatus, a storage medium and a processor for encrypting a file, so as to solve the problem that the encryption processing mode of the data in the file is difficult to ensure the secure transmission of the data in the file in the related art.
In order to achieve the above object, according to one aspect of the present application, there is provided a method of encrypting a file. The method comprises the following steps: generating a first set of pseudorandom numbers according to a first pseudorandom seed, wherein the first set of pseudorandom numbers comprises a plurality of pseudorandom numbers, each pseudorandom number being used to represent a data block size; splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks; formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content; and carrying out aggregation treatment on the plurality of target key value pairs to obtain the encrypted file.
Further, formatting each data block to obtain a plurality of target key value pairs includes: obtaining a second pseudorandom number set according to the second pseudorandom seed, wherein the second pseudorandom number set consists of a plurality of key values; and formatting each data block according to each key value to obtain a plurality of target key value pairs.
Further, formatting each data block according to each key value to obtain a plurality of target key value pairs includes: randomly acquiring a key value for each data block in sequence to be combined to form an initial key value pair; and sequentially adding file codes, data sequence numbers and data block size values corresponding to the data blocks for each initial key value pair to obtain a plurality of target key value pairs.
Further, performing aggregation processing on the plurality of target key value pairs to obtain an encrypted file includes: and aggregating the target key value pairs with the same key value into a new file to obtain the encrypted file.
In order to achieve the above object, according to another aspect of the present application, there is provided an encryption apparatus for a file. The device comprises: a first generation unit configured to generate a first pseudorandom number set according to a first pseudorandom seed, where the first pseudorandom number set includes a plurality of pseudorandom numbers, each pseudorandom number being used to represent a data block size; the first splitting unit is used for splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks; the first processing unit is used for formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content; and the second processing unit is used for carrying out aggregation processing on the plurality of target key value pairs to obtain an encrypted file.
Further, the first processing unit further includes: the first acquisition module is used for obtaining a second pseudo-random number set according to a second pseudo-random seed, wherein the second pseudo-random number set consists of a plurality of key values; and the first processing module is used for carrying out formatting processing on each data block according to each key value to obtain a plurality of target key value pairs.
Further, the first processing module further includes: the first acquisition sub-module is used for randomly acquiring a key value for each data block in sequence to be combined to form an initial key value pair; and the second acquisition sub-module is used for sequentially adding file codes, data sequence numbers and data block size values corresponding to the data blocks for each initial key value pair to obtain a plurality of target key value pairs.
Further, the second processing unit further includes: and the second acquisition module is used for aggregating the target key value pairs with the same key value into a new file to obtain an encrypted file.
Through the application, the following steps are adopted: generating a first set of pseudorandom numbers by generating according to a first pseudorandom seed, wherein the first set of pseudorandom numbers comprises a plurality of pseudorandom numbers, each pseudorandom number being used to represent a data block size; splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks; formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content; and aggregating the plurality of target key value pairs to obtain an encrypted file, thereby solving the problem that the encryption processing mode of the data in the file in the related technology is difficult to ensure the safe transmission of the data in the file. The multi-node distributed parallel encryption is realized by a splitting mode of double random generation key value pairs of random data values and random read data block sizes. Thereby achieving the effect of ensuring the safe transmission of the data in the encrypted file.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application, illustrate and explain the application and are not to be construed as limiting the application. In the drawings:
FIG. 1 is a flow chart of a method of encrypting a file provided in accordance with an embodiment of the present application; and
FIG. 2 is a schematic diagram of maps in the encryption process of a file according to an embodiment of the present application; and
FIG. 3 is a schematic diagram of Reduce in the encryption process of a file according to an embodiment of the present application; and
FIG. 4 is a schematic diagram of encrypted decryption merging of files provided in accordance with an embodiment of the present application; and
fig. 5 is a schematic diagram of an encryption device for a file according to an embodiment of the present application.
Detailed Description
It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the present application described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, the following will describe some terms or terms related to the embodiments of the present application:
key-value: key is a key and value is a value; the Key-value database is a database that stores data in Key-value pairs, like the map in Java, each Key corresponds to a unique value.
Map Reduce: a Map function is specified to Map a set of key-value pairs to a new set of key-value pairs, and a concurrent Reduce function is specified to ensure that each of all mapped key-value pairs share the same key set.
According to an embodiment of the application, an encryption method of a file is provided.
Fig. 1 is a flowchart of a method of encrypting a file according to an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
step S101, generating a first pseudo-random number set according to a first pseudo-random seed, wherein the first pseudo-random number set comprises a plurality of pseudo-random numbers, each pseudo-random number being used to represent a data block size.
The first pseudorandom seed in this application refers to a pseudorandom seed of buffer block size, for example, each time data of f1, f2, f3.. The size of the batch of data is determined by a pseudorandom number, the seed of which is the pseudorandom seed of the buffer block size.
A first set of pseudorandom numbers is generated by a pseudorandom seed of the buffer block Size, e.g., a set of pseudorandom numbers DS1 may be obtained by sequential computation from the pseudorandom seed B of the buffer block Size, DS2, d 3..dsn.}, wherein the value of each random number is within the same interval, the set of pseudorandom numbers is the Data Size, i.e., the first set of pseudorandom numbers.
It should be noted that the first pseudorandom seed determines the size of the split data size in order to break up the data file that needs to be encrypted.
Step S102, splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks.
And splitting the source file by each Data block Size Data Size in the first pseudo-random set to obtain a plurality of file Data blocks with different sizes.
Step S103, formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content.
According to the method, data are split in a double random splitting mode of the size of a data block in a first pseudorandom number set by adopting a random data Key value in a second pseudorandom number set, and the data block in the first pseudorandom number set is formatted according to the first pseudorandom number set obtained by the first pseudorandom seed in the step, so that a target Key value pair format is obtained by splitting, wherein the Key value of the target Key value pair is obtained through the second pseudorandom seed.
Optionally, in the encryption method for a file provided in the embodiment of the present application, formatting each data block to obtain a plurality of target key value pairs includes: obtaining a second pseudorandom number set according to the second pseudorandom seed, wherein the second pseudorandom number set consists of a plurality of key values; and formatting each data block according to each key value to obtain a plurality of target key value pairs.
The second pseudorandom seed in this application refers to a file name pseudorandom seed. For example, during encryption, each round reads the f1, f2, f3.. Fn file in sequence, the file code fn is Source File Index, then it is written into the Key value pair of the selected Key value, and the seed of the pseudo random number is the pseudo random seed of the file name.
Specifically, the Key-value pseudorandom number set K is a second pseudorandom number set. For example, with A as the pseudo random seed of the file name, a group of pseudo random numbers { K1, k2, K3... Kn..}, key is K1 … Kn for determining n value according to file block size and data amount, wherein the value of each random number is greater than or equal to 1 and less than or equal to n, the set of pseudorandom numbers is K, i.e., the second set of pseudorandom numbers.
According to the method, random numbers respectively generated by the first pseudo-random seed and the second pseudo-random seed are selected, split data are stored in values corresponding to specific Key values each time, target Key Value pairs are obtained, formatting processing is conducted on each data block according to a plurality of Key values obtained by the second pseudo-random seed, and a plurality of target Key Value pairs are obtained.
Optionally, in the method for encrypting a file provided in the embodiment of the present application, the formatting processing is performed on each data block according to each key value, and obtaining a plurality of target key value pairs includes: randomly acquiring a key value for each data block in sequence to be combined to form an initial key value pair; and sequentially adding file codes, data sequence numbers and data block size values corresponding to the data blocks for each initial key value pair to obtain a plurality of target key value pairs.
And combining each data block according to the Key value in the second pseudo-random number set to obtain a plurality of initial Key value pairs (Key-value).
Specifically, the Key value is generated by a second pseudo-random seed, that is, the second pseudo-random set K obtained in the above step is formed.
The Value contains four parts: source File Index source file id generated according to the source file sequence number; and the Data Index Data sequence number generated by the first pseudo-random seed, namely the sequence of the first random number generation; the Data Size Data block is used for recording and checking whether the content of the Data block is missing or not; and Data content obtained from the source file according to the first pseudorandom number set Data Size.
As shown in fig. 2, in the Map stage of the Map Reduce technology framework of the present application, a plurality of target Key Value pairs are obtained based on the Key Value and the Value according to the initial Key Value pair (Key-Value). For example, original files F1, F2, F3, F4, and F5 are sequentially read, and the Key value sets are K1, K2, and K3. According to the random numbers respectively generated by the first pseudo-random seed and the second pseudo-random seed, the data obtained by splitting the source file data each time is selected and stored into the Value corresponding to the specific Key Value, namely the Value corresponding to K1 comprises the data information of F1, F3 and F5, the Value corresponding to K2 comprises the data information of F2, F4 and F4, and the Value corresponding to K3 comprises the data information of F1, F2, F3 and F5.
Step S104, aggregation processing is carried out on the plurality of target key value pairs, and an encrypted file is obtained.
All original data are split in a pseudo-random seed mode to obtain a plurality of target key value pair formats, and the plurality of target key value pairs are aggregated to obtain an encrypted file.
Optionally, in the method for encrypting a file provided in the embodiment of the present application, performing aggregation processing on a plurality of target key value pairs, to obtain an encrypted file includes: and aggregating the target key value pairs with the same key value into a new file to obtain the encrypted file.
Specifically, as shown in fig. 3, in the Reduce stage of the Map Reduce technical framework of the present application, target Key value pairs after all original data in fig. 2 are split are subjected to Reduce aggregation according to Key values, each Key generates an output file, and after this stage, the sequence of data files is completely disturbed and encrypted files are obtained, so that the purpose of doing so is to achieve an encryption effect, and meanwhile, the encryption efficiency is greatly improved.
In summary, steps S101 to S104, the present application adopts a dual random splitting manner of random data Key Value and random read data block size, and combines with Map Reduce framework to form a distributed encryption transmission system, thereby implementing multi-node distributed parallel encryption, greatly improving encryption and decryption efficiency, and playing an encryption role by taking Value content after splitting original data as disordered scrambling code. Even if a single ciphertext block is intercepted, the original content cannot be identified, and all small file contents are acquired according to the splitting sequence and decrypted to recover the original file, so that the data is not afraid of being intercepted in the transmission process, and the safety of data encryption transmission is greatly improved.
It should be noted that the decryption process is similar to the encryption process, and the Map Reduce technical framework is also adopted.
As shown in fig. 4, a schematic diagram of decryption merging under the Map Reduce technology framework, an output file is found according to the second pseudo-random number set K and Source File Index of the source Data, the Data original sequence is ordered according to the Data Index Data sequence number generated by the first pseudo-random seed, the Data Size is read and the Data content is checked, then the Data content is combined in the Reduce stage, and the output file is written in parallel, so that a decrypted file is obtained.
In summary, in the file encryption method provided by the embodiment of the present application, a first pseudorandom number set is generated according to a first pseudorandom seed, where the first pseudorandom number set includes a plurality of pseudorandom numbers, and each pseudorandom number is used to represent a data block size; splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks; formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content; and carrying out aggregation treatment on the plurality of target key value pairs to obtain the encrypted file. The method solves the problem that the encryption processing mode of the data in the file is difficult to ensure the safe transmission of the data in the file in the related technology. The multi-node distributed parallel encryption is realized by a splitting mode of double random generation key value pairs of random data values and random read data block sizes. Thereby achieving the effect of ensuring the safe transmission of the data in the encrypted file.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
The embodiment of the application also provides a file encryption device, and it should be noted that the file encryption device of the embodiment of the application can be used for executing the encryption method for files provided by the embodiment of the application. The following describes an encryption device for a file provided in an embodiment of the present application.
Fig. 5 is a schematic diagram of an encryption device for files according to an embodiment of the present application. As shown in fig. 5, the apparatus includes: a first generating unit 501, a first splitting unit 502, a first processing unit 503, and a second processing unit 504.
Specifically, the first generating unit 501 is configured to generate a first pseudo random number set according to a first pseudo random seed, where the first pseudo random number set includes a plurality of pseudo random numbers, and each pseudo random number is used to represent a data block size;
a first splitting unit 502, configured to split the file to be encrypted according to each pseudo random number in the first pseudo random number set in turn, so as to obtain a plurality of data blocks;
a first processing unit 503, configured to perform formatting processing on each data block to obtain a plurality of target key value pairs, where each target key value pair includes a corresponding data block content;
and the second processing unit 504 is configured to aggregate the plurality of target key value pairs to obtain an encrypted file.
In summary, in the file encryption device provided in the embodiment of the present application, a first generating unit 501 generates a first pseudorandom number set according to a first pseudorandom seed, where the first pseudorandom number set includes a plurality of pseudorandom numbers, and each pseudorandom number is used to represent a size of a data block; the first splitting unit 502 splits the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks; the first processing unit 503 performs formatting processing on each data block to obtain a plurality of target key value pairs, where each target key value pair includes a corresponding data block content; the second processing unit 504 performs aggregation processing on the plurality of target key value pairs to obtain an encrypted file. The method solves the problem that the encryption processing mode of the data in the file is difficult to ensure the safe transmission of the data in the file in the related technology. The multi-node distributed parallel encryption is realized by a splitting mode of double random generation key value pairs of random data values and random read data block sizes. Thereby achieving the effect of ensuring the safe transmission of the data in the encrypted file.
Optionally, in the encryption device for a file provided in the embodiment of the present application, the first processing unit 503 further includes: the first acquisition module is used for obtaining a second pseudo-random number set according to a second pseudo-random seed, wherein the second pseudo-random number set consists of a plurality of key values; and the first processing module is used for carrying out formatting processing on each data block according to each key value to obtain a plurality of target key value pairs.
Optionally, in the encryption device for a file provided in the embodiment of the present application, the first processing module further includes: the first acquisition sub-module is used for randomly acquiring a key value for each data block in sequence to be combined to form an initial key value pair; and the second acquisition sub-module is used for sequentially adding file codes, data sequence numbers and data block size values corresponding to the data blocks for each initial key value pair to obtain a plurality of target key value pairs.
Optionally, in the encryption device for a file provided in the embodiment of the present application, the second processing unit 504 further includes: and the second acquisition module is used for aggregating the target key value pairs with the same key value into a new file to obtain an encrypted file.
The encryption device for files includes a processor and a memory, where the first generating unit 501, the first splitting unit 502, the first processing unit 503, the second processing unit 504, and the like are stored as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may be provided with one or more kernel parameters for encrypting the file.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The embodiment of the invention provides a storage medium, on which a program is stored, which when executed by a processor, implements a method of encrypting a file.
The embodiment of the invention provides a processor, which is used for running a program, wherein the encryption method of an execution file is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program stored in the memory and capable of running on the processor, wherein the processor realizes the following steps when executing the program: generating a first set of pseudorandom numbers according to a first pseudorandom seed, wherein the first set of pseudorandom numbers comprises a plurality of pseudorandom numbers, each pseudorandom number being used to represent a data block size; splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks; formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content; and carrying out aggregation treatment on the plurality of target key value pairs to obtain the encrypted file.
The processor also realizes the following steps when executing the program: obtaining a second pseudorandom number set according to the second pseudorandom seed, wherein the second pseudorandom number set consists of a plurality of key values; and formatting each data block according to each key value to obtain a plurality of target key value pairs.
The processor also realizes the following steps when executing the program: randomly acquiring a key value for each data block in sequence to be combined to form an initial key value pair; and sequentially adding file codes, data sequence numbers and data block size values corresponding to the data blocks for each initial key value pair to obtain a plurality of target key value pairs.
The processor also realizes the following steps when executing the program: and aggregating the target key value pairs with the same key value into a new file to obtain the encrypted file.
The device herein may be a server, PC, PAD, cell phone, etc.
The present application also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: generating a first set of pseudorandom numbers according to a first pseudorandom seed, wherein the first set of pseudorandom numbers comprises a plurality of pseudorandom numbers, each pseudorandom number being used to represent a data block size; splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks; formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content; and carrying out aggregation treatment on the plurality of target key value pairs to obtain the encrypted file.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: obtaining a second pseudorandom number set according to the second pseudorandom seed, wherein the second pseudorandom number set consists of a plurality of key values; and formatting each data block according to each key value to obtain a plurality of target key value pairs.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: randomly acquiring a key value for each data block in sequence to be combined to form an initial key value pair; and sequentially adding file codes, data sequence numbers and data block size values corresponding to the data blocks for each initial key value pair to obtain a plurality of target key value pairs.
When executed on a data processing device, is further adapted to carry out a program initialized with the method steps of: and aggregating the target key value pairs with the same key value into a new file to obtain the encrypted file.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.
Claims (8)
1. A method of encrypting a file, the method comprising:
generating a first set of pseudorandom numbers according to a first pseudorandom seed, wherein the first set of pseudorandom numbers comprises a plurality of pseudorandom numbers, each pseudorandom number being used to represent a data block size;
splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks;
formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content;
performing aggregation treatment on the plurality of target key value pairs to obtain an encrypted file;
formatting each data block to obtain a plurality of target key value pairs, wherein the method comprises the following steps:
obtaining a second pseudo-random number set according to a second pseudo-random seed, wherein the second pseudo-random number set consists of a plurality of key values;
and formatting each data block according to each key value to obtain a plurality of target key value pairs.
2. The method of claim 1, wherein formatting each data block according to each key value to obtain a plurality of target key value pairs comprises:
randomly acquiring a key value for each data block in sequence to be combined to form an initial key value pair;
and sequentially adding file codes, data sequence numbers and data block size values corresponding to the data blocks for each initial key value pair to obtain a plurality of target key value pairs.
3. The method of claim 1, wherein aggregating the plurality of target key-value pairs to obtain an encrypted file comprises:
and aggregating the target key value pairs with the same key value into a new file to obtain the encrypted file.
4. An encryption device for a document, the device comprising:
a first generation unit configured to generate a first pseudorandom number set according to a first pseudorandom seed, where the first pseudorandom number set includes a plurality of pseudorandom numbers, each pseudorandom number being used to represent a data block size;
the first splitting unit is used for splitting the file to be encrypted according to each pseudo random number in the first pseudo random number set in sequence to obtain a plurality of data blocks;
the first processing unit is used for formatting each data block to obtain a plurality of target key value pairs, wherein each target key value pair comprises corresponding data block content;
the second processing unit is used for carrying out aggregation processing on the plurality of target key value pairs to obtain an encrypted file;
wherein the first processing unit further comprises:
the first acquisition module is used for obtaining a second pseudo-random number set according to a second pseudo-random seed, wherein the second pseudo-random number set consists of a plurality of key values;
and the first processing module is used for carrying out formatting processing on each data block according to each key value to obtain a plurality of target key value pairs.
5. The apparatus of claim 4, wherein the first processing module further comprises:
the first acquisition sub-module is used for randomly acquiring a key value for each data block in sequence to be combined to form an initial key value pair;
and the second acquisition sub-module is used for sequentially adding file codes, data sequence numbers and data block size values corresponding to the data blocks for each initial key value pair to obtain a plurality of target key value pairs.
6. The apparatus of claim 4, wherein the second processing unit further comprises:
and the second acquisition module is used for aggregating the target key value pairs with the same key value into a new file to obtain the encrypted file.
7. A processor for running a program, wherein the program when run performs the method of any one of claims 1 to 3.
8. A storage medium comprising a stored program, wherein the program performs the method of any one of claims 1 to 3.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110150698.5A CN112818367B (en) | 2021-02-03 | 2021-02-03 | File encryption method, device, storage medium and processor |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110150698.5A CN112818367B (en) | 2021-02-03 | 2021-02-03 | File encryption method, device, storage medium and processor |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN112818367A CN112818367A (en) | 2021-05-18 |
| CN112818367B true CN112818367B (en) | 2024-03-26 |
Family
ID=75861104
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110150698.5A Active CN112818367B (en) | 2021-02-03 | 2021-02-03 | File encryption method, device, storage medium and processor |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112818367B (en) |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101110944A (en) * | 2007-08-31 | 2008-01-23 | 湖北科创高新网络视频股份有限公司 | Method and apparatus for encrypting video data |
| WO2008114829A1 (en) * | 2007-03-19 | 2008-09-25 | Tokyo Denki University | Encryption device, decryption device, encryption program, decryption program, and recording medium |
| CN102687457A (en) * | 2009-05-15 | 2012-09-19 | 里维尔技术有限责任公司 | System for encrypting and decrypting a plaintext message with authentication |
| CN111368316A (en) * | 2020-03-02 | 2020-07-03 | 中国邮政储蓄银行股份有限公司 | File encryption and decryption method and device |
-
2021
- 2021-02-03 CN CN202110150698.5A patent/CN112818367B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2008114829A1 (en) * | 2007-03-19 | 2008-09-25 | Tokyo Denki University | Encryption device, decryption device, encryption program, decryption program, and recording medium |
| CN101110944A (en) * | 2007-08-31 | 2008-01-23 | 湖北科创高新网络视频股份有限公司 | Method and apparatus for encrypting video data |
| CN102687457A (en) * | 2009-05-15 | 2012-09-19 | 里维尔技术有限责任公司 | System for encrypting and decrypting a plaintext message with authentication |
| CN111368316A (en) * | 2020-03-02 | 2020-07-03 | 中国邮政储蓄银行股份有限公司 | File encryption and decryption method and device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112818367A (en) | 2021-05-18 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3794487B1 (en) | Obfuscation and deletion of personal data in a loosely-coupled distributed system | |
| CN113079200A (en) | Data processing method, device and system | |
| CN106649788B (en) | Database data transmission method and device | |
| EP4475026A2 (en) | Traceable key block-chain ledger | |
| CN115129716A (en) | A data management method, device and storage medium for industrial big data | |
| CN110362547B (en) | Method and device for encoding, analyzing and storing log file | |
| CN112434326B (en) | Trusted computing method and device based on data flow | |
| CN106844288B (en) | Random character string generation method and device | |
| US11907379B2 (en) | Creating a secure searchable path by hashing each component of the path | |
| CN114995949B (en) | Container mirror image construction method and device | |
| CN111935211A (en) | Method, equipment and medium for improving main chain performance by adopting side chain based on block chain | |
| JP6410932B2 (en) | Embedded cloud analytics | |
| US20180218650A1 (en) | Secret computation apparatus, method for the same, and program | |
| CN113297611A (en) | Data processing method, data encryption storage method, data reading method, data processing equipment, data encryption storage equipment, data reading equipment and storage medium | |
| US20140258720A1 (en) | Systems and methods for transparent per-file encryption and decryption via metadata identification | |
| CN118350042A (en) | Random noise-based data privacy protection method, device and medium | |
| US11222036B1 (en) | Data warehouse access reporting | |
| CN112818367B (en) | File encryption method, device, storage medium and processor | |
| CN110888972A (en) | Sensitive content identification method and device based on Spark Streaming | |
| CN113572611B (en) | Key processing method and device and electronic device | |
| CN117725560A (en) | Data processing method and device, storage medium and electronic equipment | |
| CN114676112A (en) | Data synchronization method and storage medium | |
| Rao et al. | A new tool for detecting tampering of big data programs | |
| CN110851305A (en) | Backup storage method and device for science and technology project files | |
| CN116361239B (en) | Object identification synchronization method and device based on object characteristics and electronic equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |