File decryption method and device, electronic equipment and computer readable storage medium
By sharding the original document of log decryption and processing it in multiple threads, the problem of low polling decryption efficiency in the prior art is solved, and a more efficient decryption process and a better user experience is achieved.
Patent Information
- Application Number
- CN202411557583.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-03-11
AI Technical Summary
The existing log decryption technology is inefficient and has poor user experience, mainly because the polling decryption method consumes a lot of time.
By sharding the original decrypted document and decrypting it in concurrently with multiple threads, the decrypted shard file is finally fragmented to obtain the decrypted file.
Compared with polling and decryption, the decryption time is greatly reduced, the decryption efficiency is improved, and the user experience is improved.
Smart Images

Figure CN119598502A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of front-end data processing, and in particular to a file decryption method, device, electronic device and computer-readable storage medium. Background Art
[0002] Log decryption, also known as log desensitization, refers to hiding or replacing sensitive information in logs during the log recording process to prevent the leakage of sensitive data.
[0003] The existing log decryption technology first establishes the corresponding decryption rules, and then polls the decrypted files for decryption. This line-by-line decryption consumes a lot of time, is extremely inefficient, and provides a poor user experience. Summary of the invention
[0004] The purpose of the present invention is to provide a file decryption method, device, electronic device and computer-readable storage medium. First, the original decrypted document is segmented, and the segmented documents are decrypted concurrently by multiple threads. The decrypted segmented files are fragmented and integrated to obtain a decrypted file. Compared with polling decryption, the decryption time is greatly reduced, the decryption efficiency is improved, and the user experience is enhanced.
[0005] In a first aspect, the present invention provides a file decryption method, comprising:
[0006] Get the decrypted original file;
[0007] The decrypted original file is fragmented to obtain multiple decrypted fragmented files;
[0008] Decryption processing is performed on the decrypted shard files based on a preset regular rule to obtain a plurality of decrypted shard files; wherein the decryption processing includes at least one decryption thread; the number of decryption threads is determined based on the performance of a hardware device that performs the decryption processing; the performance of the hardware device includes at least one of the following: CPU usage and memory usage;
[0009] Merge multiple decrypted fragment files to obtain a decrypted file.
[0010] In some preferred embodiments of the present invention, the step of decrypting the decrypted segmented files based on a preset regular rule to obtain a plurality of decrypted segmented files includes:
[0011] Get the target number of decryption threads;
[0012] After starting the target number of decryption threads, set the performance of the hardware device to the target occupancy rate;
[0013] If the target occupancy rate is less than or equal to the preset baseline occupancy rate;
[0014] Decryption processing is performed on the decrypted slice files to obtain multiple decrypted slice files; wherein the decryption processing process includes: a target number of parallel decryption threads.
[0015] In some preferred embodiments of the present invention, the method further comprises: if the target occupancy rate is greater than a preset reference occupancy rate;
[0016] The target quantity is adjusted until the target occupancy is less than or equal to the preset baseline occupancy.
[0017] In some preferred embodiments of the present invention, the step of decrypting the decrypted segmented files based on a preset regular rule to obtain a plurality of decrypted segmented files includes:
[0018] Get the target storage location of the regular rule;
[0019] Call regular rules based on the target storage location;
[0020] Decrypt the decrypted shard files based on regular rules.
[0021] In some preferred embodiments of the present invention, the step of merging a plurality of decrypted fragment files to obtain a decrypted file includes:
[0022] Merge the decrypted fragment files based on the order of the decrypted fragment files to obtain a decrypted file;
[0023] Store the decrypted files in the preset file storage location.
[0024] In some preferred embodiments of the present invention, the method further comprises:
[0025] Get decryption rules;
[0026] The decryption rules are converted into regular rules based on the preset regular conversion model.
[0027] In some preferred embodiments of the present invention, the decrypted original file includes at least one of the following: a text file, an archive file, a compressed file, and an archive compressed file.
[0028] In a second aspect, the present invention provides a file decryption device, comprising:
[0029] A decrypted original file acquisition module is used to acquire the decrypted original file;
[0030] A file slicing module is used to slice the decrypted original file into multiple decrypted slice files;
[0031] The file decryption module is used to decrypt the decrypted segmented files based on a preset regular rule to obtain a plurality of decrypted segmented files; wherein the decryption process includes at least one decryption thread; the number of decryption threads is determined based on the performance of the hardware device executing the process; the performance of the hardware device includes at least one of the following: CPU usage and memory usage;
[0032] The decryption determination module is used to merge multiple decrypted fragment files to obtain a decrypted file.
[0033] In a third aspect, the present invention provides an electronic device including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the file decryption method of the first aspect.
[0034] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the file decryption method of the first aspect.
[0035] The present invention brings the following beneficial effects:
[0036] The present invention provides a file decryption method, device, electronic device and computer-readable storage medium, which include: obtaining a decrypted original file; fragmenting the decrypted original file to obtain a plurality of decrypted fragment files; decrypting the decrypted fragment files based on a preset regular rule to obtain a plurality of decrypted fragment files; wherein the decryption process includes at least one decryption thread; the number of decryption threads is determined based on the performance of a hardware device that executes the decryption process; the performance of the hardware device includes at least one of the following: CPU usage and memory usage; merging a plurality of decrypted fragment files to obtain a decrypted file; firstly fragmenting the decrypted original document, concurrently decrypting the fragmented document with multiple threads, and integrating the fragments of the decrypted fragment files to obtain a decrypted file, which greatly reduces the decryption time, improves the decryption efficiency and enhances the user experience compared with polling decryption. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 A flowchart of a file decryption method provided by an embodiment of the present invention;
[0039] Figure 2 A flow chart of the file decryption principle provided by an embodiment of the present invention;
[0040] Figure 3 A schematic diagram of the structure of a file decryption device provided by an embodiment of the present invention;
[0041] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0042] Icons: 310 - decrypted original file acquisition module; 320 - file segmentation module; 330 - file decryption module; 340 - decryption determination module; 400 - memory; 401 - processor; 402 - bus; 403 - communication interface. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0044] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0046] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, or the positions or positional relationships in which the product of the invention is usually placed when in use. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific position, be constructed and operated in a specific position, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0047] In addition, the terms "horizontal", "vertical", "overhanging" and the like do not mean that the components are required to be absolutely horizontal or overhanging, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", and does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0048] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0049] Log decryption, also known as log desensitization, refers to hiding or replacing sensitive information in the log during the log recording process to prevent the leakage of sensitive data. This process is of great significance for protecting user privacy, corporate secrets, and complying with relevant laws and regulations. It is specifically reflected in the following points:
[0050] (1) Protecting User Privacy
[0051] The logs may contain users' personal information, such as ID number, bank card number, mobile phone number, etc. Once this information is leaked, it will seriously infringe on users' privacy.
[0052] (2) Protecting corporate secrets
[0053] Corporate logs may contain sensitive information such as business secrets and technical details, which are crucial to the competitiveness of the company. Once leaked, it will cause huge losses to the company.
[0054] (3) Comply with laws and regulations
[0055] As data protection laws and regulations continue to improve, companies need to desensitize sensitive data in logs to comply with relevant laws and regulations and avoid legal risks.
[0056] Existing log decryption technologies can be roughly divided into two types: real-time decryption and post-decryption. Real-time decryption refers to directly replacing or encrypting the corresponding sensitive information with relevant technologies when the log is output; post-decryption refers to taking relevant technical means to process the relevant sensitive information before the log is transmitted. The technology used basically uses regular expressions to match sensitive information. The decryption steps usually include the following:
[0057] (1) Define desensitization rules: Define desensitization rules based on actual needs, including the type of sensitive information to be matched and the desensitization method (such as replacing it with "*" or specific characters).
[0058] (2) Write desensitization logic: Write the corresponding desensitization logic according to the desensitization rules, usually by matching sensitive information through regular expressions and replacing them.
[0059] (3) Integrated desensitization logic: Integrate desensitization logic into the log recording process to ensure that sensitive information can be automatically desensitized when logging. Ensure that the desensitization effect meets expectations and does not affect the normal recording of logs.
[0060] With regard to the above decryption steps and existing decryption technologies, it is not difficult to see that the current decryption basically first establishes corresponding decryption rules, and then performs polling decryption on the decrypted files. The writing of decryption rules consumes a lot of time, and decrypting files line by line also consumes a lot of time, which is extremely inefficient.
[0061] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0062] Embodiment 1
[0063] The embodiment of the present invention provides a method for decrypting a file. Figure 1 The flowchart of a file decryption method provided by an embodiment of the present invention is shown, and the method includes:
[0064] Step S102, obtaining the decrypted original file.
[0065] Specifically, before the decryption process begins, the original files that need to be decrypted must be identified and obtained. These files may exist in different forms and formats, such as text files, PDFs, pictures, or database records. Users select the files to be decrypted through the decryption system interface, or directly specify the file path through automated scripts and programs.
[0066] Step S104, fragmenting the decrypted original file to obtain a plurality of decrypted fragment files.
[0067] Specifically, in order to improve processing efficiency and parallel processing capabilities, this step divides large files into multiple smaller, more manageable parts, also known as "shards". This process is usually based on the size of the file or specific data boundaries. Each shard can be decrypted independently, so that it can be processed in parallel in a multi-threaded environment, significantly improving the overall processing speed.
[0068] In some preferred embodiments of the present invention, a cryptographically secure hash function (such as SHA-256) is used to ensure the uniqueness and integrity of each shard. By hashing the content of each shard, any data tampering during transmission or processing can be detected. The original file is encrypted before sharding to ensure that even if the shard is obtained by a third party, the data content cannot be directly accessed.
[0069] Verify data consistency by comparing hash values before and after sharding. Each shard should have a corresponding hash value before and after processing, and any mismatch indicates that the data may have been corrupted or tampered with. Use digital signature technology to generate signatures for each shard. These signatures should be created by a trusted source using a private key and can be verified by a public key. This helps ensure the origin and integrity of the shard.
[0070] Use secure protocols such as HTTPS or FTPS when transmitting segments. These protocols can provide encryption and data integrity protection to prevent data leakage or modification during transmission. Consider using VPN or other secure network channels to further enhance the security of data transmission.
[0071] Ensure that only authorized systems and users can access and process these shards. This can be achieved by implementing strict access control lists (ACLs) and using strong authentication mechanisms. Record all operations on shards, including access, modification, and transfer, for post-audit and problem tracking.
[0072] Introducing error correction codes, such as Reed-Solomon coding, into the sharding scheme can repair the loss of the entire file if a certain number of shards are damaged. Create copies of the shards and store them in different locations to prevent data loss caused by a single point of failure.
[0073] Before the final merging of the shards, the integrity and validity of each shard is verified again. This ensures that the merge is only performed if all shards have not been tampered with. During the merge process, the hash list mentioned above can be used for a final data integrity check to ensure that the output file is exactly as expected.
[0074] Through the above measures, the security of sharding operations and the integrity of data can be ensured to the greatest extent, thereby maintaining data consistency and security throughout the decryption process.
[0075] Step S106, decrypting the decrypted shard files based on preset regular rules to obtain multiple decrypted shard files; wherein the decryption process includes at least one decryption thread; the number of decryption threads is determined based on the performance of the hardware device that executes the decryption process; the performance of the hardware device includes at least one of the following: CPU usage and memory usage.
[0076] Specifically, each shard file will be scanned and processed according to a series of pre-set regular rules. These rules define how to identify sensitive information (such as personal identification information, financial information, etc.) and the decryption operations that should be performed (such as replacement, deletion, encryption). During the processing, each decryption thread runs independently, and the number of threads is dynamically adjusted according to hardware performance to achieve optimal processing efficiency. At the same time, the system needs to be able to monitor and optimize resource usage, such as CPU usage and memory usage, to ensure that the decryption task does not reduce efficiency due to resource competition.
[0077] Step S108, merging multiple decrypted fragment files to obtain a decrypted file.
[0078] Specifically, after all the fragmented files have been decrypted, they need to be reassembled into a complete file. This merging process needs to ensure the integrity and consistency of the files to avoid introducing errors or data loss during the merging process. After the merging is completed, the decrypted file should maintain the same format as the original file, but all sensitive information has been properly processed and no longer retains its original recognizable form.
[0079] The present invention provides a file decryption method, which comprises: obtaining a decrypted original file; fragmenting the decrypted original file to obtain a plurality of decrypted fragment files; decrypting the decrypted fragment files based on a preset regular rule to obtain a plurality of decrypted fragment files; wherein the decryption process includes at least one decryption thread; the number of decryption threads is determined based on the performance of a hardware device that executes the decryption process; the performance of the hardware device includes at least one of the following: CPU usage and memory usage; merging a plurality of decrypted fragment files to obtain a decrypted file; firstly fragmenting the decrypted original document, concurrently decrypting the fragmented document with multiple threads, and integrating the fragments of the decrypted fragment files to obtain a decrypted file, which greatly reduces the decryption time, improves the decryption efficiency, and enhances the user experience compared with polling decryption.
[0080] Embodiment 2
[0081] Based on the above embodiment, the present invention provides another file decryption method. Figure 2 The embodiment of the present invention provides a flow chart of the file decryption principle. The overall log file decryption architecture includes: a decryption rule set module, a decryption file set module, a decryption configuration module, a rule generation module, a file processing module, and a file output module, etc., as follows:
[0082] The decryption rule set module collects information related to the input rules based on the decryption rule information input by the user, making prerequisite preparations for rule conversion.
[0083] Decrypted file set: Decrypted file set collects decrypted files uploaded by users (including text files, .tar files, .gz files, and .tar.gz files), and collects basic file information to prepare for file segmentation.
[0084] Configuration information module: The configuration information module mainly provides basic functional information such as built-in regular rules, decrypted file storage location, and number of concurrent threads used, so that users can flexibly configure according to the current environment during use; at the same time, if the default configuration information is used, the system will perform file processing operations based on the maximum performance of the operating environment.
[0085] The rule generation module is based on the decryption rules. It uses the conversion rules to convert the decryption rules into regular expressions that can be recognized by js, and stores them in the corresponding mapping library to prepare for the decryption sharding using js regular expressions.
[0086] The file processing module uses a file processor to classify the decrypted file set, collects the corresponding information of the decrypted file, and then divides the decrypted file into appropriate-size fragments through a fragmenter to form a corresponding file fragment set and establish a corresponding mapping relationship; according to the corresponding rules in the rule generation module and the corresponding concurrent configuration information, the decryptor is used to decrypt the fragmented files.
[0087] The file output module is based on the decrypted fragment set obtained after the file processing module. According to the mapping relationship between the fragment information and the original decrypted file information, the file output module merges the corresponding decrypted fragment set through the file merger, converts it into the same file format as the source file, and then outputs the decrypted file to the specified directory according to the storage location information to complete the decryption of the corresponding file.
[0088] Furthermore, the user inputs the corresponding decrypted file and modifies the corresponding decryption rules and configuration module information, or the system default is adopted; according to the user input information, the decryption rules are automatically converted into the corresponding js regular rules by the decryption converter, and the corresponding decrypted file is processed. The decrypted file will automatically pass through the file processor and the fragmenter to automatically perform relevant processing on the corresponding file, and then according to the processing of the decryptor, the corresponding decrypted file fragmentation information is formed, and then converted into the corresponding decrypted file by the file merger. This process is automatically performed by the framework and does not require user interference; the decrypted file processed by the file merger is converted into the corresponding decrypted file format and output to the specified directory after the storage configuration information.
[0089] Based on the file decryption method provided in the above embodiment, further, in some preferred embodiments of the present invention, the steps of decrypting the decrypted fragmented files based on preset regular rules to obtain multiple decrypted fragmented files include the following steps A1 to A5:
[0090] Step A1, obtaining the target number of decryption threads.
[0091] Specifically, the system first determines the target number of decryption threads that need to be started. This number is usually based on several factors: the capabilities of the hardware (such as the number of CPU cores, memory size), the current system load, and the predetermined performance goals. For example, if the goal is to maximize efficiency without overloading the system, a number equal to or slightly higher than the number of CPU cores may be selected as a starting point. In some preferred embodiments of the present invention, the target number can be directly input by the user.
[0092] Step A2, after starting the target number of decryption threads, the performance of the hardware device is set to the target occupancy rate.
[0093] Step A3: if the target occupancy rate is less than or equal to the preset reference occupancy rate.
[0094] Specifically, after determining the number of threads, the system will try to achieve an ideal hardware resource utilization, called "baseline occupancy". This involves monitoring CPU and memory usage to ensure that these resources remain in an ideal operating state during processing. For example, if the baseline occupancy is set to 80%, the system will adjust the number of active threads to adjust the target occupancy to ensure that the overall resource target occupancy is close to the baseline occupancy, thereby avoiding excessive resource consumption that may cause system delays or failures.
[0095] Step A4, decrypting the decrypted slice files to obtain a plurality of decrypted slice files; wherein the decryption process includes: a target number of parallel decryption threads.
[0096] Specifically, each activated decryption thread begins to independently process the decrypted shard files assigned to it. These processes are performed according to pre-set regular rules, which may include identifying sensitive information and performing replacement operations. Because it is a multi-threaded operation, this step can significantly increase the processing speed, especially in multi-core processor systems.
[0097] Step A5: If the target occupancy rate is greater than the preset benchmark occupancy rate, adjust the target quantity until the target occupancy rate is less than or equal to the preset benchmark occupancy rate.
[0098] Specifically, if the monitored target occupancy rate exceeds the preset baseline occupancy rate, the system will automatically adjust the number of active decryption threads and reduce the number of threads working simultaneously to reduce resource consumption until it returns to the ideal performance range. This can be achieved by temporarily suspending some threads or reallocating tasks to ensure that the system runs stably without being overloaded.
[0099] By adjusting the parallel threads, the system can dynamically adjust resource usage, optimize the performance and efficiency of the decryption process, and protect the hardware from excessive load. This approach not only improves the speed of data processing, but also ensures the security and reliability of the processing process.
[0100] It should be emphasized that the method for adjusting the target quantity provided in the endocrine embodiment can be adjusted before decryption or during the decryption process.
[0101] Furthermore, in some preferred embodiments of the present invention, the step of decrypting the decrypted segmented files based on a preset regular rule to obtain a plurality of decrypted segmented files includes the following steps B1 to B3:
[0102] Step B1, obtaining the target storage location of the regular rule.
[0103] Specifically, the system first determines the location where the regular rules are stored. These rules are usually stored in pre-set files or databases for easy management and call. Regular rules define how to identify and process sensitive information in files, and they are the core of the decryption operation. The storage location should be quickly accessible to ensure that these rules can be efficiently read and applied during the processing process.
[0104] In some preferred embodiments of the present invention, the method further includes: obtaining a decryption rule; and converting the decryption rule into a regular rule based on a preset regular conversion model.
[0105] Specifically, declassification rules define how to identify and handle sensitive information in files. These rules may include specific types of information that need to be declassified (such as personal identification information, financial data, etc.), as well as the actions that should be performed (such as replacement, deletion, or encryption). The process of obtaining these rules usually involves selecting rules from a preset rule set that are suitable for the current file and purpose, or customizing these rules based on specific business needs and legal requirements. Rules can be set by security experts or directly entered by users before declassification. Correct and updated declassification rules are key to ensuring the effectiveness and compliance of the declassification process.
[0106] After obtaining the decryption rules, the next step is to convert these rules into a format that can be understood and executed by a computer program, usually a regular expression. This step uses a preset regular conversion model that defines how to convert standard decryption instructions into corresponding regular expressions. For example, if the decryption rule specifies that all occurrences of social security numbers need to be hidden, the conversion model will generate a regular expression that is used to identify patterns that conform to the social security number format and instruct the program how to process them (such as replacing them with "[REDACTED]"). This conversion process needs to accurately preserve the intent and details of the decryption rules, while ensuring that the generated regular expressions are highly accurate and efficient to avoid false matches or missed matches.
[0107] In some preferred embodiments of the present invention, the regular rules may also be directly input by the user.
[0108] Exemplarily, after the user inputs the decryption rule, it is converted into a Js regular expression through the conversion rule and stored in the Db library. During decryption, the configuration library points to the address of the Db library and extracts the Js regular expression. The decrypted file includes the original file to be decrypted. After passing through the file processor and the sharding device, it is processed by sharding. The sharding rule can also be automatically set according to the thread configuration. The file shard set after sharding includes multiple decrypted file shards, which are decrypted based on the Js regular expression. The specific decryption process is carried out in the decryptor to obtain a decrypted shard set containing multiple decrypted shards, which are then merged through the file merger to obtain the decrypted file.
[0109] Step B2, calling the regular rule based on the target storage location.
[0110] Specifically, once the location of the regular rules is determined, the system will then load these rules from that location. This may involve reading a file, or if stored in a database, performing a database query to obtain the corresponding rule set. Once loaded, the rules are loaded into memory for subsequent decryption operations. This step ensures that all required regular rules have been loaded correctly without any errors or omissions.
[0111] Step B3, decrypting the decrypted segment files based on regular rules.
[0112] Specifically, with the regular rules successfully loaded, the system can now begin the actual decryption work. Each shard file is processed one by one, applying the previously loaded regular rules for scanning and replacement operations. This process may involve searching for specific patterns (such as credit card numbers, social security numbers, etc.), and then processing them according to the rules defined, such as replacing them with asterisks or completely deleting this information. Since each shard is processed independently, this step can be performed in parallel through multi-threading technology, significantly improving processing efficiency.
[0113] Furthermore, in some preferred embodiments of the present invention, the step of merging a plurality of decrypted segment files to obtain a decrypted file includes the following steps C1 to C2:
[0114] Step C1, merging the decrypted fragment files based on the order of the decrypted fragment files to obtain a decrypted file.
[0115] Specifically, the system reassembles the shard files in the correct order in the original file. This process usually relies on metadata or index information created during the sharding process, which records the order and position of each shard. The merge operation involves reading the contents of each shard file and connecting them in the correct order. When merging, the integrity and consistency of the data must be ensured to avoid any data loss or misalignment. The merged file should be consistent with the original file in format and structure, except that the sensitive information in it has been declassified.
[0116] Step C2, storing the decrypted file in a preset file storage location.
[0117] Specifically, after the decrypted files are successfully merged, the last step is to save them to a predetermined location. This may include internal servers, network storage devices, or other secure storage media. The choice of storage location should take into account security, reliability, and accessibility. For example, for decrypted files containing sensitive information, it is usually necessary to select a storage solution that meets the corresponding security standards to ensure long-term security. During the storage process, relevant file attributes such as creation time, access rights, etc. should also be recorded to ensure the integrity and traceability of the files. In this way, it can be ensured that the decrypted files not only maintain the integrity and security of the data, but can also be effectively managed and accessed.
[0118] Furthermore, in some preferred embodiments of the present invention, the decrypted original file includes at least one of the following: a text file, an archive file, a compressed file, and an archive compressed file.
[0119] Specifically, the decrypted file set collects decrypted files uploaded by users, including text files, .tar files, .gz files, and .tar.gz files. .tar files (archive files) are an archive file format commonly used in Unix and Unix-like systems, used to package multiple files or directories into a single file for easy transmission or backup. .gz files (compressed files), .gz files, and Gzip files use .gz as their file extension. .tar.gz files (compressed archive files) combine two commonly used tools in Unix / Linux systems: tar and gzip. First, tar is used to package multiple files or directories into a single .tar file, while gzip is used to compress the packaged file, thereby reducing the file size for easy transmission or storage.
[0120] The file decryption method provided by the embodiment of the present invention can directly perform decryption operations on files of various formats and restore them to their original formats after decryption, thereby greatly improving the decryption efficiency.
[0121] The embodiment of the present invention provides a file decryption method, which is aimed at decrypting offline files and is convenient for later processing of corresponding sensitive file information; the decryption rules and decrypted files are processed separately, and conversion rules are provided to automatically convert the decryption rules into JS regular expressions, and a corresponding mapping relationship is established, and the corresponding relationship and usage frequency are persistently stored; the corresponding retrieval efficiency is provided; for decrypted file processing, a file processor and a sharder are provided to automatically split the file size according to the file size and the file content, and the decrypted files can be automatically processed according to the number of concurrent connections and the machine performance; the file processing efficiency is improved and the file execution time is shortened; powerful configuration information is provided, and flexible configuration can be provided for decryption rules, storage locations, use threads and other configurations, which greatly meets the decryption requirements of different scenarios and different file types, and is convenient to use; multiple decrypted file format support is provided, and after decrypting the file, the output file type can be output in the original format, and multiple other output methods are also provided, avoiding the single format output of the decrypted file to be suitable for various occasions.
[0122] The embodiment of the present invention provides a file decryption method, which takes JavaScript regular expression syntax as the cornerstone, based on the currently commonly used decryption technology as the architecture prototype, and proposes a new architecture concept to improve the current drawbacks of JavaScript regular expression in the process of using it and expand the function of a new architecture model; in this way, JavaScript regular expression not only provides a more powerful and rich API during use, but also improves the flexible usability and high reliability of regular expression in performance to a certain extent, thereby meeting the use requirements of JavaScript regular expression under different scene state management. According to the corresponding javascript regular syntax rules, a corresponding regular dictionary table is established, and the corresponding management is stored in the nosql database mode and the corresponding rule corresponding table is retrieved in the es mode. According to the use process, the corresponding regular dictionary table is added and established in real time. The decryption rules are becoming more and more abundant, which is convenient for free combination and nested use. At the same time, an AI model is provided to automatically generate corresponding javascript regular expressions according to the description rules, so as to quickly establish decryption rules. This article obtains the decryption technology performance in real time, and forms decryption fragments after file segmentation according to the decryption file type, decryption file size and decryption line number. Then, the decryption fragments are processed by multi-threaded concurrent processing and the fragments are integrated. When the decryption is completed, the decrypted file corresponding to the source file is output. Among them, the decryption file types that can be processed currently support text files, tar files, gzip files, tar.gzip files, rar files and corresponding gz files.
[0123] Embodiment 3
[0124] Based on the above embodiments, the present invention provides a file decryption device. Figure 3 The schematic diagram of the structure of a file decryption device provided by an embodiment of the present invention is shown, and the device includes:
[0125] The decrypted original file acquisition module 310 is used to acquire the decrypted original file;
[0126] A file slicing module 320, configured to slice the decrypted original file into multiple decrypted slice files;
[0127] The file decryption module 330 is used to decrypt the decrypted segmented files based on a preset regular rule to obtain a plurality of decrypted segmented files; wherein the decryption process includes at least one decryption thread; the number of the decryption threads is determined based on the performance of the hardware device executing the process; the performance of the hardware device includes at least one of the following: CPU usage and memory usage;
[0128] The decryption determination module 340 is used to merge the multiple decrypted segment files to obtain a decrypted file.
[0129] Furthermore, in some preferred embodiments of the present invention, the file decryption module 330 is used to obtain a target number of decryption threads; after starting the target number of decryption threads, the performance of the hardware device is set to a target occupancy rate; if the target occupancy rate is less than or equal to a preset baseline occupancy rate; the decrypted segmented files are decrypted to obtain multiple decrypted segmented files; wherein the decryption process includes: a target number of decryption threads in parallel.
[0130] Furthermore, in some preferred embodiments of the present invention, the file decryption module 330 is used to adjust the target quantity if the target occupancy rate is greater than a preset benchmark occupancy rate until the target occupancy rate is less than or equal to the preset benchmark occupancy rate.
[0131] Furthermore, in some preferred embodiments of the present invention, the file decryption module 330 is used to obtain a target storage location of a regular rule; call the regular rule based on the target storage location; and decrypt the decrypted segmented file based on the regular rule.
[0132] Furthermore, in some preferred embodiments of the present invention, the decryption determination module 340 is used to merge the decrypted segment files based on the order of the decrypted segment files to obtain a decrypted file; and store the decrypted file in a preset file storage location.
[0133] Furthermore, in some preferred embodiments of the present invention, the device further includes: a regularization determination module, used to obtain a decryption rule; and convert the decryption rule into a regularization rule based on a preset regularization conversion model.
[0134] Furthermore, in some preferred embodiments of the present invention, the decrypted original file includes at least one of the following: a text file, an archive file, a compressed file, and an archive compressed file.
[0135] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the file decryption device described above can refer to the corresponding process in the aforementioned embodiment of the file decryption method, and will not be repeated here.
[0136] Embodiment 4
[0137] The embodiment of the present invention also provides an electronic device for executing the file decryption method; see Figure 4 The structural diagram of an electronic device provided by an embodiment of the present invention is shown, and the electronic device includes a memory 400 and a processor 401, wherein the memory 400 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 401 to implement the above-mentioned file decryption method.
[0138] Further, Figure 4 The electronic device shown further includes a bus 402 and a communication interface 403 , and the processor 401 , the communication interface 403 and the memory 400 are connected via the bus 402 .
[0139] The memory 400 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 402 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0140] The processor 401 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 401. The above processor 401 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 400, and the processor 401 reads the information in the memory 400 and completes the steps of the method of the above embodiment in combination with its hardware.
[0141] An embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned business recommendation method. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0142] The computer program product of the file decryption method, device and electronic device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method in the previous method embodiment. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0143] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and / or device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0144] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0145] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A file decryption method, characterized in that: include: Get the decrypted original file; Slice the decrypted original file to obtain multiple decrypted slice files; Decryption processing is performed on the decrypted shard files based on a preset regular rule to obtain a plurality of decrypted shard files; wherein the decryption processing includes at least one decryption thread; the number of the decryption threads is determined based on the performance of the hardware device executing the decryption processing; the performance of the hardware device includes at least one of the following: CPU usage and memory usage; The plurality of decrypted fragment files are merged to obtain a decrypted file.
2. The file decryption method according to claim 1, characterized in that: The step of decrypting the decrypted shard files based on a preset regular rule to obtain a plurality of decrypted shard files includes: Obtaining a target number of decryption threads; After starting the target number of decryption threads, the performance of the hardware device is set to a target occupancy rate; If the target occupancy rate is less than or equal to a preset reference occupancy rate; Decryption processing is performed on the decrypted slice files to obtain multiple decrypted slice files; wherein the decryption processing process includes: parallel decryption threads of the target number.
3. The file decryption method according to claim 2, characterized in that: The method further comprises: if the target occupancy rate is greater than a preset reference occupancy rate; The target quantity is adjusted until the target occupancy rate is less than or equal to a preset benchmark occupancy rate.
4. The file decryption method according to claim 1, characterized in that: The step of decrypting the decrypted shard files based on a preset regular rule to obtain a plurality of decrypted shard files includes: Obtaining a target storage location for the regular rule; Calling the regular rule based on the target storage location; The decrypted segment files are decrypted based on the regular rules.
5. The file decryption method according to claim 1, characterized in that: The step of merging the plurality of decrypted fragment files to obtain a decrypted file comprises: Merging the decrypted fragment files based on the order of the decrypted fragment files to obtain a decrypted file; The decrypted file is stored in a preset file storage location.
6. The file decryption method according to claim 1, characterized in that: The method further comprises: Get decryption rules; The decryption rule is converted into the regular rule based on a preset regular conversion model.
7. The file decryption method according to claim 1, characterized in that: The decrypted original file includes at least one of the following: a text file, an archive file, a compressed file, and an archive compressed file.
8. A document decryption device, characterized in that: include: A decrypted original file acquisition module is used to acquire the decrypted original file; A file slicing module, used to slice the decrypted original file into multiple decrypted slice files; The file decryption module is used to decrypt the decrypted segmented files based on a preset regular rule to obtain a plurality of decrypted segmented files; wherein the decryption process includes at least one decryption thread; the number of the decryption threads is determined based on the performance of the hardware device executing the process; the performance of the hardware device includes at least one of the following: CPU usage and memory usage; The decryption determination module is used to merge the multiple decrypted segment files to obtain a decrypted file.
9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the file decryption method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the file decryption method according to any one of claims 1 to 7.