A method for releasing access rights to large files and a method for projecting files onto screen
By chunking large files and selectively calculating hash values when reading, the problem of insufficient hash verification performance of large files is solved, fast access and low-cost file processing are achieved, while ensuring file security and integrity.
Patent Information
- Application Number
- CN202411745323.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-02
AI Technical Summary
During the process of hash verification of large files, the existing technology has problems with insufficient performance, especially when the file size reaches G level, hash calculation takes a long time, resulting in increased user waiting time and poor user experience. To solve this problem, hardware upgrades are usually required to increase costs.
By chunking large files into several file chunks of the same number of subbytes, the first hash value of each chunk is calculated and stored, a verification scheme is generated according to the security permission requirements, and the selection instruction is triggered during the read operation, select part of the file chunks to calculate the second hash value, and compare it with the first hash value to judge the access permission.
Through chunking and selective hash verification, the waiting time is significantly reduced when accessing large files, the requirements for computer performance are reduced, and the costs are reduced, while ensuring file security and integrity.
Smart Images

Figure CN119227139B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of file data processing, and in particular to a method for releasing access rights to large files and a method for projecting files onto screen. Background Art
[0002] Currently, the method of publicizing documents through screen projection is gradually becoming an important way to present content in various meetings, activities and other scenarios.
[0003] When uploading files to the server and subsequently calling for reading by users, the files are often reviewed. During the review process, there may be malicious tampering with the content. Therefore, before projecting the file, the file needs to be intercepted and verified to implement permission control. Specifically, when the application attempts to perform IO operations such as reading, by hooking into the IO function of the application, all functions that require IO operations need to be intercepted by the hook program before being called and verified whether they meet the requirements for access permission release.
[0004] In this way, the files that need to be projected can maintain their integrity and security. In the current technology, the main verification method is to calculate the hash value corresponding to the file content, and verify the integrity and security of the file based on the consistency of the hash value before and after the file is uploaded and accessed and read, so as to reduce the possibility of malicious tampering or deletion of part of the content before the file is projected. However, in some cases, the files that need to be accessed and read for projection processing are large files, and the hash verification based on the file content has insufficient performance for large files. When the file size is over G, the hash calculation of the large file content takes one minute or even longer, which causes users to have to wait for a long time when reading the file, and the user experience is poor. At the same time, in order to solve the long waiting time for hash calculation of large files, it is generally necessary to upgrade the processor, memory bandwidth, disk and other hardware, which costs a lot. Summary of the invention
[0005] In order to reduce the waiting time and processing cost when performing hash verification on large files, the present application provides a large file access permission release method and a file screen projection method.
[0006] In the first aspect, the present application provides a method for releasing access rights to large files, which adopts the following technical solution:
[0007] A method for releasing access rights to a large file, comprising the following steps:
[0008] Obtaining a large file, and splitting the large file based on the total number of bytes of the large file to obtain a number of file blocks with the same number of sub-bytes;
[0009] Calculate and store the first hash value corresponding to each of the file blocks;
[0010] Obtaining security permission requirements corresponding to the large file and generating a first verification scheme or a second verification scheme based on the security permission requirements, wherein the security permission requirements include high security and low security;
[0011] Performing a read operation on the large file based on the first verification scheme or the second verification scheme, and triggering one or more selection instructions for the read operation;
[0012] Under each selection instruction, a portion of the plurality of file blocks is selected as a target block and a second hash value of each target block is calculated;
[0013] The second hash value of the target block is compared with the first hash value corresponding to it, and based on the comparison result, it is determined whether to allow access.
[0014] In some embodiments, performing a read operation on the large file based on the first verification scheme or the second verification scheme and triggering one or more selection instructions for the read operation includes the following steps:
[0015] When the security permission requirement is low security, the first verification scheme is generated, in which:
[0016] When the first read operation on the large file is obtained, triggering the generation of the selection instruction;
[0017] Corresponding the generated selection instruction to all the subsequent read operations;
[0018] When the security permission requirement is high security, generating the second verification scheme, in which;
[0019] Obtain the total number of read operations m required for the large file, and generate the number of hash calculations n, where n is less than m;
[0020] When the first read operation on the large file is obtained, the selection instruction is triggered for the subsequent n read operations, while the remaining (mn) read operations do not trigger the selection instruction.
[0021] In some embodiments, each time the selection instruction is given, a portion of the file blocks is selected as a target block, including the following steps:
[0022] In the first verification scheme:
[0023] Obtaining a preset selection coefficient ratio, and multiplying the selection coefficient ratio by the total number of the file blocks to obtain the number to be selected;
[0024] Randomly selecting a number of the file blocks that is not less than the to-be-selected number from the file blocks as the target blocks, wherein the selected file blocks are not in an adjacent position relationship;
[0025] In the second verification scheme:
[0026] The total number of the plurality of file blocks is divided by the number of hash calculations n to obtain a single selection number;
[0027] Each time the selection instruction is triggered, a number of the file blocks that meet the single selection number and have not been selected are randomly selected from the file blocks as the target blocks, wherein each time the selection instruction is triggered, the selected file blocks do not belong to an adjacent position relationship.
[0028] In some embodiments, the method for generating the selected coefficient ratio comprises the following steps:
[0029] Get access object information;
[0030] Generate a first trust value based on the environment authentication corresponding to the access object information;
[0031] Generate a second trusted value based on the security configuration corresponding to the access object information;
[0032] Generate a third trust value based on the network isolation state corresponding to the access object information;
[0033] calculating a credibility score based on the first credibility value, the second credibility value, and the third credibility value;
[0034] Generate a computing performance score based on the hardware information corresponding to the access object information;
[0035] The selected coefficient ratio is generated based on the confidence score and the performance score.
[0036] In some of the embodiments, when the target block is randomly selected from a plurality of the file blocks, the following steps are included:
[0037] Identify the character content in each of the file blocks to determine whether there is a key feature, wherein the key feature includes one or more of a structure tag, a specific tag, and a key value;
[0038] Defining the file blocks with the key features identified as key blocks, and calculating the selection sequence of each key block based on the key features;
[0039] Based on the selected position sequence, the order in which each of the key blocks is selected as the target block in a complete block selection cycle is determined, wherein the complete block selection cycle is characterized by a time period in which all of the file blocks of the large file are selected, and the priority of selecting the key blocks is greater than the priority of selecting other file blocks.
[0040] In some of the embodiments, it also includes:
[0041] The access object information is bound to the block selection period. When the access object information changes, a new block selection period is generated accordingly.
[0042] In some embodiments, comparing the second hash value of the target block with the first hash value corresponding thereto, and determining whether to release access based on the comparison result, comprises the following steps:
[0043] In the first verification scheme:
[0044] Comparing the second hash values of a number of the randomly selected target blocks with their corresponding first hash values;
[0045] If the comparison results are all the same, the current access is allowed and all subsequent read operations are performed; if the comparison results are different, the current access is prohibited and subsequent read operations are stopped;
[0046] In the second verification scheme:
[0047] During each read operation corresponding to the selection instruction, comparing the second hash values of a plurality of the target blocks randomly selected by the read operation with their corresponding first hash values;
[0048] If the comparison results are all the same, then continue to select several target blocks randomly selected by the next read operation for comparison, until all the target blocks are the same as the corresponding first hash values, then release the current access and execute all subsequent read operations;
[0049] If the comparison results are different, the current access is prohibited and the subsequent reading operation is stopped.
[0050] In some of the embodiments, the following steps are also included:
[0051] Generate several asynchronous task queues;
[0052] Allocate the target blocks to the asynchronous task queues to compare the second hash value with the first hash value.
[0053] In some of the embodiments, after calculating and storing the first hash value corresponding to each of the file blocks, the following steps are also included:
[0054] Obtaining the size and last storage time corresponding to each of the file blocks;
[0055] The size and the last storage time are stored together with the first hash value corresponding to each of the file blocks to generate a file fingerprint corresponding to each of the file blocks.
[0056] In a second aspect, the present application provides a method for projecting a file to a screen, which adopts the following technical solution:
[0057] A file screen projection method is implemented based on the above-mentioned large file access permission release method, comprising the following steps:
[0058] Get the uploaded large file to be projected;
[0059] Performing content review on the large file;
[0060] After the review is passed, wait for the access request;
[0061] Determining whether to release the access request for the large file based on a large file access permission release method;
[0062] When the access request is released, the access permission of the large file is released, and a read operation of the large file is performed and the large file is projected after the read operation is completed.
[0063] The technical solution provided by the embodiments of the present application has the following technical effects:
[0064] The large file is divided into blocks of preset size, and based on the access instruction to the large file, while realizing the reading of the content of the large file, the hash value verification is performed on some or all of the file blocks. Since the size of the file block is much smaller than the size of the large file, and the calculation time of the hash value is related to the number of characters in the file, the hash value calculation process of the document block is extremely fast, and the hash value calculation time for some or all of the file blocks is also much shorter than the hash value calculation time for the entire large file, which greatly reduces the waiting time of users when accessing and reading large files. At the same time, the hash value calculation of the file block does not need to meet the performance requirements of the computer, and the cost is low. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 It is a schematic diagram of the steps of a method for releasing access rights to large files provided in an embodiment of the present application.
[0066] Figure 2This is a schematic diagram of the steps of a file projection method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0067] To more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. However, it should be understood by those of ordinary skill in the art that the present application can be implemented without these details. In some cases, in order to avoid unnecessary descriptions that make various aspects of the present application obscure, well-known methods, processes, systems, components and / or circuits that have been described at a higher level will not be described in detail. For those of ordinary skill in the art, it is obvious that various changes can be made to the embodiments disclosed in the present application, and without departing from the principles and scope of the present application, the general principles defined in the present application can be applied to other embodiments and application scenarios. Therefore, the present application is not limited to the embodiments shown, but conforms to the broadest scope consistent with the scope claimed for protection of the present application.
[0068] It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention. In addition, the technical features involved in each embodiment of the present invention described below can be combined with each other as long as there is no conflict between them.
[0069] In the description of this application, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used to distinguish the technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0070] In the description of the present application, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples.
[0071] An embodiment of the present application discloses a method for releasing access rights to a large file.
[0072] like Figure 1 As shown, a method for releasing access rights to a large file includes the following steps:
[0073] S100, obtaining a large file, and splitting the large file based on the total number of bytes of the large file to obtain a number of file blocks with the same number of sub-bytes.
[0074] After obtaining a large file, the large file is divided into several file blocks containing smaller bytes. In the embodiment of the present application, the size of each file block is 1M. Based on the size of the large file, the size of the divided blocks can also be changed accordingly. For example, when the large file is extremely large, in order to avoid too many divided file blocks, the size of the file block can be set to 2M.
[0075] When a large file is divided into blocks, a certain amount of overlapping bytes can be reserved between blocks to ensure that the context is not lost between blocks.
[0076] Meanwhile, the fixed-size-based chunking is the best approach. In some other embodiments, chunking can also be based on sentences, such as dividing sentences by periods and line breaks; chunking can be based on structured documents, such as titles, code blocks, etc. However, in the above-mentioned division methods, it is necessary to ensure that the sizes of the various file chunks are the same or similar as much as possible.
[0077] S200, calculating and storing the first hash value corresponding to each file block.
[0078] A hash value calculation is performed on each file block using a preset hash algorithm to obtain a first hash value corresponding to each file block, and each first hash value is stored. In the embodiment of the present application, the hash algorithm is MD5.
[0079] S300, obtaining security permission requirements corresponding to the large file and generating a first verification scheme or a second verification scheme based on the security permission requirements.
[0080] Security permission requirements include high security and low security.
[0081] First, obtain the security permission requirements associated with the uploaded large file. The security permission requirements are manually added by the user and indicate whether the file is important. The more important the file, the higher the corresponding security. Conversely, the less important the file, the lower the corresponding security.
[0082] Secondly, different hash value verification schemes are configured according to the different security levels of large files, so that large files with high security can be verified as quickly as possible and with high accuracy, and large files with low security can be verified extremely quickly and with a certain accuracy. In other words, in large files with high security, it is not allowed to sacrifice the accuracy of hash verification due to reducing the verification time, while in large files with low security, it is allowed to sacrifice part of the accuracy of hash verification due to reducing the verification time.
[0083] S400, performing a read operation on the large file based on the first verification scheme or the second verification scheme, and triggering one or more selection instructions for the read operation.
[0084] Start reading the large file under the first verification scheme or the second verification scheme, and trigger one or more selection instructions when the large file is read completely. Each selection instruction is represented by a process of selecting file blocks and verifying hash values. The number of triggering of different selection instructions is represented by the number of file blocks that need to be verified after selection. At the same time, the number of selected file blocks also represents the accuracy of hash verification.
[0085] S500, under each selection instruction, select a portion of the plurality of file blocks as target blocks and calculate a second hash value of each target block.
[0086] Each time the selection instruction is triggered, a portion of the file blocks are selected from the plurality of blocks as target blocks and a second hash value is calculated.
[0087] S600: Compare the second hash value of the target block with its corresponding first hash value, and determine whether to allow access based on the comparison result.
[0088] The second hash value of the selected target block is compared with the first hash value stored in the target block, and whether to release the access is determined based on the comparison result. The release is characterized by whether the user's reading and screen projection operations on large files are allowed.
[0089] Through the above steps, the large file is divided into blocks of preset size, and based on the access instruction to the large file, while realizing the reading of the content of the large file, the hash value verification is performed on some or all of the file blocks. Since the size of the file block is much smaller than the size of the large file, and the calculation time of the hash value is related to the number of characters in the file, the hash value calculation process of the document block is extremely fast, and the hash value calculation time for some or all of the file blocks is also much shorter than the hash value calculation time for the entire large file, which greatly reduces the waiting time of users when accessing and reading large files. At the same time, the hash value calculation of the file block does not need to meet the performance requirements of the computer, and the cost is low.
[0090] In some other embodiments, performing a read operation on a large file based on the first verification scheme or the second verification scheme and triggering one or more selection instructions for the read operation includes the following steps:
[0091] S410: When the security permission requirement is low security, a first verification scheme is generated. In the first verification scheme:
[0092] S420, triggering generation of a selection instruction when obtaining the first read operation on the large file.
[0093] S430, the generated selection instruction corresponds to all subsequent read operations.
[0094] When the security permission requirement of a large file is low security, it indicates that the corresponding importance of the large file is low. At this time, a certain hash value verification coverage accuracy can be sacrificed in exchange for a faster hash value calculation time.
[0095] The complete reading of a large file will trigger many read operations, but in the first verification scheme, no matter how many read operations the large file needs to trigger, the selection instruction is only triggered when the first read operation is performed. That is to say, in the first verification scheme, the selection instruction is triggered only once when the large file is completely read.
[0096] Subsequent large file read access permissions are all related to the hash value verification result of the target block selected by this unique selection instruction.
[0097] Therefore, under low security requirements, there is no need to verify the hash values of all target blocks, but only some target blocks can be selected for verification. Although it is impossible to complete the verification of the security and integrity of the entire file, because it belongs to low security, it is allowed to sacrifice a certain verification accuracy in order to shorten the calculation time.
[0098] S440: When the security permission requirement is high security, generate a second verification scheme. In the second verification scheme:
[0099] S450, obtaining the total number of read operations m required for the large file, and generating the number of hash calculations n, where n is less than m.
[0100] S460, when the first read operation on the large file is obtained, a selection instruction is triggered for subsequent n read operations, and the remaining (mn) read operations do not trigger the selection instruction.
[0101] When the security permission requirement for a large file is high security, it indicates that the large file is of high importance. At this time, it is not allowed to sacrifice any hash value verification coverage accuracy in exchange for faster hash value calculation time.
[0102] The complete reading of a large file will trigger many read operations. In the second verification scheme, before reading a large file, it is necessary to first obtain or estimate the total number of read operations m required for the large file. At the same time, a hash calculation number n is generated. The hash calculation number n represents the total number of batches that need to be hashed. Each hash calculation corresponds to the hash value calculation of multiple target blocks.
[0103] At the same time, it is necessary to ensure that n is less than m. In this way, since the number of times a large file is read is much greater than the number of times the hash value is calculated, the user will not feel the need to wait while the hash value calculation is performed on all file blocks, and there will be no situation where the file has been read for a certain period of time and then access is prohibited due to failure of the hash value verification. At the same time, before the large file is completely read, all file blocks are selected as target blocks and hash calculations are performed, ensuring the security and integrity of the hash verification of all blocks.
[0104] Assign n hash calculations to each read operation in turn, so that out of the total number of read operations m, there will be n matching hash calculations, and the remaining mn matching hash calculations. Each time a read operation with a selection instruction is performed, a certain number of target blocks will be selected from several file blocks for hash value calculation.
[0105] In some other embodiments, under each selection instruction, a portion of the plurality of file blocks is selected as a target block, including the following steps:
[0106] In the first verification scheme, the selection instruction is triggered only once:
[0107] S510, obtaining a preset selection coefficient ratio, and multiplying the selection coefficient ratio by the total number of file blocks to obtain a number to be selected.
[0108] When the selection instruction is triggered only once, only some of the blocks in all file blocks can be selected as target blocks for verification. Therefore, the number of target blocks corresponding to the selection instruction this time is related to the accuracy of this hash verification.
[0109] First, the preset selection coefficient ratio is obtained. The selection coefficient ratio is less than 1. The selection coefficient ratio will fluctuate according to different scenarios. The specific floating method will be explained in the subsequent content.
[0110] The value obtained by multiplying the selected coefficient ratio and the total number of file blocks is the number to be selected, and the number to be selected is represented by the number corresponding to the minimum verification accuracy threshold in different numbers of file blocks.
[0111] If the selected coefficient ratio is 0.4, it means that at least 40% of all file blocks are selected as target blocks for verification. If the number of selected target blocks is less than 40% of the total, it is considered that the hash verification coverage accuracy corresponding to the first verification scheme is low and the security and integrity of the document cannot be guaranteed.
[0112] S520: Randomly select a number of file blocks that is no less than the number to be selected from the number of file blocks as target blocks, wherein the selected number of file blocks are not in an adjacent position relationship.
[0113] Randomly select no less than the number of file blocks to be selected from the multiple blocks as target blocks for subsequent hash verification. Meanwhile, the randomly selected multiple file blocks should not be in adjacent positions.
[0114] In this way, through the random and jumping block selection method, the file blocks corresponding to the entire large file can be selected with high coverage and high verification in one selection instruction. When the file size and the last modification date remain unchanged, the number of triggering times of the selection instruction can be reduced as much as possible to identify the verification status of the block hash value corresponding to the complete large file.
[0115] In the second verification scheme, the selection instruction is triggered multiple times:
[0116] S530, dividing the total number of the plurality of file blocks by the number of hash calculations n to obtain a single selection number.
[0117] When the selection instruction is triggered multiple times, since each selection instruction corresponds to one hash calculation, the number of file blocks that need to be selected for each selection instruction is obtained by dividing the total number of file blocks by n.
[0118] When performing division, it may happen that the single selected number is not an integer. In this case, the decimal places of the calculation result are removed by default, and one is added to the integer place to obtain the single selected number of an integer.
[0119] S540, each time a selection instruction is triggered, a number of file blocks that meet the single selection number and have not been selected are randomly selected from a number of file blocks as target blocks, wherein in each selection instruction triggered, the selected number of file blocks do not belong to an adjacent position relationship.
[0120] Each time the selection instruction is triggered, a corresponding number of file blocks are randomly selected from a number of file blocks as target blocks according to the single selection number, and the target blocks selected for each trigger task are different. At the same time, similar to the first verification task, when the selection instruction is triggered multiple times, the selected file blocks in each selection instruction are not in adjacent positions, and in the next trigger task, the selected file blocks can be adjacent to the file blocks in the previous trigger task.
[0121] In this way, all file blocks can be selected as target blocks and hash verification can be performed in the number of hash calculations n.
[0122] It should be noted that when the single selection number is just calculated, it may not be an integer, and it will be converted into an integer according to the above method. This will cause the number of remaining file blocks that can be selected in the last hash calculation to be less than the single selection number in some cases. At this time, the remaining number of file blocks will be used as the single selection number corresponding to the last selection instruction.
[0123] In some other embodiments, a method for generating a selected coefficient ratio comprises the following steps:
[0124] S511, obtaining access object information.
[0125] The access object information is the environment information of the computer or server where the current large file is located and the computer or server that is to access the large file for reading.
[0126] S512: Generate a first trust value based on the environment authentication corresponding to the access object information.
[0127] First, determine the environmental authentication of the access object information, such as whether there is a digital certificate, biometrics or a one-time password, so as to obtain the authentication authority level of the access object information.
[0128] S513: Generate a second trusted value based on the security configuration corresponding to the access object information.
[0129] Determine the security configuration corresponding to the access object information, such as checking whether the computer or server has the latest security patch, antivirus software or firewall configuration, so as to obtain the second trust value corresponding to the vulnerability risk.
[0130] S514: Generate a third trust value based on the network isolation state corresponding to the access object information.
[0131] The network isolation status of the access object information is obtained, such as whether a virtual private network (VPN) or a dedicated network is used, so as to generate a third trust value based on whether there is unauthorized network access or a man-in-the-middle attack.
[0132] S515 , calculating a credibility score based on the first credibility value, the second credibility value, and the third credibility value.
[0133] The overall credibility score is calculated through three dimensions and a preset score allocation algorithm, which is used to characterize the security performance of an access object.
[0134] S516: Generate a computing performance score based on the hardware information corresponding to the access object information.
[0135] The hardware performance of the computer or server, such as memory, processor, number of threads, etc., is calculated based on the access object information to generate a computing performance score.
[0136] S517, generating a selected coefficient ratio based on the credibility score and the performance score.
[0137] The selection coefficient ratio is calculated comprehensively through the above two scores. Because large files may be sent to different users and read through different computers, the environment in which each large file is located is different, and the size of the security risk and the performance burden that can be calculated are different. Therefore, in different computer or server environments, they need to have corresponding selection coefficient ratios.
[0138] The less secure it is or the higher the computing performance is, the larger the selected coefficient ratio is; the more secure it is or the lower the computing performance is, the smaller the selected coefficient ratio is.
[0139] In other embodiments, when selecting a target block, in the first verification scheme, only some file blocks will be selected as target blocks for hash verification, so how to improve the verification effect as much as possible in a limited number of target blocks is crucial. At the same time, in the second verification scheme, although all file blocks will be selected and hash verified during the reading process of a large file, if the target blocks that need to be verified can be allocated to the front hash verification as much as possible, the verification efficiency of the hash verification when anomalies occur will be improved as much as possible. Therefore, when randomly selecting a target block from a number of file blocks, the following steps are included:
[0140] S550, identifying the character content in each file block to determine whether there is a key feature.
[0141] The key feature is characterized by judging whether a file block corresponds to important data in the large file or data with special marks through character content. The key feature includes one or more of a structural mark, a specific mark and a key value.
[0142] Structural tags include parts with certain special structures in files with clear structures (such as database files, XML, JSON, etc.), such as metadata (file type, version, creation time), indexes, etc. contained in the file header.
[0143] Specific tags include parts with unique content in the file, such as XML tags, JSON key values, etc., which define the meaning of the data.
[0144] Key values include data with certain business logic important values such as ID card number and credit card number. Key values also include the number of times the data corresponding to a file block is frequently written, read, and accessed.
[0145] S551, defining the file blocks with identified key features as key blocks, and calculating the selection sequence of each key block based on the key features.
[0146] The file blocks with these key features are defined as key blocks, because these key features are data contents that are of great relevance or significance to the large file itself, and the possibility of tampering or loss of these data contents and the risk consequences are relatively high, so these data need to be treated as key blocks for verification.
[0147] At the same time, the selection sequence of each key block is further allocated and calculated based on the specific content of the key features corresponding to each file block.
[0148] If it corresponds to a key value of an important secret, its selection sequence will be earlier. The earlier the selection sequence is, the earlier it will be selected as a target block and verified.
[0149] S552, based on the selected position sequence, determines the order in which each key block is selected as the target block in the complete block selection cycle, wherein the complete selection cycle is characterized by the time period in which all file blocks of the large file are selected, and the priority of selecting the key block is higher than the priority of selecting other file blocks.
[0150] When selecting a file block as a target block, the key block is first selected as an alternative. When the selection instruction is triggered multiple times, or the number of block selections corresponding to one triggering instruction is less than the number of key blocks, it is necessary to determine the batch of key blocks to be selected based on the selection sequence corresponding to the key blocks.
[0151] At the same time, a complete selection cycle is characterized by a time period in which all file blocks of a large file are selected. For example, in the first verification scheme, each time a large file is read corresponds to a trigger instruction, n1 file blocks will be selected at this time. During the next reading, n2 file blocks will be selected from the remaining file blocks after subtracting n1 from the total number of file blocks, until all file blocks of the large file are selected after several times of the first verification scheme, indicating that a complete selection cycle has passed, and the n1 file blocks all select the file blocks with the earliest selected order, and the remaining file blocks with the earliest selected order are selected from the n2.
[0152] In the second verification scheme, since all file blocks are completely selected when reading a large file, one reading process corresponds to one complete selection cycle.
[0153] In some other embodiments, it also includes:
[0154] The access object information is bound to the block selection period. When the access object information changes, a new block selection period is generated accordingly.
[0155] A block selection cycle is characterized by a complete verification of all file blocks of a large file. Therefore, when the address, computer, or server corresponding to the large file being accessed and read changes, the previous verification results corresponding to other computers cannot be used as the verification results of this computer. Large files require corresponding independent hash verifications in different access objects, so the access object information and the block selection cycle are bound to each other. Whenever the access object information of an access and read operation changes, a new block selection cycle will be generated to restart the selection verification of each file block.
[0156] In some other embodiments, comparing the second hash value of the target block with its corresponding first hash value, and determining whether to release the access based on the comparison result, includes the following steps:
[0157] In the first verification scenario:
[0158] S610: Compare the second hash values of several randomly selected target blocks with their corresponding first hash values.
[0159] S620, if the comparison results are the same, the current access is allowed and all subsequent read operations are performed; if the comparison results are different, the current access is prohibited and subsequent read operations are stopped.
[0160] In the first verification scheme, since one access corresponds to a complete reading process of a large file, no matter how many reading operations are required, the file blocks are only selected once. Therefore, if the second hash values of several target blocks selected by this selection instruction are all the same as their corresponding first hash values, the access is directly released to continue reading the large file, and the remaining file blocks that have not been selected are selected the next time the large file is accessed. When one or more second hash values are not equal to the first hash value among the several target blocks selected by this selection instruction, the current access is prohibited and subsequent reading operations are stopped.
[0161] In the second verification scenario:
[0162] S630, in each read operation corresponding to the selection instruction, comparing the second hash values of several target blocks randomly selected by the read operation with their corresponding first hash values.
[0163] S640, if the comparison results are all the same, continue to select several target blocks randomly selected by the next read operation for comparison, until all target blocks are the same as the corresponding first hash values, then release the current access and execute all subsequent read operations.
[0164] S650: If the comparison result is different, prohibit the current access and stop the subsequent reading operation.
[0165] In the second verification scheme, it is necessary to trigger multiple selection instructions. Taking the triggering of n1, n2, and n3 as an example, the selection instruction corresponding to n1 is first executed and some file blocks are selected as target blocks for hash value verification. If the comparison results of the second hash values of all target blocks corresponding to n1 are the same as the corresponding first hash values, the selection instruction corresponding to n2 is triggered in the next read operation and some file blocks are continued to be selected as targets from the remaining file blocks after n1 is completed for hash value verification. When all comparison results are the same, the selection instruction corresponding to n3 is repeated.
[0166] When all the comparison results in n1, n2, and n3 are the same, the verification is successful, the current access is released, and the subsequent read operation is continued to complete the reading of the large file. If any verification result in the process of n1, n2, and n3 is different, the current access is prohibited and the subsequent read operation is stopped.
[0167] In some other embodiments, the following steps are also included:
[0168] S700: Generate several asynchronous task queues.
[0169] S710: Allocate a plurality of target blocks to a plurality of asynchronous task columns to compare the second hash value with the first hash value.
[0170] Several asynchronous task queues are generated according to the number of threads corresponding to the hardware performance of the computer, and each asynchronous task queue is characterized as an independent asynchronous task. In this way, the hash value calculation and verification of several target blocks selected in a selection instruction can be performed asynchronously, so that each target block does not need to wait for the calculation and verification of the target block in front to complete its own calculation verification, further reducing the time required for hash value calculation.
[0171] In some other embodiments, after calculating and storing the first hash value corresponding to each file block, the following steps are also included:
[0172] S210, obtaining the size and last storage time corresponding to each file block.
[0173] S220, storing the size and the last storage time together with the first hash value corresponding to each file block to generate a file fingerprint corresponding to each file block.
[0174] When a large file is read, in addition to verifying the hash value, the overall file fingerprint of each file block can also be verified. In addition to the hash value, the file fingerprint also includes the size and last modification time of the file block. If the size and last modification time of the file block change, access to the large file is also considered to be denied.
[0175] like Figure 2 As shown, the embodiment of the present application also discloses a file screen projection method, which is implemented based on the above-mentioned large file access permission release method, and specifically includes the following steps:
[0176] S800, obtain the uploaded large file to be projected.
[0177] S810, content review of large files.
[0178] S820, after the review is passed, wait for obtaining the access request.
[0179] S830: Determine whether to release the access request to the large file based on the large file access permission release method.
[0180] S840, when the access request is released, the access permission of the large file is released, and the reading operation of the large file is performed and the large file is projected on the screen after the reading operation is completed.
[0181] The user first uploads the large file that he wants to project. After the system obtains the large file, it first manually reviews the content of the large file. After the review is passed, it waits to obtain the access request issued by the user through the computer. The access request indicates that the user wants to project the large file and needs to read the large file.
[0182] After obtaining the access request, the security and integrity of the large file are judged by the above-mentioned large file access permission release method, and hash verification is used to determine whether the large file has been maliciously tampered with during the upload, manual review, storage, etc. If it is considered that the access request can be released after verification, the access permission of the large file is released, the corresponding reading operation is performed, and the screen projection is completed. If the verification fails, access is prohibited and the reading of the large file is stopped.
[0183] The implementation principle is:
[0184] The large file is divided into blocks of preset size, and based on the access instruction to the large file, while realizing the reading of the content of the large file, the hash value verification is performed on some or all of the file blocks. Since the size of the file block is much smaller than the size of the large file, and the calculation time of the hash value is related to the number of characters in the file, the hash value calculation process of the document block is extremely fast, and the hash value calculation time for some or all of the file blocks is also much shorter than the hash value calculation time for the entire large file, which greatly reduces the waiting time of users when accessing and reading large files. At the same time, the hash value calculation of the file block does not need to meet the performance requirements of the computer, and the cost is low.
[0185] It should be understood that although the steps in the flowchart of the accompanying drawings are shown in sequence according to the instructions of the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise clearly stated in this document, the execution of these steps is not strictly limited in order and can be performed in other orders.
[0186] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.
Claims
1. A method for releasing access rights to large files, characterized in that: The following steps are involved: Obtaining a large file, and splitting the large file based on the total number of bytes of the large file to obtain a number of file blocks with the same number of sub-bytes; Calculate and store the first hash value corresponding to each of the file blocks; Obtaining security permission requirements corresponding to the large file and generating a first verification scheme or a second verification scheme based on the security permission requirements, wherein the security permission requirements include high security and low security; A read operation is performed on the large file based on the first verification scheme or the second verification scheme, and one or more selection instructions are triggered for the read operation. Specifically, When the security permission requirement is low security, the first verification scheme is generated, in which: When the first read operation on the large file is obtained, triggering the generation of the selection instruction; Corresponding the generated selection instruction to all the subsequent read operations; When the security permission requirement is high security, generating the second verification scheme, in which; Obtain the total number of read operations m required for the large file, and generate the number of hash calculations n, where n is less than m; When the first read operation on the large file is obtained, a selection instruction is triggered for each of the subsequent n read operations, while the remaining (mn) read operations do not trigger the selection instruction; Under each selection instruction, a portion of the file blocks is selected as a target block and a second hash value of each target block is calculated. Specifically, In the first verification scheme: Obtaining a preset selection coefficient ratio, and multiplying the selection coefficient ratio by the total number of the file blocks to obtain the number to be selected; Randomly selecting a number of the file blocks that are not less than the number to be selected from the file blocks as the target blocks, wherein the selected file blocks are not in an adjacent position relationship; In the second verification scheme: The total number of the plurality of file blocks is divided by the number of hash calculations n to obtain a single selection number; Each time the selection instruction is triggered, a plurality of the file blocks that meet the single selection number and have not been selected are randomly selected from the plurality of the file blocks as the target blocks, wherein in each time the selection instruction is triggered, the selected plurality of file blocks are not in an adjacent position relationship; The second hash value of the target block is compared with the first hash value corresponding to it, and based on the comparison result, it is determined whether to allow access.
2. The method for releasing access rights to large files according to claim 1, characterized in that: The method for generating the selected coefficient ratio comprises the following steps: Get access object information; Generate a first trust value based on the environment authentication corresponding to the access object information; Generate a second trusted value based on the security configuration corresponding to the access object information; Generate a third trustworthy value based on the network isolation state corresponding to the access object information; calculating a credibility score based on the first credibility value, the second credibility value, and the third credibility value; Generate a computing performance score based on the hardware information corresponding to the access object information; The selected coefficient ratio is generated based on the confidence score and the performance score.
3. The method for releasing access rights to large files according to claim 1, characterized in that: When the target block is randomly selected from a plurality of the file blocks, the following steps are included: Identify the character content in each of the file blocks to determine whether there is a key feature, wherein the key feature includes one or more of a structure tag, a specific tag, and a key value; Defining the file blocks with the key features identified as key blocks, and calculating the selection sequence of each key block based on the key features; Based on the selected position sequence, the order in which each of the key blocks is selected as the target block in a complete block selection cycle is determined, wherein the complete block selection cycle is characterized by a time period in which all of the file blocks of the large file are selected, and the priority of selecting the key blocks is greater than the priority of selecting other file blocks.
4. The method for releasing access rights to large files according to claim 3, characterized in that: Also includes: The access object information is bound to the block selection period. When the access object information changes, a new block selection period is generated accordingly.
5. The method for releasing access rights to large files according to claim 1, characterized in that: Comparing the second hash value of the target block with the first hash value corresponding to the target block, and determining whether to allow access based on the comparison result, including the following steps: In the first verification scheme: Comparing the second hash values of a number of the target blocks selected randomly with their corresponding first hash values; If the comparison results are all the same, the current access is allowed and all subsequent read operations are performed; if the comparison results are different, the current access is prohibited and subsequent read operations are stopped; In the second verification scheme: During each read operation corresponding to the selection instruction, comparing the second hash values of a plurality of the target blocks randomly selected by the read operation with their corresponding first hash values; If the comparison results are all the same, then continue to select several target blocks randomly selected by the next read operation for comparison, until all the target blocks are the same as the corresponding first hash values, then release the current access and execute all subsequent read operations; If the comparison results are different, the current access is prohibited and the subsequent reading operation is stopped.
6. The method for releasing access rights to large files according to claim 1, characterized in that: The following steps are also included: Generate several asynchronous task queues; Allocate the target blocks to the asynchronous task queues to compare the second hash value with the first hash value.
7. The method for releasing access rights to large files according to claim 1, characterized in that: After calculating and storing the first hash value corresponding to each of the file blocks, the following steps are also included: Obtaining the size and last storage time corresponding to each of the file blocks; The size and the last storage time are stored together with the first hash value corresponding to each of the file blocks to generate a file fingerprint corresponding to each of the file blocks.
8. A file projection method, characterized in that: The method for releasing access rights to large files according to any one of claims 1 to 7 is implemented, comprising the following steps: Get the uploaded large file to be projected; Performing content review on the large file; After the review is passed, wait for the access request; Determining whether to release the access request for the large file based on a large file access permission release method; When the access request is released, the access permission of the large file is released, and a read operation of the large file is performed and the large file is projected after the read operation is completed.
Citation Information
Patent Citations
File management method, device, storage medium and terminal
CN112347040A
Application program operation control method and device, storage medium and computer equipment
CN118940254A