File verification method and device, equipment and storage medium
By obtaining file metadata and verifying configuration, generating file hash values and performing verification, the problem of file problems in the existing technology that cannot be verified that the file content is incompletely consistent but the business elements are consistent, achieving high flexibility and accuracy File verification.
Patent Information
- Application Number
- CN202411394139.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-02-14
AI Technical Summary
The prior art cannot effectively verify the consistency between files whose business elements are consistent but whose file content is not completely consistent based on different business scenarios.
By obtaining the metadata of the file and checking configuration, data processing is performed to generate hash values of the file, and file verification is performed based on these hash values. This method includes detecting verification ignore items, processing row-column separators and row record order, etc., and supports order and out of order verification.
It realizes personalized verification of files with incomplete file content but consistent business elements, improves the flexibility and accuracy of file verification and reduces the false positive rate.
Smart Images

Figure CN119441151A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing technology, and in particular to a file verification method, device, equipment and storage medium. Background Art
[0002] Currently, the consistency check between two files on the market is simply to compare the sizes of the two files or to calculate whether the digests of the two files are the same through some algorithm. This verification method can only be used when the contents of the two files are completely consistent and the order of the file contents is strictly consistent.
[0003] However, in complex business scenarios, the same system will generate files based on different business scenarios with consistent business elements but inconsistent file contents. For example, some file descriptions will be added, different row and column separators, different file verification information, different row record order, etc. For this type of file, the file consistency verification methods currently available on the market cannot perform comparison and verification, and will all be identified as inconsistent files, and cannot perform consistency comparison and verification of personalized files. Summary of the invention
[0004] The main purpose of the present application is to provide a file verification method, device, equipment and storage medium, aiming to solve the problem of consistency verification between files generated based on different business scenarios with consistent business elements but not completely consistent file contents.
[0005] To achieve the above purpose, the present application proposes a file verification method, which includes:
[0006] Obtaining first file metadata corresponding to the first file and second file metadata corresponding to the second file, and obtaining file verification configuration;
[0007] Based on the file verification configuration, data processing is performed on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value;
[0008] Perform file verification based on the first file hash value and the second file hash value.
[0009] In one embodiment, the performing data processing on the first file metadata and the second file metadata based on the file verification configuration to obtain a first file hash value and a second file hash value includes:
[0010] Detect whether there is a verification ignore item in the file verification configuration;
[0011] If yes, then determine the ignored row number, ignored column number and row and column separator in the check ignored item;
[0012] Based on the ignored row number, the ignored column number, and the row and column separator, data processing is performed on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value.
[0013] In one embodiment, performing file verification based on the first file hash value and the second file hash value includes:
[0014] Get the file verification method;
[0015] If the file verification mode is sequential verification, performing sequential file verification on the first file hash value and the second file hash value;
[0016] If the file verification mode is out-of-order verification, a file out-of-order verification is performed on the first file hash value and the second file hash value.
[0017] In one embodiment, performing file disorder check on the first file hash value and the second file hash value includes:
[0018] Traversing and matching any first hash value row in the first file hash value with a second hash value row in the second file hash value;
[0019] Generate a hash row verification result based on the matching result of the traversal matching, and determine whether all the first hash value rows in the first file hash value have completed matching based on the first hash value row corresponding to the hash row verification result;
[0020] If not, return to the step of traversing and matching any first hash value row in the first file hash value with the second hash value row in the second file hash value until all the first hash value rows in the first file hash value are matched.
[0021] In one embodiment, before performing file verification based on the first file hash value and the second file hash value, the method further includes:
[0022] Obtain a first file size and a second file size corresponding to the first file and the second file;
[0023] Compare the first file size and the second file size with a preset division verification range to obtain a file comparison result;
[0024] If the file comparison result is a range match result, the first file hash value and the second file hash value are divided, and a file verification algorithm is determined.
[0025] In one embodiment, dividing the first file hash value and the second file hash value and determining a file verification algorithm includes:
[0026] Inputting the first file size and the second file size into a file partition model, and obtaining a file partition area and a file verification algorithm output by the file partition model;
[0027] The first file hash value and the second file hash value are divided based on the file division area.
[0028] In one embodiment, after performing file verification based on the first file hash value and the second file hash value, the method further includes:
[0029] Get the file verification result;
[0030] Inputting the file verification result into a verification report generation model to obtain a file verification report output by the verification report generation model;
[0031] The file verification report is pushed to the target user for the target user to view.
[0032] In addition, to achieve the above purpose, the present application also proposes a file verification device, the file verification device comprising:
[0033] An information acquisition module, used to acquire first file metadata corresponding to the first file and second file metadata corresponding to the second file, and acquire file verification configuration;
[0034] A data processing module, configured to perform data processing on the first file metadata and the second file metadata based on the file verification configuration to obtain a first file hash value and a second file hash value;
[0035] The file verification module is used to perform file verification based on the first file hash value and the second file hash value.
[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes a file verification device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the file verification method described above.
[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the file verification method described above are implemented.
[0038] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the file verification method described above are implemented.
[0039] The present application provides a file verification method, apparatus, device and storage medium. The file verification method obtains first file metadata corresponding to a first file and second file metadata corresponding to a second file, and obtains a file verification configuration, and then based on the file verification configuration, performs data processing on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value, and then performs file verification based on the first file hash value and the second file hash value, and then performs personalized verification on two files with inconsistent file contents through different file verification configurations, thereby improving the flexibility and accuracy of file verification and reducing the false alarm rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0042] Figure 1 A schematic diagram of a process flow provided for the first embodiment of the method for verifying documents of this application;
[0043] Figure 2 A schematic diagram of the process flow provided for Example 2 of the document verification method of this application;
[0044] Figure 3 A flowchart of the third embodiment of the method for verifying the documents of this application is provided;
[0045] Figure 4 A schematic diagram of a process flow provided for Example 4 of the document verification method of this application;
[0046] Figure 5 This is a schematic diagram of the module structure of the file verification device in the embodiment of the present application;
[0047] Figure 6 Schematic diagram of the device structure of the hardware operating environment involved in the file verification method in the embodiment of the present application.
[0048] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0049] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0050] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0051] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a big data service platform, a file verification system, etc. The following takes the file verification system as an example to illustrate this embodiment and the following embodiments.
[0052] Based on this, the present application embodiment provides a file verification method, referring to Figure 1 , Figure 1 A flowchart of the first embodiment of the document verification method of this application is provided.
[0053] In this embodiment, the file verification method includes steps S11 to S13:
[0054] Step S11, obtaining first file metadata corresponding to the first file and second file metadata corresponding to the second file, and obtaining file verification configuration;
[0055] It should be noted that the first file and the second file refer to two data files that need to be compared or verified. The first file represents the target main file for file verification, and the second file represents the comparison file for file verification with the target main file. The two contain similar or related data, but may differ in details due to various business or format reasons. For example, in complex business scenarios, the same system will generate files with consistent business elements but not completely consistent file contents based on different business scenarios. For example, some file descriptions may be added, different row and column separators, different file verification information, different row record orders, etc., such as summary reports for users and data reports for merchants. There is no restriction here and it can be set according to actual conditions.
[0056] It should be further explained that the first file metadata refers to information describing the file features and attributes corresponding to the first file, including file name, file size, creation time, modification time, file type (such as .txt, .pdf, .docx, etc.), file owner, permission information, and file description, etc. The second file metadata refers to information describing the file features and attributes corresponding to the second file, including file name, file size, creation time, modification time, file type (such as .txt, .pdf, .docx, etc.), file owner, permission information, and file description, etc.
[0057] Furthermore, the file verification configuration means that the file verification configuration is a set of parameters and rules used to guide the behavior of the file verification process, such as the verification algorithm: selecting the algorithm used to generate the hash value (such as MD5, SHA-1, SHA-256, etc.); comparing the verification rules (sequential verification or random verification, etc.); verifying ignored items; verifying business rules (specific rules defined based on business needs, such as the type of row and column separators), etc. In one embodiment, the file verification configuration can support the specification of different file encodings, support the specification of different row and column separators, support ignoring rows and columns, etc., and support filtering the beginning and end of the line, etc., which are not limited here and can be set according to actual conditions.
[0058] Specifically, the file paths corresponding to the first file and the second file are obtained, and then the two files are downloaded to a preset local database through the file paths for subsequent reading and verification, so that the two downloaded files are read, so as to obtain the first file metadata corresponding to the first file and the second file metadata corresponding to the second file, and obtain the file verification configuration. The file verification configuration can be personalized according to the target user, and can also be configured according to the business field or file type to which the two files belong. There is no limitation here, and it can be set according to actual conditions.
[0059] Step S12: Based on the file verification configuration, data processing is performed on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value;
[0060] It should be noted that the first file hash value refers to a unique identification value generated based on the first file, and the second file hash value refers to a unique identification value generated based on the second file, thereby quickly comparing whether the files are consistent by generating a digital fingerprint of the file, that is, a hash value. Regardless of the size of the file, only two short hash values need to be compared, thereby greatly reducing the verification time and improving the verification efficiency, which is particularly suitable for the verification of large files or a large number of files. At the same time, the generation of hash values is one-way, ensuring its uniqueness, which means that any slight change to the file will result in a huge change in the hash value, so that any unauthorized modification can be detected. In addition, hash value verification can be easily integrated into an automated system to achieve unattended file consistency verification, reduce manual intervention and potential errors, and because storing hash values saves more space than storing entire files, it helps to optimize the use of storage resources.
[0061] Specifically, it is detected whether there are verification ignore items in the file verification configuration, and if so, the ignored row numbers, ignored column numbers and row and column separators in the verification ignore items are determined, so as to perform data processing on the first file metadata and the second file metadata based on the ignored row numbers, the ignored column numbers and the row and column separators to obtain the first file hash value and the second file hash value.
[0062] Step S13: Perform file verification based on the first file hash value and the second file hash value.
[0063] Specifically, a file verification method is obtained, and if the file verification method is sequential verification, a sequential file verification is performed on the first file hash value and the second file hash value.
[0064] Additionally, if the file verification method is a random order verification, a random order verification is performed on the first file hash value and the second file hash value.
[0065] This embodiment obtains first file metadata corresponding to the first file and second file metadata corresponding to the second file, and obtains a file verification configuration, and then based on the file verification configuration, performs data processing on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value, and then performs file verification based on the first file hash value and the second file hash value, and then performs personalized verification on two files with inconsistent file contents through different file verification configurations, thereby improving the flexibility and accuracy of file verification and reducing the false alarm rate.
[0066] Based on this, the present application embodiment provides a file verification method, referring to Figure 2 , Figure 2A flowchart diagram of the second embodiment of the document verification method of this application is provided.
[0067] In a feasible implementation manner, the performing data processing on the first file metadata and the second file metadata based on the file verification configuration to obtain a first file hash value and a second file hash value includes:
[0068] Step S21, detecting whether there is a verification ignore item in the file verification configuration;
[0069] It should be noted that the verification ignore items refer to the parts that need to be ignored when performing file verification, such as supporting file line number comparison that ignores specified line numbers, supporting configuration of ignored line numbers in the form of multiple lines plus commas, such as "line '2, 8, 17'", and also supporting configuration in the form of interval expressions, such as "line [2-10]", which are not limited here and can be set according to actual conditions to more accurately verify the core content of the file.
[0070] Step S22, if yes, then determine the ignored row number, ignored column number and row and column separator in the verification ignored item;
[0071] It should be noted that the ignored row number refers to the serial number or position of the row to be ignored in the file, including the specific row number, row number range, etc. The ignored column number refers to the serial number or position of the column to be ignored in the file, including the specific column number, column number range, etc.
[0072] It should be further explained that the row and column separators refer to characters or strings used to distinguish rows and columns in a file. For example, row separators include line feed characters (\n), carriage return line feed characters (\r\n), etc.; column separators include commas (,), tabs (\t), semicolons (;), etc., which are not limited here and can be set according to actual conditions.
[0073] Specifically, if yes, then read the ignored row number, ignored column number and row and column separator in the verification ignored item; otherwise, if no, determine to perform a full verification of the file data.
[0074] Step S23: Based on the ignored row number, the ignored column number, and the row and column separators, data processing is performed on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value.
[0075] Specifically, according to the row number, the column number and the row and column separators, the first file metadata and the second file metadata are segmented to obtain a number of file verification data blocks and verification ignore data blocks corresponding to the first file metadata, and a number of file verification data blocks and verification ignore data blocks corresponding to the second file metadata; then, the file verification data blocks corresponding to the first file metadata are integrated, and the integrated file verification data blocks are processed according to a hash algorithm to obtain a first file hash value; and the file verification data blocks corresponding to the second file metadata are integrated, and the integrated file verification data blocks are processed according to a hash algorithm to obtain a second file hash value.
[0076] This embodiment detects whether there are verification ignore items in the file verification configuration, and if so, determines the ignored row numbers, ignored column numbers and row and column separators in the verification ignore items, and then processes the first file metadata and the second file metadata based on the ignored row numbers, the ignored column numbers and the row and column separators to obtain the first file hash value and the second file hash value, thereby improving the flexibility of verification, ensuring that the verification process focuses on the core data of the file, thereby reducing false alarms and improving data processing speed and verification efficiency, thereby supporting file verification based on complex business rules, meeting specific business needs, reducing data processing costs, and improving the accuracy of verification results.
[0077] In a feasible implementation manner, performing file verification based on the first file hash value and the second file hash value includes:
[0078] Step S31, obtaining a file verification method;
[0079] It should be noted that the file verification method refers to a method and process for verifying the consistency or integrity of file data, which can be designed based on different algorithms, rules or business requirements to ensure the correctness of the file content and that it has not been tampered with.
[0080] Specifically, the file verification method can be obtained according to the configuration in the read file verification configuration, and is not limited here.
[0081] Step S32: if the file verification mode is sequential verification, performing sequential file verification on the first file hash value and the second file hash value;
[0082] Specifically, if the file verification method is sequential verification, the first file hash value and the second file hash value are subjected to sequential file verification, that is, all first hash value rows in the first file hash value are matched with the second hash value rows corresponding to the first row number in the second file hash value in ascending order of row numbers according to their corresponding first row numbers, and a hash row verification result is generated based on the matching result until all first hash value rows are matched. For example, when the first row number corresponding to the first hash value row in the first file hash value is row 1, the second hash value row whose second row number is also row 1 in the second file hash value is determined according to the query condition that the first row number is row 1, and then the first hash value row whose first row number is row 1 is matched with the second hash value row whose second row number is also row 1, so as to generate a hash row verification result based on the matching result of the traversal matching; if the match fails, a hash row verification inconsistency result is generated. Furthermore, the first hash value row whose first row number is row 2 is matched with the second hash value row whose second row number is also row 2 according to the increasing row number.
[0083] Furthermore, after all first hash value rows are matched, data of several hash row verification results obtained after matching are integrated to generate a file verification result.
[0084] Step S33: If the file verification method is out-of-order verification, a file out-of-order verification is performed on the first file hash value and the second file hash value.
[0085] Specifically, any first hash value row in the first file hash value is traversed and matched with the second hash value row in the second file hash value, and then based on the matching result of the traversal matching, a hash row verification result is generated, so as to return to the step of traversing and matching any first hash value row in the first file hash value with the second hash value row in the second file hash value until all the first hash value rows in the first file hash value are matched.
[0086] This embodiment obtains a file verification method, and if the file verification method is sequential verification, the first file hash value and the second file hash value are verified in sequence; additionally, if the file verification method is random verification, the first file hash value and the second file hash value are verified in random order, so as to adapt to different business scenarios and needs, thereby improving the flexibility and accuracy of file consistency verification and effectively improving user experience.
[0087] Based on this, the present application embodiment provides a file verification method, referring to Figure 3 , Figure 3 A flowchart diagram of the third embodiment of the document verification method of this application is provided.
[0088] In a feasible implementation manner, performing file disorder check on the first file hash value and the second file hash value includes:
[0089] Step S41, traversing and matching any first hash value row in the first file hash value with any second hash value row in the second file hash value;
[0090] It should be noted that the first hash value row refers to a row of hash values in the hash value list corresponding to the first file, which is determined by a row separator. The second hash value row refers to a row of hash values in the hash value list corresponding to the second file, which is determined by a row separator.
[0091] Specifically, any first hash value row in the first file hash value is traversed and matched with a second hash value row in the second file hash value.
[0092] Step S42, generating a hash row verification result based on the matching result of the traversal matching, and judging whether all the first hash value rows in the first file hash value have completed matching based on the first hash value row corresponding to the hash row verification result;
[0093] It should be noted that the matching result refers to the result obtained after traversing and matching any first hash value row in the first file hash value with all second hash value rows in the second file hash value, including complete match, complete mismatch and partial match results, which are not limited here.
[0094] It should be further explained that the hash row verification result refers to the consistency verification result obtained after matching the hash value row of the first file with the hash value row of the second file, including the hash value row number of the successful match, the hash value row number of the unmatched match, the matching percentage, and the status identification (such as "consistent", "inconsistent" or "partially consistent", etc.).
[0095] Specifically, the verification information corresponding to the matching result of the traversal match is determined. For example, if the matching result is a complete match, the verification information such as the row number corresponding to the first hash value row and the second hash value row that successfully matches in this verification is determined, and then the verification information is associated and combined to generate a hash row verification result.
[0096] Further, according to the first hash value row corresponding to the hash row verification result, it is determined whether all the first hash value rows in the first file hash value have completed matching, for example, according to the row number corresponding to the current first hash value row, the row number is compared with the maximum row number corresponding to the first file hash value, and if the row number is less than the maximum row number corresponding to the first file hash value, it is determined that all the first hash value rows in the first file hash value have not completed matching. In addition, it is also possible to determine whether all the first hash value rows in the first file hash value have completed matching by numbering the hash row verification result and then comparing the number with the maximum row number corresponding to the first file hash value, which is not limited here.
[0097] Step S43: if not, return to the step of traversing and matching any first hash value row in the first file hash value with the second hash value row in the second file hash value until all the first hash value rows in the first file hash value are matched.
[0098] Specifically, if not, the process returns to the step of traversing and matching any first hash value row in the first file hash value with the second hash value row in the second file hash value until all the first hash value rows in the first file hash value are matched.
[0099] Furthermore, after all the first hash value rows in the first file hash value are matched, data integration is performed on a plurality of hash row verification results obtained after matching to generate a file verification result.
[0100] This embodiment traverses and matches any first hash value row in the hash value of the first file with the second hash value row in the hash value of the second file, and then generates a hash row verification result based on the matching result of the traversal matching, and determines whether all the first hash value rows in the hash value of the first file have completed the match based on the first hash value row corresponding to the hash row verification result, and if not, returns to execute the step of traversing and matching any first hash value row in the hash value of the first file with the second hash value row in the hash value of the second file until all the first hash value rows in the hash value of the first file have completed the match, thereby being able to adapt to different data row sequences and file structures, that is, as long as the hash values match, they are considered to be consistent even if the row sequences are different, thereby effectively improving the flexibility and adaptability of file verification, improving verification efficiency while reducing the false alarm rate, and reducing false alarms caused by inconsistent data row sequences.
[0101] Based on this, the present application embodiment provides a file verification method, referring to Figure 4 , Figure 4 A flowchart diagram of the fourth embodiment of the document verification method of this application is provided.
[0102] In a feasible implementation manner, before performing file verification based on the first file hash value and the second file hash value, the method further includes:
[0103] Step S51, obtaining a first file size and a second file size corresponding to the first file and the second file;
[0104] It should be noted that the first file size refers to the data size corresponding to the first file, which is usually measured in bytes, and the second file size refers to the data size corresponding to the second file.
[0105] Specifically, the first file size and the second file size corresponding to the first file and the second file may be obtained through a system detection tool or the like, and no limitation is made here.
[0106] Step S52, comparing the first file size and the second file size with a preset division verification range to obtain a file comparison result;
[0107] It should be noted that the preset division verification range refers to a set of verification thresholds set based on the file size, which is used to determine how to verify the file. If the file is too large, division verification is required to improve the efficiency and speed of file verification, and prevent the system from verifying for a long time, which will eventually lead to unresponsiveness and the like.
[0108] It should be further explained that the file comparison result refers to the result obtained by comparing the sizes of two files within the preset division verification range, including a range match result (at least one file falls within the preset division verification range) and a range mismatch result (the sizes of both files do not fall within the preset division verification range).
[0109] Step S53: if the file comparison result is a range matching result, the first file hash value and the second file hash value are divided, and a file verification algorithm is determined.
[0110] Specifically, if the file comparison result is a range matching result, that is, there is a larger file between the two files, the first file size and the second file size are input into the file partitioning model to obtain the file partitioning area and the file verification algorithm output by the file partitioning model, and then based on the file partitioning area, the first file hash value and the second file hash value are divided.
[0111] This embodiment obtains the first file size and the second file size corresponding to the first file and the second file, and then compares the first file size and the second file size with a preset divided verification range to obtain a file comparison result. If the file comparison result is a range matching result, the first file hash value and the second file hash value are divided, and a file verification algorithm is determined. Different verification algorithms or strategies can be flexibly selected according to different file sizes, allowing the system to reasonably allocate verification resources according to file size and importance, improve response speed, solve the problem of long verification time for large files, and achieve adaptive verification.
[0112] In a feasible implementation manner, dividing the first file hash value and the second file hash value and determining a file verification algorithm includes:
[0113] Step S61, inputting the first file size and the second file size into a file partition model, obtaining a file partition area and a file verification algorithm output by the file partition model;
[0114] It should be noted that the file division area refers to the area that needs to be divided, such as the file division area is the 1st line to the 500th line, etc., which can be set according to actual conditions and is not limited here. In addition, the file verification algorithm refers to using different verification algorithms or strategies for files of different sizes, so that for particularly large files, a more efficient verification method is used to save time and computing resources.
[0115] It should be further explained that the file partition model refers to an algorithm or system for dividing a file into multiple parts (or regions) for effective verification. This model can determine how to divide the file most effectively based on different characteristics of the file, such as size, type, content, structure, etc., and select an appropriate verification algorithm for each part.
[0116] Specifically, the first file size and the second file size are input into the file partition model to obtain the file partition area and the file verification algorithm output by the file partition model. The training process of the file partition model is as follows: obtain several groups of first file sizes, second file sizes and file verification algorithms corresponding to different file sizes, and then perform data preprocessing on each of the first file sizes, second file sizes and file verification algorithms, such as data cleaning, normalization, etc., so as to input each of the first file sizes, second file sizes and file verification algorithms into the initial file partition model to obtain the predicted value output by the initial file partition model, and then calculate the model loss value based on the predicted value and the sample label using the loss function. In this embodiment, the loss function can be set according to actual needs and is not specifically limited here. After the model loss value is calculated, the training process ends, and the error back propagation algorithm is used to update the model parameters in the initial file partition model before the next training is performed. During the training process, determine whether the updated initial file partitioning model meets the preset training end conditions. If so, the updated initial file partitioning model is used as the file partitioning model. If not, continue to train the model, wherein the preset training end conditions include loss convergence and reaching the maximum number of iterations threshold, etc.
[0117] Step S62: divide the first file hash value and the second file hash value based on the file division area.
[0118] Specifically, the first file hash value and the second file hash value are divided according to the file division area, so that they can be processed in parallel after the file division, taking advantage of the multi-core processor or distributed system, which is suitable for processing large data files and improving the verification performance in a big data environment to achieve distributed processing.
[0119] This embodiment inputs the first file size and the second file size into a file partition model to obtain a file partition area and a file verification algorithm output by the file partition model, and then divides the first file hash value and the second file hash value based on the file partition area, thereby realizing intelligent file partitioning, and then using the most appropriate verification algorithm for the file size, thereby improving verification efficiency and verification flexibility, while ensuring that resources are optimally used during the verification process and flexibly adapting to different types of files.
[0120] In a feasible implementation manner, after performing file verification based on the first file hash value and the second file hash value, the method further includes:
[0121] Step S71, obtaining the file verification result;
[0122] It should be noted that the file verification result refers to the file verification result generated after data integration of several hash row verification results, which represents the verification result obtained after a complete file verification of two files, including verification status (describing whether the file has passed the verification), verification details (a detailed description of the verification status, including verification time, verification parameters and settings), difference details (the specific location and nature of the difference between the two files), file metadata (metadata of the files involved in the verification), hash value row comparison results, verification rule application (applied verification rules or strategies, including any custom rules), consistency report (consistency analysis of the content of the comparison file, which may include consistent number of rows, inconsistent number of rows, etc.), performance data of the verification operation (such as processing time, system resource usage), suggestions and solutions, etc., without limitation here.
[0123] In one embodiment, for two compared files, the comparison information such as the comparison task name, file name, number of line records, number of inconsistent records, inconsistent line numbers (up to 100 lines are displayed) is displayed. Because the original line content in some file verifications may involve internal corporate privacy data, it is not displayed. The inconsistent line numbers can be displayed to facilitate the user to check for inconsistencies. In addition, the verification data generated by the file verification can be visualized to display the comparison trend of the number of records of the two compared files. For example, for files that need to be verified multiple times, a visualization chart is generated with the horizontal axis as the comparison date and the vertical axis as the number of records of the two files, so that the user can intuitively and concisely understand the file verification results.
[0124] Step S72, inputting the file verification result into a verification report generation model to obtain a file verification report output by the verification report generation model;
[0125] It should be noted that the verification report generation model refers to generating an easy-to-understand report based on the file verification results to help users understand the details and conclusions of the verification. The verification report generation model usually includes the following key parts: data collection module: responsible for collecting all data and results generated during the file verification process; report compilation engine: organizes the collected data into formatted reports, including text, tables, graphics, etc.; template system: provides different report templates to adapt to different types of verification and user needs; analysis tools: analyze the verification results and provide information such as differences, outliers, trends, etc.; automation logic: automatically determines the content and format of the report based on the verification results to reduce manual intervention; user customization options: allow users to customize the content of the report as needed, such as choosing to include or exclude certain information; visualization tools: provide charts and graphics to help users understand the verification results more intuitively; export and distribution functions: support exporting reports to different formats, such as PDF, Excel, Word, etc., and provide distribution mechanisms.
[0126] Step S73: Push the file verification report to the target user for the target user to view.
[0127] Specifically, the file verification report is pushed to the target user for the target user to view. The report can be pushed by real-time display after system verification, APP notification, mini-program push, email, and website link. There is no limitation here and it can be set according to actual conditions.
[0128] This embodiment obtains a file verification result, and then inputs the file verification result into a verification report generation model to obtain a file verification report output by the verification report generation model, and then pushes the file verification report to a target user for the target user to view, so that the user can clearly understand the status and result of the file verification, thereby realizing personalized verification.
[0129] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0130] This application also provides a file verification device, please refer to Figure 5 , the file verification device comprises:
[0131] The information acquisition module 51 is used to acquire first file metadata corresponding to the first file and second file metadata corresponding to the second file, and acquire file verification configuration;
[0132] A data processing module 52, configured to perform data processing on the first file metadata and the second file metadata based on the file verification configuration to obtain a first file hash value and a second file hash value;
[0133] The file verification module 53 is used to perform file verification based on the first file hash value and the second file hash value.
[0134] The file verification device is also used for:
[0135] Detect whether there is a verification ignore item in the file verification configuration;
[0136] If yes, then determine the ignored row number, ignored column number and row and column separator in the check ignored item;
[0137] Based on the ignored row number, the ignored column number, and the row and column separator, data processing is performed on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value.
[0138] The file verification device is also used for:
[0139] Get the file verification method;
[0140] If the file verification mode is sequential verification, performing sequential file verification on the first file hash value and the second file hash value;
[0141] If the file verification mode is out-of-order verification, a file out-of-order verification is performed on the first file hash value and the second file hash value.
[0142] The file verification device is also used for:
[0143] Traversing and matching any first hash value row in the first file hash value with a second hash value row in the second file hash value;
[0144] Generate a hash row verification result based on the matching result of the traversal matching, and determine whether all the first hash value rows in the first file hash value have completed matching based on the first hash value row corresponding to the hash row verification result;
[0145] If not, return to the step of traversing and matching any first hash value row in the first file hash value with the second hash value row in the second file hash value until all the first hash value rows in the first file hash value are matched.
[0146] The file verification device is also used for:
[0147] Obtain a first file size and a second file size corresponding to the first file and the second file;
[0148] Compare the first file size and the second file size with a preset division verification range to obtain a file comparison result;
[0149] If the file comparison result is a range match result, the first file hash value and the second file hash value are divided, and a file verification algorithm is determined.
[0150] The file verification device is also used for:
[0151] Inputting the first file size and the second file size into a file partition model, and obtaining a file partition area and a file verification algorithm output by the file partition model;
[0152] The first file hash value and the second file hash value are divided based on the file division area.
[0153] The file verification device is also used for:
[0154] Get the file verification result;
[0155] Inputting the file verification result into a verification report generation model to obtain a file verification report output by the verification report generation model;
[0156] The file verification report is pushed to the target user for the target user to view.
[0157] The file verification device provided by the present application adopts the file verification method in the above embodiment, which can solve the technical problems in the background technology. Compared with the prior art, the beneficial effects of the file verification device provided by the present application are the same as the beneficial effects of the file verification method provided by the above embodiment, and other technical features in the file verification device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0158] The present application provides a file verification device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the file verification method in the above-mentioned embodiment one.
[0159] Reference below Figure 6 , which shows a schematic diagram of the structure of a file verification device suitable for implementing an embodiment of the present application. The file verification device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The file verification device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0160] like Figure 6As shown, the file verification device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the file verification device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the file verification device to communicate wirelessly or wired with other devices to exchange data. Although the file verification device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided alternatively.
[0161] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0162] The file verification device provided by the present application adopts the file verification method in the above embodiment, which can solve the technical problems in the background technology. Compared with the prior art, the beneficial effects of the file verification device provided by the present application are the same as the beneficial effects of the file verification method provided by the above embodiment, and the other technical features in the file verification device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0163] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0164] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0165] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the file verification method in the above-mentioned embodiment.
[0166] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0167] The computer-readable storage medium may be included in the file verification device; or may exist independently without being assembled into the file verification device.
[0168] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the file verification device, the file verification device:
[0169] Obtaining first file metadata corresponding to the first file and second file metadata corresponding to the second file, and obtaining file verification configuration;
[0170] Based on the file verification configuration, data processing is performed on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value;
[0171] Perform file verification based on the first file hash value and the second file hash value.
[0172] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0173] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0174] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0175] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned file verification method, and can solve the technical problems in the background technology. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the file verification method provided in the above-mentioned embodiment, and will not be repeated here.
[0176] An embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the above-mentioned file verification method when executed by a processor.
[0177] The computer program product provided in this application can solve the technical problems in the background technology. Compared with the prior art, the beneficial effects of the computer program product provided in the embodiment of this application are the same as the beneficial effects of the file verification method provided in the above embodiment, which will not be repeated here.
[0178] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A file verification method, characterized in that: include: Obtaining first file metadata corresponding to the first file and second file metadata corresponding to the second file, and obtaining file verification configuration; Based on the file verification configuration, data processing is performed on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value; Perform file verification based on the first file hash value and the second file hash value.
2. The file verification method according to claim 1, characterized in that: The step of performing data processing on the first file metadata and the second file metadata based on the file verification configuration to obtain a first file hash value and a second file hash value includes: Detect whether there is a verification ignore item in the file verification configuration; If yes, then determine the ignored row number, ignored column number and row and column separator in the check ignored item; Based on the ignored row number, the ignored column number, and the row and column separator, data processing is performed on the first file metadata and the second file metadata to obtain a first file hash value and a second file hash value.
3. The file verification method according to claim 1, characterized in that: The performing file verification based on the first file hash value and the second file hash value includes: Get the file verification method; If the file verification mode is sequential verification, performing sequential file verification on the first file hash value and the second file hash value; If the file verification mode is out-of-order verification, a file out-of-order verification is performed on the first file hash value and the second file hash value.
4. The file verification method according to claim 3, characterized in that: The performing file disorder check on the first file hash value and the second file hash value includes: Traversing and matching any first hash value row in the first file hash value with a second hash value row in the second file hash value; Generate a hash row verification result based on the matching result of the traversal matching, and determine whether all the first hash value rows in the first file hash value have completed matching based on the first hash value row corresponding to the hash row verification result; If not, return to the step of traversing and matching any first hash value row in the first file hash value with the second hash value row in the second file hash value until all the first hash value rows in the first file hash value are matched.
5. The file verification method according to claim 1, characterized in that: Before performing file verification based on the first file hash value and the second file hash value, the method further includes: Obtain a first file size and a second file size corresponding to the first file and the second file; Compare the first file size and the second file size with a preset division verification range to obtain a file comparison result; If the file comparison result is a range match result, the first file hash value and the second file hash value are divided, and a file verification algorithm is determined.
6. The file verification method according to claim 5, characterized in that: The dividing the first file hash value and the second file hash value and determining a file verification algorithm includes: Inputting the first file size and the second file size into a file partition model, and obtaining a file partition area and a file verification algorithm output by the file partition model; The first file hash value and the second file hash value are divided based on the file division area.
7. The file verification method according to claim 1, characterized in that: After performing file verification based on the first file hash value and the second file hash value, the method further includes: Get the file verification result; Inputting the file verification result into a verification report generation model to obtain a file verification report output by the verification report generation model; The file verification report is pushed to the target user for the target user to view.
8. A file verification device, characterized in that: include: An information acquisition module, used to acquire first file metadata corresponding to the first file and second file metadata corresponding to the second file, and acquire file verification configuration; A data processing module, configured to perform data processing on the first file metadata and the second file metadata based on the file verification configuration to obtain a first file hash value and a second file hash value; The file verification module is used to perform file verification based on the first file hash value and the second file hash value.
9. A file verification device, characterized in that: The file verification device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the file verification method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the file verification method according to any one of claims 1 to 7 are implemented.