Method and device for verifying algorithm program
By optimizing the verification process by using verification rules and random challenge values in algorithm version verification, the problems of misuse attacks and verification inaccuracies in the existing technology are solved, and higher algorithm version verification accuracy is achieved.
Patent Information
- Application Number
- CN202110869930.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-30
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-07-30
AI Technical Summary
Algorithm version verification methods in the prior art are vulnerable to misuse attacks and cannot accurately verify whether the algorithm program actually run by the data provider is the version indicated by the algorithm provider.
The algorithm provider sends verification rules to the data provider, and the data provider generates verification values based on the actual running algorithm program. The algorithm provider determines the correctness of the algorithm program by comparing the verification values, and uses random challenge values and trigger conditions to optimize the verification. verification process, reducing computational complexity and improving accuracy.
It improves the accuracy of algorithm version verification, prevents misuse attacks, and ensures that the algorithm program actually run by the data provider is consistent with the program instructed by the algorithm provider.
Smart Images

Figure CN113569225B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network technology, and in particular to a method and device for verifying an algorithm program. Background Art
[0002] As a relatively new form of collaborative computing, algorithm outsourcing provides a way to achieve "data remains unchanged, value flows". In the collaborative computing process, the data provider's data does not need to be stored, and the local data of the data provider can be processed by simply calling the algorithm program provided by the algorithm provider through the corresponding interface, which meets the existing compliance requirements, but also brings challenges to verifying the correctness of the calculation results of the outsourced algorithm program.
[0003] The version verification method in the prior art is generally as follows: the algorithm provider obtains the algorithm version number sent by the data provider, and verifies the algorithm version number to determine whether the algorithm version number is the algorithm version number of the correct algorithm version corresponding to the data provider, that is, the algorithm provider verifies whether the algorithm version number of the algorithm program remotely deployed on the data service provider is correct. This verifies the called algorithm program. However, due to the simple version verification method, this method is vulnerable to misuse attacks. For example, if the data provider updates the algorithm program version but still returns the original algorithm version number, the algorithm provider cannot perform accurate verification.
[0004] Therefore, there is an urgent need for an algorithm program verification method and device that can improve the accuracy of algorithm version verification and prevent misuse attacks. Summary of the invention
[0005] The embodiment of the present invention provides a method and device for verifying an algorithm program, which can improve the accuracy of algorithm version verification and prevent misuse attacks.
[0006] In a first aspect, an embodiment of the present invention provides a method for verifying an algorithm program, the method comprising:
[0007] The algorithm provider sends the verification rules of the first algorithm program to the data provider, and the first algorithm program is the algorithm program that the algorithm provider instructs the data provider to perform operations based on local data; the algorithm provider determines a first verification instruction from a first instruction sequence of the first algorithm program according to the verification rules; and determines a first verification value according to the verification rules and the first verification instruction; the algorithm provider receives a second verification value sent by the data provider, and the second verification value is determined by the data provider based on the verification rules and the second algorithm program; the second algorithm program is the algorithm program actually run by the data provider based on local data; the algorithm provider determines whether the first verification value and the second verification value are the same, thereby determining whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider.
[0008] In the above method, the algorithm provider sends the verification rules of the algorithm program - the first algorithm program, which is used to instruct the data provider to perform operations based on local data, to the data provider, so that the algorithm provider can obtain the first verification value according to the verification rules and the first algorithm program, and the data provider can obtain the second verification value according to the verification rules and the algorithm program - the second algorithm program actually run by the data provider. In this way, the algorithm provider can determine whether the first algorithm program and the second algorithm program are the same algorithm program according to whether the first verification value and the second verification value are the same, so as to further determine whether the algorithm program actually run by the data provider is the algorithm program that the algorithm provider instructs it to run. Compared with the prior art in which the algorithm provider directly obtains the number of the algorithm program returned by the data provider for verification, the problem of inaccurate verification results caused by an error in the version number of the algorithm program provided by the data provider can be prevented, that is, the correctness of the algorithm version verification is improved.
[0009] Optionally, the number of instructions in the first instruction sequence is N, and the verification rule includes a random challenge value uniquely corresponding to each instruction; the algorithm provider determines a first verification instruction from the first instruction sequence of the first algorithm program according to the verification rule, including: according to the order of each instruction in the first instruction sequence, the algorithm provider determines whether the instruction is a first verification instruction according to the random challenge value of each instruction; determining the first verification value according to the verification rule and the first verification instruction includes: according to the order of each instruction in the first instruction sequence, determining the iterative verification value corresponding to each first verification instruction in turn, until the iterative verification value corresponding to the last first verification instruction is obtained as the first verification value; wherein, the iterative verification value corresponding to each first verification instruction is obtained in the following manner: determining the iterative verification value corresponding to the first verification instruction according to the iterative verification value of the previous first verification instruction, the first verification instruction and the random challenge value corresponding to the first verification instruction.
[0010] In the above method, the algorithm provider makes each instruction have its unique corresponding random challenge value. Then, according to the order of the instructions in the first instruction sequence and the random challenge value of each instruction, it can be determined whether the instruction is the first verification instruction, and the iterative verification value corresponding to each verification instruction is determined in turn, until the iterative verification value corresponding to the last verification instruction is obtained as the first verification value. In this way, there is no need to calculate the verification value for all instructions in the instruction sequence, which can greatly reduce the amount of calculation.
[0011] Optionally, the verification rules also include an initial challenge value and a sampling rule; the algorithm provider determines whether the instruction is a first verification instruction based on the random challenge value of each instruction, including: for the first instruction, according to the sampling rule, the initial challenge value and the random challenge value of the first instruction, according to a preset trigger condition, determining whether the instruction is the first verification instruction; for the nth instruction, according to the iterative verification value of the n-1th instruction, the random challenge value of the nth instruction and the sampling rule, determining whether the nth instruction is the first verification instruction; n is an integer greater than 1; determining the iterative verification value of the first first verification instruction in the following manner, including: determining the iterative verification value of the first first verification instruction based on the initial challenge value, the first first verification instruction and the random challenge value corresponding to the first first verification instruction.
[0012] In the above method, by setting the trigger condition in the verification rule, it is judged whether the random challenge value corresponding to the instruction meets the trigger condition. If the trigger condition is met, it is a verification instruction, otherwise it is a non-verification instruction. In this way, the trigger condition can be used as a rule for selecting the verification instruction, and some instructions in the instruction sequence can be selected as verification instructions. There is no need to calculate the verification value for all instructions in the instruction sequence, which can greatly reduce the amount of calculation. And the sum of the random challenge value and the iterative verification value corresponding to the instruction can be processed according to the sampling rule, and the processed sampling value can be judged whether it meets the trigger condition. In this way, the randomness of the verification instruction determined by the trigger condition is improved, and the accuracy of the algorithm program version verification is further increased.
[0013] Optionally, the trigger condition satisfies the following formula:
[0014] (C+r i )&mask==0
[0015] Wherein, C is the initial challenge value or iterative check value, and r i is the random challenge value of the i-th instruction in the first instruction sequence, the mask is the sampling rule, and the sampling rule is determined according to the sampling frequency.
[0016] In the above method, the sampling rule is determined according to the sampling frequency, and the sampling frequency is determined according to the empirical value. In this way, it is ensured that the relationship between the number of verification instructions determined by the trigger condition and the number of instructions in the instruction sequence meets the resource limitation and accuracy requirements.
[0017] Optionally, it also includes: the algorithm provider converts the first instruction sequence of the first algorithm program, the verification rule and the first verification value into a first hash value, and sends the first hash value to the blockchain for storage.
[0018] In the above method, the above-mentioned first instruction sequence, verification rules, first verification value and other related information in the verification process are stored in the blockchain to ensure that they can be re-verified and audited during subsequent audits, thereby facilitating the audit process.
[0019] In a second aspect, an embodiment of the present invention provides a method for verifying an algorithm program, the method comprising:
[0020] The data provider receives the verification rules of the first algorithm program sent by the algorithm provider, where the first algorithm program is the algorithm program that the algorithm provider instructs the data provider to perform calculations based on local data;
[0021] The data provider determines a second verification instruction from a second instruction sequence of a second algorithm program according to the verification rule; and determines a second verification value according to the verification rule and the second verification instruction, wherein the second algorithm program is an algorithm program actually run by the data provider based on local data;
[0022] The data provider sends the second verification value to the algorithm provider, and the second verification value is used by the algorithm provider to determine whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider based on whether the second verification value is the same as the first verification value.
[0023] In the above method, the data provider receives the verification rules of the algorithm program - the first algorithm program sent by the algorithm provider to instruct the data provider to perform operations based on local data, so that the data provider can obtain the second verification value according to the verification rules and the algorithm program - the second algorithm program actually running; and the algorithm provider can obtain the first verification value according to the verification rules and the first algorithm program. In this way, the algorithm provider can determine whether the first algorithm program and the second algorithm program are the same algorithm program according to whether the first verification value and the second verification value are the same, so as to further determine whether the algorithm program actually run by the data provider is the algorithm program instructed by the algorithm provider to run. Compared with the prior art in which the algorithm provider directly obtains the number of the algorithm program returned by the data provider for verification, it can prevent the problem of inaccurate verification results caused by an error in the version number of the algorithm program provided by the data provider, that is, improve the correctness of the algorithm version verification.
[0024] Optionally, it also includes: the data provider converts the second instruction sequence, the verification rule and the second verification value into a second hash value, and sends the second hash value to the blockchain for storage.
[0025] In the above method, the above-mentioned second instruction sequence, verification rules, second verification value and other related information in the verification process are stored in the blockchain to ensure that they can be re-verified and audited during subsequent audits, thereby facilitating the audit process.
[0026] In a third aspect, an embodiment of the present invention provides a verification device for an algorithm program, the device comprising:
[0027] A transceiver module, used for sending the verification rules of the first algorithm program to the data provider, wherein the first algorithm program is an algorithm program that the algorithm provider instructs the data provider to perform calculations based on local data;
[0028] A processing module, configured to determine a check instruction from the instruction sequence of the first algorithm program according to the check rule; and determine a first check value according to the check rule and the check instruction;
[0029] The transceiver module is also used to receive a second verification value sent by the data provider, where the second verification value is determined by the data provider based on the verification rule and a second algorithm program; the second algorithm program is an algorithm program actually run by the data provider based on local data;
[0030] The processing module is further used to determine whether the first verification value and the second verification value are the same, so as to determine whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider.
[0031] In a fourth aspect, an embodiment of the present invention provides a verification device for an algorithm program, the device comprising:
[0032] A transceiver module, configured to receive a verification rule of a first algorithm program sent by an algorithm provider, wherein the first algorithm program is an algorithm program that the algorithm provider instructs the data provider to perform calculations based on local data;
[0033] a processing module, configured to determine a verification instruction from an instruction sequence of a second algorithm program according to the verification rule; and determine a second verification value according to the verification rule and the verification instruction, wherein the second algorithm program is an algorithm program actually run by the data provider based on local data;
[0034] The transceiver module is also used to send the second verification value to the algorithm provider, and the second verification value is used by the algorithm provider to determine whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider based on whether the second verification value is the same as the first verification value.
[0035] In a fifth aspect, an embodiment of the present application further provides a computing device, comprising: a memory for storing programs; a processor for calling the programs stored in the memory, and executing the methods described in various possible designs of the first aspect and the second aspect according to the obtained programs.
[0036] In a sixth aspect, an embodiment of the present application further provides a computer-readable non-volatile storage medium, comprising a computer-readable program. When a computer reads and executes the computer-readable program, the computer executes the method described in various possible designs of the first aspect and the second aspect.
[0037] These implementations or other implementations of the present application will be more concise and understandable in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0039] Figure 1 A schematic diagram of an architecture for verifying an algorithm program provided by an embodiment of the present invention;
[0040] Figure 2 A schematic diagram of the architecture of an algorithm provider provided in an embodiment of the present invention;
[0041] Figure 3A schematic diagram of the architecture of a data provider provided by an embodiment of the present invention;
[0042] Figure 4 A flowchart of a verification method for an algorithm program provided by an embodiment of the present invention;
[0043] FIG5( a) is a schematic flow chart of a verification method for an algorithm program provided by an embodiment of the present invention;
[0044] FIG5( b) is a schematic flow chart of a method for determining a check value provided by an embodiment of the present invention;
[0045] FIG5( c ) is a schematic flow chart of a method for determining a check value provided by an embodiment of the present invention;
[0046] Figure 6 A schematic diagram of a verification device for an algorithm program provided by an embodiment of the present invention;
[0047] Figure 7 A schematic diagram of a verification device for an algorithm program provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] Figure 1A system architecture for verifying an algorithm program provided in an embodiment of the present invention, wherein an algorithm provider 101 determines a first algorithm program provided to a data provider 102, that is, an algorithm program for instructing the data provider 102 to perform operations based on local data, and determines a verification rule for the first algorithm program; the verification rule is sent to the data provider 102, and the algorithm provider 101 determines a first verification value according to the first algorithm program and the verification rule. After receiving the verification rule sent by the algorithm provider, the data provider 102 verifies the algorithm program actually running in the data provider 102, that is, the second algorithm program, according to the verification rule, and obtains a second verification value, and the data provider 102 sends the second verification value to the algorithm provider 101, so that the algorithm provider 101 determines whether the algorithm program actually running by the data provider 102 is correct according to whether the first verification value and the second verification value are the same, that is, whether the second algorithm program is the first algorithm program. Among them, the information involved in the verification process of the algorithm provider 101 and the data provider 102 is stored in the blockchain 103 for subsequent auditing. The algorithm provider 101 may store information such as verification rules, first verification value, and second verification value in the blockchain 103 ; the data provider 102 may store information such as verification rules, and second verification value in the blockchain 103 .
[0050] It should be noted that the algorithm provider 101 may be a server or a server cluster, or a component in a server, such as a chip. Alternatively, the algorithm provider 101 may be a device or apparatus with the ability to provide algorithms. Exemplarily, the device may be a terminal device or a component in a terminal, such as a chip. The data provider 102 may be a database, a server or a server cluster, or a component in a server, such as a chip. Alternatively, the data provider 102 may be or have a device or apparatus capable of providing data. Exemplarily, the device may be a terminal device or a component in a terminal, such as a chip. The specific implementation method may be determined as needed and is not limited by the present invention.
[0051] In addition, an embodiment of the present invention provides an architecture diagram of an algorithm provider, such as Figure 2As shown, the algorithm provider may include an algorithm program library, a rule setting unit, and a verification unit. Among them, the algorithm program library may include various versions of algorithm programs; for example, algorithm programs corresponding to different types of data, and multiple versions of algorithm programs before and after the same algorithm program is updated; for example, algorithm programs for different computing requirements of the same type of data, and multiple versions of algorithm programs before and after the same algorithm program is updated, etc.; the rule setting unit can be used to generate verification rules according to the algorithm program and algorithm version verification requirements; the verification unit can verify the first algorithm program according to the verification rules in the rule setting unit to obtain a first verification value, and generate a verification result of the algorithm program according to the first verification value and the received second verification value. Here, the system architecture of the algorithm provider is only an example and does not limit the specific system architecture of the algorithm provider.
[0052] The embodiment of the present invention also provides a schematic diagram of the architecture of a data provider, such as Figure 3 As shown, the algorithm provider may include a database, a calculation unit, and a verification unit. The database may include local data of the data provider, such as business-related data or user personal information, etc. The calculation unit may be used by the data provider to calculate the local data according to the second algorithm program to obtain a calculation result, and the calculation result may also be sent to the algorithm provider; the verification unit may verify the second algorithm program according to the verification rules provided by the algorithm provider to obtain a second verification value, and send the second verification value to the algorithm provider. Here, the system architecture of the data provider is only an example, and does not limit the specific system architecture of the data provider.
[0053] Based on this, the present application embodiment provides a process of a verification method for an algorithm program, such as Figure 4 As shown, including:
[0054] Step 401: The algorithm provider sends the verification rules of the first algorithm program to the data provider, where the first algorithm program is the algorithm program that the algorithm provider instructs the data provider to perform calculations based on local data;
[0055] Step 402: the algorithm provider determines a first verification instruction from a first instruction sequence of the first algorithm program according to the verification rule; and determines a first verification value according to the verification rule and the first verification instruction;
[0056] Here, the instruction sequences of different algorithm programs are different.
[0057] Step 403: the algorithm provider receives a second verification value sent by the data provider, where the second verification value is determined by the data provider based on the verification rule and a second algorithm program; the second algorithm program is an algorithm program actually run by the data provider based on local data;
[0058] Step 404: The algorithm provider determines whether the first verification value and the second verification value are the same, thereby determining whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider.
[0059] In the above method, the algorithm provider sends the verification rules of the algorithm program - the first algorithm program, which is used to instruct the data provider to perform operations based on local data, to the data provider, so that the algorithm provider can obtain the first verification value according to the verification rules and the first algorithm program, and the data provider can obtain the second verification value according to the verification rules and the algorithm program - the second algorithm program actually run by the data provider. In this way, the algorithm provider can determine whether the first algorithm program and the second algorithm program are the same algorithm program according to whether the first verification value and the second verification value are the same, so as to further determine whether the algorithm program actually run by the data provider is the algorithm program that the algorithm provider instructs it to run. Compared with the prior art in which the algorithm provider directly obtains the number of the algorithm program returned by the data provider for verification, the problem of inaccurate verification results caused by an error in the version number of the algorithm program provided by the data provider can be prevented, that is, the correctness of the algorithm version verification is improved.
[0060] The embodiment of the present application provides a method for obtaining a verification instruction and an iterative verification value, wherein the number of instructions in the first instruction sequence is N, and the verification rule includes a random challenge value uniquely corresponding to each instruction; the algorithm provider determines a first verification instruction from the first instruction sequence of the first algorithm program according to the verification rule, including:
[0061] According to the order of the instructions in the first instruction sequence, the algorithm provider determines whether the instruction is a first verification instruction according to the random challenge value of each instruction;
[0062] The determining a first verification value according to the verification rule and the first verification instruction includes:
[0063] According to the order of the instructions in the first instruction sequence, the iterative check value corresponding to each first check instruction is determined in sequence until the iterative check value corresponding to the last first check instruction is obtained as the first check value; wherein the iterative check value corresponding to each first check instruction is obtained in the following manner:
[0064] According to the iterative check value of the previous first check instruction, the first check instruction and the random challenge value corresponding to the first check instruction, the iterative check value corresponding to the first check instruction is determined. That is to say, the number of instructions in the first instruction sequence is N, and each instruction in the N instructions has a corresponding random challenge value, and the random challenge value is used to determine whether the corresponding instruction is the first check instruction. For example, an instruction whose random challenge value is greater than a preset value or less than a preset value is a first check instruction; or the random challenge value is subjected to the corresponding calculation logic to obtain a corresponding calculation result, and whether the instruction is a first check instruction is determined according to the calculation result, etc.; here, how to determine the first check instruction according to the random challenge value of the instruction can be set as needed. Even when the number of instructions in the first instruction sequence is small, the Mth instruction can be directly set to be the first check instruction, where M is less than or equal to N; that is, the first check instruction can be directly specified. In addition, in the process of judging the first check instruction, each first check instruction can correspond to an iterative check value, and the iterative check value corresponding to the last first check instruction is the first check value. The iterative check value can be determined according to the iterative check value of the previous first check instruction, the first check instruction and the random challenge value corresponding to the first check instruction.
[0065] An embodiment of the present application provides another method for obtaining a verification instruction, wherein the verification rule also includes an initial challenge value and a sampling rule; the algorithm provider determines whether the instruction is a first verification instruction based on a random challenge value of each instruction, including: for the first instruction, according to the sampling rule, the initial challenge value and the random challenge value of the first instruction, according to a preset trigger condition, determining whether the instruction is the first verification instruction; for the nth instruction, according to the iterative verification value of the n-1th instruction, the random challenge value of the nth instruction and the sampling rule, determining whether the nth instruction is the first verification instruction; n is an integer greater than 1; determining the iterative verification value of the first first verification instruction in the following manner, including: determining the iterative verification value of the first first verification instruction based on the initial challenge value, the first first verification instruction and the random challenge value corresponding to the first first verification instruction. That is to say, in the process of determining the first verification instruction in the above-mentioned cycle, the initial verification value can be used as the initial iterative verification value; in this way, for the first instruction, according to the sampling rule, the initial challenge value (initial iterative verification value) and the random challenge value of the first instruction, determine whether the instruction is the first verification instruction according to the preset trigger condition; if so, determine the iterative verification value of the first first verification instruction according to the initial challenge value, the first first verification instruction and the random challenge value corresponding to the first first verification instruction (if it is not the first verification instruction, the initial verification value is not updated, and the next one is directly judged); then for the second instruction, based on According to the sampling rules, the iterative check value obtained in the previous step and the random challenge value of the second instruction, determine whether the instruction is the first check instruction according to the preset trigger conditions; if so, determine the iterative check value of the second first check instruction according to the iterative check value obtained in the previous step, the second first check instruction and the random challenge value corresponding to the second first check instruction (if it is not the first check instruction, the iterative check value is not updated, and the next one is directly judged); loop the judgment process of the first check instruction and the iterative process of the iterative check value until the last instruction is judged, and the current iterative check value is the first check value. In addition, the challenge value includes an initial challenge value and N random challenge values. The initial challenge value and the random challenge value here can be randomly determined, and there is no specific limitation.
[0066] The present application provides a trigger condition, which satisfies the following formula:
[0067] (C+r i )&mask==0
[0068] Wherein, C is the initial challenge value or iterative check value, and r iis the random challenge value of the i-th instruction in the first instruction sequence, and the mask is the sampling rule, which is determined according to the sampling frequency. That is to say, the formula is to sample and judge the sum of the initial challenge value or the iterative check value and the random challenge value of the i-th instruction; for example, the sum of the initial challenge value or the iterative check value and the random challenge value of the i-th instruction is converted to obtain a binary string or a hexadecimal string, etc. The sampling rule can be to select a substring of the last two or three digits, and determine whether the substring is 0. If it is zero, the trigger condition is met, otherwise the trigger condition is not met. Among them, the conversion rule of the sum of the initial challenge value or the iterative check value and the random challenge value of the i-th instruction is not specifically limited, and accordingly, the sampling rule can also be set accordingly. Among them, the sampling frequency can be determined according to the empirical value, and the sampling number of the sampling rule can be the product value of the number of instructions in the first instruction sequence and the sampling frequency. In this way, it is ensured that the relationship between the number of check instructions determined by the trigger condition and the number of instructions in the instruction sequence meets the resource limitation and accuracy requirements.
[0069] The embodiment of the present application provides a verification method for an algorithm program, further comprising: the algorithm provider converts the first instruction sequence of the first algorithm program, the verification rule and the first verification value into a first hash value, and sends the first hash value to the blockchain for storage. This facilitates subsequent audits by the algorithm provider and the data provider.
[0070] Based on the above method flow and system architecture, the present application embodiment provides a flow of a verification method for an algorithm program, as shown in FIG5(a), including:
[0071] Step 501: An algorithm provider determines to provide a first algorithm program to a data provider.
[0072] The first algorithm program includes a first instruction sequence. For example, the first instruction sequence of the first algorithm program may include 8 instructions: 1. s1 = a*X1. 2. s2 = b*X2. 3. s3 = 0. 4. LOOP:. 5. s3 = s3 + s2. 6. jump to LOOP if s3 < 100. 7. s2 = s3 * 5. 8. Y = s1 + s2. X1 and X2 may be sensitive data that the data provider needs to provide.
[0073] In addition, the algorithm provider may provide the data provider with a first algorithm program based on a request from a third party. For example, the third party may be an enterprise or an individual. Accordingly, the third party request may be a loan request from an enterprise or an individual. Alternatively, the algorithm provider may provide the data provider with a first algorithm program based on a request sent by the data provider. In one example, the algorithm provider may be a bank, and the data provider may be an institution that stores the credit, scale, turnover and other portrait information of the enterprise, and / or stores personal property and credit information; accordingly, the algorithm program may be used to determine whether the loan amount of the enterprise complies with the loan rules based on the information of the enterprise, or to determine whether the loan amount of the individual complies with the loan rules based on personal information. This is just an example and does not limit the algorithm provider and the data provider.
[0074] Step 502: The algorithm provider determines the verification rules.
[0075] In one example, the algorithm provider sets the sampling frequency, which can be 1 / 2 S ; Wherein, S is a positive integer parameter, the value of which can be determined empirically or in other ways, and is not limited in this application.
[0076] After the algorithm provider determines the sampling frequency, the algorithm provider can generate a sampling template based on the sampling frequency. For example, the sampling template can be mask = 0b1...1, indicating that the lowest S bits of the binary string are selected. Taking the sampling frequency of 1 / 4 as an example, S = 2, then the sampling template mask = 0b11, indicating that the lowest 2 bits of the binary string are selected.
[0077] If the first instruction sequence of the first algorithm program contains N instructions, the algorithm provider generates N+1 random challenge values as a random challenge value sequence R, denoted as R={r0, r1, …, r N}. For the 8 instructions in the above example, R contains 8+1=9 random numbers, namely r0, r1 to r8. Among them, the instructions correspond to the random challenge values one by one, for example, the first instruction corresponds to r1, the second instruction corresponds to r2, and the Nth instruction corresponds to r N , r0 is the initial challenge value.
[0078] Step 503: The algorithm provider sends the verification rules to the data provider.
[0079] In the above example, the algorithm provider sends the first instruction sequence, the sampling template, and the random challenge value sequence R to the data provider.
[0080] Step 504: The algorithm provider sends the verification rule to the blockchain for storage.
[0081] Step 505: After receiving the verification rule, the data provider verifies the second instruction sequence in the second algorithm program according to the verification rule to obtain a second verification value.
[0082] Based on the above example, a process for obtaining a verification value is provided here, as shown in FIG5(b): Step 5051, the data provider sets r0 as an initial verification value C=r0.
[0083] Step 5052: The data provider loads the second instruction sequence, and determines whether the first instruction satisfies the trigger condition (C+r1) & mask == 0. If so, step 5053 is executed; if not, C=r0, and step 5054 is executed.
[0084] Step 5053: Obtain an iterative check value according to the random challenge value r1 of the first instruction, the initial check value C=r0 and the first instruction update C.
[0085] In an example, assuming that the binary number form of the first instruction is: 0xEAF1C866, the method for obtaining the iteration check value may be: C=H (C=r0||r1||0xEAF1C866).
[0086] Step 5054: Get the next instruction, and for the next instruction, the ith instruction, determine whether the instruction satisfies the trigger condition (C+r i )&mask==0. If satisfied, execute step 5055; if not satisfied, C remains unchanged, execute step 5054.
[0087] Step 5055: According to the random challenge value r of the next instruction i , iterative check value C and the next instruction updates C to obtain the iterative check value.
[0088] In an example, assuming that the first instruction and the second instruction meet the starting condition, the binary number form of the second instruction is: 0xAAF1C899, and the method for obtaining the iterative check value can be: C=H(C=H(C=r0||r1||0xEAF1C866)||r2||0xAAF1C899).
[0089] Step 5056: Determine whether the last instruction in the second instruction sequence is completed, and the current iteration check value is the second check value.
[0090] Step 506: The data provider sends the second verification value to the algorithm provider. The data provider can also upload the second instruction sequence, the second verification value, the calculation result and other related information in the verification process to the blockchain for subsequent auditing.
[0091] Based on the above example, the data provider also sends the calculation result Y to the algorithm provider.
[0092] Step 507: The algorithm provider obtains a first verification value according to the verification rule and the first instruction sequence.
[0093] Based on the above example, a process for obtaining a check value is provided here, as shown in Figure 5(c):
[0094] Step 5071: The algorithm provider sets r0 as the initial check value C=r0.
[0095] Step 5072: The algorithm provider loads the first instruction sequence, and for the first instruction, determines whether the instruction satisfies the trigger condition (C+r1)&mask==0. If so, execute step 5073; if not, C=r0, and execute step 5074.
[0096] Step 5073: Obtain an iterative check value according to the random challenge value r1 of the first instruction, the initial check value C=r0 and the first instruction update C.
[0097] In an example, assuming that the binary number form of the first instruction is: 0xEAF1C866, the method for obtaining the iteration check value may be: C=H (C=r0||r1||0xEAF1C866).
[0098] Step 5074: Get the next instruction, and for the next instruction, the ith instruction, determine whether the instruction satisfies the trigger condition (C+r i )&mask==0. If satisfied, execute step 5075; if not satisfied, C remains unchanged, execute step 5074.
[0099] Step 5075: According to the random challenge value r of the next instruction i , iterative check value C and the next instruction updates C to obtain the iterative check value.
[0100] In an example, assuming that the first instruction and the second instruction meet the starting condition, the binary number form of the second instruction is: 0xAAF1C899, and the method for obtaining the iterative check value can be: C=H(C=H(C=r0||r1||0xEAF1C866)||r2||0xAAF1C899).
[0101] Step 5076: Determine whether the last instruction in the first instruction sequence is completed, and the current iteration check value is the first check value.
[0102] Step 508: The algorithm provider determines whether the first check value and the second check value are the same, if they are the same, the second algorithm program is the same as the first algorithm program, and if they are not the same, the second algorithm program is different from the first algorithm program.
[0103] It should be noted that the above process steps are not unique. For example, step 507 can be executed before or after any step from step 503 to step 506.
[0104] Based on the same concept, an embodiment of the present invention provides a verification device for an algorithm program. Figure 6 A schematic diagram of a verification device for an algorithm program provided in an embodiment of the present application, such as Figure 6 Including:
[0105] The transceiver module 601 is used to send the verification rules of the first algorithm program to the data provider, the first algorithm program is the algorithm program that the algorithm provider instructs the data provider to perform operations based on local data; the processing module 602 is used to determine the first verification instruction from the first instruction sequence of the first algorithm program according to the verification rules; and determine the first verification value according to the verification rules and the first verification instruction; the transceiver module 601 is also used to receive the second verification value sent by the data provider, the second verification value is determined by the data provider based on the verification rules and the second algorithm program; the second algorithm program is the algorithm program actually run by the data provider based on local data; the processing module 602 is also used to determine whether the first verification value and the second verification value are the same, so as to determine whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider.
[0106] Optionally, the number of instructions in the first instruction sequence is N, and the verification rules include a random challenge value uniquely corresponding to each instruction; the processing module 602 is specifically used to, in accordance with the order of the instructions in the first instruction sequence, the algorithm provider determines whether the instruction is a first verification instruction based on the random challenge value of each instruction; the processing module 602 is specifically used to, in accordance with the order of the instructions in the first instruction sequence, determine the iterative verification value corresponding to each first verification instruction in turn until the iterative verification value corresponding to the last first verification instruction is obtained as the first verification value; wherein, the iterative verification value corresponding to each first verification instruction is obtained in the following manner: according to the iterative verification value of the previous first verification instruction, the first verification instruction and the random challenge value corresponding to the first verification instruction, determine the iterative verification value corresponding to the first verification instruction.
[0107] Optionally, the verification rules also include an initial challenge value and a sampling rule; the processing module 602 is specifically used to, for the first instruction, determine whether the instruction is a first verification instruction according to a preset trigger condition based on the sampling rule, the initial challenge value and the random challenge value of the first instruction; for the nth instruction, determine whether the nth instruction is a first verification instruction based on the iterative verification value of the n-1th instruction, the random challenge value of the nth instruction and the sampling rule; n is an integer greater than 1; determine the iterative verification value of the first first verification instruction in the following manner, including: determining the iterative verification value of the first first verification instruction based on the initial challenge value, the first first verification instruction and the random challenge value corresponding to the first first verification instruction.
[0108] Optionally, the trigger condition satisfies the following formula:
[0109] (C+r i )&mask==0
[0110] Wherein, C is the initial challenge value or iterative check value, and r i is the random challenge value of the i-th instruction in the first instruction sequence, the mask is the sampling rule, and the sampling rule is determined according to the sampling frequency.
[0111] Optionally, the transceiver module 601 is also used to convert the first instruction sequence of the first algorithm program, the verification rule and the first verification value into a first hash value, and send the first hash value to the blockchain for storage.
[0112] Based on the same concept, an embodiment of the present invention provides a verification device for an algorithm program. Figure 7 A schematic diagram of a verification device for an algorithm program provided in an embodiment of the present application, such as Figure 7 Including:
[0113] The transceiver module 701 is used to receive the verification rules of the first algorithm program sent by the algorithm provider, the first algorithm program is the algorithm program that the algorithm provider instructs the data provider to perform operations based on local data; the processing module 702 is used to determine the second verification instruction from the second instruction sequence of the second algorithm program according to the verification rules; and determine the second verification value according to the verification rules and the second verification instruction, the second algorithm program is the algorithm program actually run by the data provider based on local data; the transceiver module 701 is also used to send the second verification value to the algorithm provider, the second verification value is used by the algorithm provider to determine whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider based on whether the second verification value is the same as the first verification value.
[0114] Optionally, the transceiver module 701 is also used to convert the second instruction sequence, the verification rule and the second verification value into a second hash value, and send the second hash value to the blockchain for storage.
[0115] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0116] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0117] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0119] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for verifying an algorithm program, characterized in that: The method comprises: The algorithm provider sends the verification rules of the first algorithm program to the data provider, where the first algorithm program is the algorithm program that the algorithm provider instructs the data provider to perform calculations based on local data; The algorithm provider determines whether the instruction is a first verification instruction according to the order of the instructions in the first instruction sequence of the first algorithm program and the random challenge value uniquely corresponding to each instruction in the verification rule, wherein the number of instructions in the first instruction sequence is N, N is a positive integer, and the verification rule includes the random challenge value uniquely corresponding to each instruction; The algorithm provider determines the iterative check value corresponding to each first check instruction in sequence according to the order of the instructions in the first instruction sequence, until the iterative check value corresponding to the last first check instruction is obtained, and uses it as the first check value; wherein the iterative check value corresponding to each first check instruction is obtained in the following manner: determining the iterative check value corresponding to each first check instruction according to the iterative check value of the previous first check instruction of each first check instruction, each first check instruction and the random challenge value corresponding to each first check instruction; The algorithm provider receives a second verification value sent by the data provider, where the second verification value is determined by the data provider based on the verification rule and a second algorithm program; the second algorithm program is an algorithm program actually run by the data provider based on local data; The algorithm provider determines whether the first check value and the second check value are the same, thereby determining whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider.
2. The method according to claim 1, characterized in that The verification rules also include an initial challenge value and a sampling rule; The algorithm provider determines, according to the random challenge value of each instruction, whether the instruction is a first verification instruction, including: For the first instruction, according to the sampling rule, the initial challenge value and the random challenge value of the first instruction, and according to a preset trigger condition, determine whether the instruction is a first verification instruction; For the nth instruction, determine whether the nth instruction is a first verification instruction according to the iterative verification value of the n-1th instruction, the random challenge value of the nth instruction and the sampling rule; n is an integer greater than 1; The iterative check value of the first first check instruction is determined in the following manner, including: An iterative verification value of the first first verification instruction is determined according to the initial challenge value, the first first verification instruction and the random challenge value corresponding to the first first verification instruction.
3. The method as claimed in claim 2, characterized in that The trigger condition satisfies the following formula: (C+r i )&mask==0 Wherein, C is the initial challenge value or iterative check value, and r i is the random challenge value of the i-th instruction in the first instruction sequence, the mask is the sampling rule, and the sampling rule is determined according to the sampling frequency.
4. The method according to any one of claims 1 to 3, characterized in that Also includes: The algorithm provider converts the first instruction sequence of the first algorithm program, the verification rule and the first verification value into a first hash value, and sends the first hash value to the blockchain for storage.
5. A method for verifying an algorithm program, characterized in that: The method comprises: The data provider receives the verification rules of the first algorithm program sent by the algorithm provider, where the first algorithm program is the algorithm program that the algorithm provider instructs the data provider to perform calculations based on local data; The data provider determines whether the instruction is a second verification instruction according to the order of each instruction in the second instruction sequence of the second algorithm program and the random challenge value uniquely corresponding to each instruction in the verification rule, the number of instructions in the second instruction sequence is N, N is a positive integer, the verification rule includes the random challenge value uniquely corresponding to each instruction, and the second algorithm program is the algorithm program actually run by the data provider based on local data; The data provider determines the iterative check value corresponding to each second check instruction in sequence according to the order of the instructions in the second instruction sequence, until the iterative check value corresponding to the last second check instruction is obtained, and uses it as the second check value; wherein the iterative check value corresponding to each second check instruction is obtained in the following manner: determining the iterative check value corresponding to each second check instruction according to the iterative check value of the previous second check instruction of each second check instruction, each second check instruction and the random challenge value corresponding to each second check instruction; The data provider sends the second verification value to the algorithm provider, and the second verification value is used by the algorithm provider to determine whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider based on whether the second verification value is the same as the first verification value.
6. The method according to claim 5, characterized in that Also includes: The data provider converts the second instruction sequence, the verification rule and the second verification value into a second hash value, and sends the second hash value to the blockchain for storage.
7. A verification device for an algorithm program, characterized in that: The device comprises: A transceiver module, used for sending the verification rules of the first algorithm program to the data provider, wherein the first algorithm program is an algorithm program that the algorithm provider instructs the data provider to perform calculations based on local data; A processing module, used to determine whether the instruction is a first verification instruction according to the order of each instruction in the first instruction sequence of the first algorithm program and the random challenge value uniquely corresponding to each instruction in the verification rule, the number of instructions in the first instruction sequence is N, N is a positive integer, and the verification rule includes a random challenge value uniquely corresponding to each instruction; according to the order of each instruction in the first instruction sequence, sequentially determine the iterative verification value corresponding to each first verification instruction until the iterative verification value corresponding to the last first verification instruction is obtained, and use it as the first verification value; wherein the iterative verification value corresponding to each first verification instruction is obtained in the following manner: according to the iterative verification value of the previous first verification instruction of each first verification instruction, each first verification instruction and the random challenge value corresponding to each first verification instruction, determine the iterative verification value corresponding to each first verification instruction; The transceiver module is also used to receive a second verification value sent by the data provider, where the second verification value is determined by the data provider based on the verification rule and a second algorithm program; the second algorithm program is an algorithm program actually run by the data provider based on local data; The processing module is further used to determine whether the first verification value and the second verification value are the same, so as to determine whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider.
8. A verification device for an algorithm program, characterized in that: The device comprises: A transceiver module, configured to receive a verification rule of a first algorithm program sent by an algorithm provider, wherein the first algorithm program is an algorithm program that the algorithm provider instructs the data provider to perform calculations based on local data; A processing module, used to determine whether the instruction is a second verification instruction according to the order of each instruction in the second instruction sequence of the second algorithm program and the random challenge value uniquely corresponding to each instruction in the verification rule, the number of instructions in the second instruction sequence is N, N is a positive integer, the verification rule includes a random challenge value uniquely corresponding to each instruction, and the second algorithm program is an algorithm program actually run by the data provider based on local data; the data provider determines the iterative verification value corresponding to each second verification instruction in turn according to the order of each instruction in the second instruction sequence until the iterative verification value corresponding to the last second verification instruction is obtained, and uses it as the second verification value; wherein the iterative verification value corresponding to each second verification instruction is obtained in the following manner: the iterative verification value corresponding to each second verification instruction is determined according to the iterative verification value of the previous second verification instruction of each second verification instruction, each second verification instruction and the random challenge value corresponding to each second verification instruction; The transceiver module is also used to send the second verification value to the algorithm provider, and the second verification value is used by the algorithm provider to determine whether the algorithm program actually run by the data provider is the algorithm program indicated by the algorithm provider based on whether the second verification value is the same as the first verification value.
9. A computer device, characterized in that: include: Memory for storing computer programs; A processor is used to call the computer program stored in the memory, and execute the method according to any one of claims 1 to 6 according to the obtained program.
Citation Information
Patent Citations
Software tamper-proofing verification method and software tamper-proofing verification device
CN104134021A
File verification method and a related device
CN109492436A
Network security protection method and system
CN111182551A
Automated data supplementation and verification
US20170220670A1
