Verification method and device of algorithm program

文档序号:169014 发布日期:2021-10-29 浏览:27次 中文

阅读说明:本技术 一种算法程序的验证方法及装置 (Verification method and device of algorithm program ) 是由 严强 廖飞强 李昊轩 王朝阳 李辉忠 张开翔 范瑞彬 于 2021-07-30 设计创作,主要内容包括:本发明实施例提供一种算法程序的验证方法及装置,包括:算法提供方将第一算法程序的校验规则发送至数据提供方,第一算法程序为算法提供方指示数据提供方基于本地数据进行运算的算法程序;根据校验规则从第一算法程序的第一指令序列中确定出第一校验指令;并根据校验规则和第一校验指令确定第一校验值;算法提供方接收数据提供方发送的第二校验值,第二校验值是数据提供方基于校验规则和第二算法程序确定的;第二算法程序为数据提供方基于本地数据实际运行的算法程序;算法提供方确定第一校验值和第二校验值是否相同,从而确定数据提供方实际运行的算法程序是否为算法提供方指示的算法程序。该方法能够提高算法版本验证的准确性,防止误用攻击。(The embodiment of the invention provides a method and a device for verifying an algorithm program, wherein the method comprises the following steps: the method comprises the steps that an algorithm provider sends a check rule of a first algorithm program to a data provider, and the first algorithm program is an algorithm program which instructs the data provider to operate based on local data; determining a first checking instruction from a first instruction sequence of the first algorithm program according to a checking rule; determining a first check value according to the check rule and the first check instruction; the algorithm provider receives a second check value sent by the data provider, and the second check value is determined by the data provider based on the check rule and a second algorithm program; the second algorithm program is an algorithm program which is actually operated 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 operated by the data provider is the algorithm program instructed by the algorithm provider. The method can improve the accuracy of algorithm version verification and prevent misuse attacks.)

1. A method of validating an algorithmic program, the method comprising:

the method comprises the steps that an algorithm provider sends a check rule of a first algorithm program to a data provider, and the first algorithm program is an algorithm program which instructs the data provider to operate 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 rule; determining a first check value according to the check rule and the first check instruction;

the algorithm provider receives a second check value sent by the data provider, wherein the second check value is determined by the data provider based on the check rule and a second algorithm program; the second algorithm program is an algorithm program which is actually operated 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 operated by the data provider is the algorithm program instructed by the algorithm provider.

2. The method of claim 1, wherein the number of instructions in the first sequence of instructions is N, and wherein the check rule includes a random challenge value uniquely corresponding to each instruction; the algorithm provider determines a first verification instruction from a first instruction sequence of the first algorithm program according to the verification rule, and the method comprises the following steps:

according to the sequence of each instruction in the first instruction sequence, the algorithm provider determines whether the instruction is a first check instruction according to the random challenge value of each instruction;

the determining a first check value according to the check rule and the first check instruction includes:

sequentially determining an iteration check value corresponding to each first check instruction according to the sequence of each instruction in the first instruction sequence until an iteration check value corresponding to the last first check instruction is obtained and is used as the first check value; the iteration check value corresponding to each first check instruction is obtained through the following method:

and determining an iterative check value corresponding to the first check instruction according to the iterative check value of the last first check instruction, the first check instruction and the random challenge value corresponding to the first check instruction.

3. The method of claim 2, wherein the verification rules further include an initial challenge value and a sampling rule;

the algorithm provider determines whether the instruction is a first check instruction according to the random challenge value of each instruction, and the method comprises the following steps:

for a first instruction, determining whether the instruction is a first checking instruction according to a preset trigger condition according to the sampling rule, the initial challenge value and a random challenge value of the first instruction;

for an nth instruction, determining whether the nth instruction is a first check instruction according to an iteration check value of an (n-1) th instruction, a random challenge value of the nth instruction and the sampling rule; n is an integer greater than 1;

determining an iterative check value of a first check instruction by:

and determining an iterative verification value of the first verification instruction according to the initial challenge value, the first verification instruction and a random challenge value corresponding to the first verification instruction.

4. A method as claimed in claim 3, wherein the trigger condition satisfies the following formula:

(C+ri)&mask==0

wherein C is an initial challenge value or an iterative check value, and r isiThe mask is the sampling rule which is a random challenge value of the ith instruction in the first instruction sequence, and the sampling rule is determined according to the sampling frequency.

5. The method of any of claims 1 to 4, further comprising:

and the algorithm provider converts the first instruction sequence of the first algorithm program, the check rule and the first check value into a first hash value and sends the first hash value to a block chain for storage.

6. A method of validating an algorithmic program, the method comprising:

the method comprises the steps that a data provider receives a check rule of a first algorithm program sent by an algorithm provider, wherein the first algorithm program is an algorithm program which instructs the algorithm provider to operate based on local data;

the data provider determines a second check instruction from a second instruction sequence of a second algorithm program according to the check rule; determining a second check value according to the check rule and the second check instruction, wherein the second algorithm program is an algorithm program which is actually operated by the data provider based on local data;

and the data provider sends the second check value to the algorithm provider, and the second check value is used for the algorithm provider to determine whether the algorithm program actually operated by the data provider is the algorithm program indicated by the algorithm provider according to whether the second check value is the same as the first check value.

7. The method of claim 6, further comprising:

and the data provider converts the second instruction sequence, the check rule and the second check value into a second hash value and sends the second hash value to a block chain for storage.

8. An apparatus for verifying an algorithm program, the apparatus comprising:

the system comprises a receiving and sending module, a data provider and a data processing module, wherein the receiving and sending module is used for sending a check rule of a first algorithm program to the data provider, and the first algorithm program is an algorithm program which instructs the data provider to operate based on local data;

the processing module is used for determining a first verification instruction from a first instruction sequence of the first algorithm program according to the verification rule; determining a first check value according to the check rule and the first check instruction;

the transceiver module is further configured to receive a second check value sent by the data provider, where the second check value is determined by the data provider based on the check rule and a second algorithm program; the second algorithm program is an algorithm program which is actually operated by the data provider based on local data;

the processing module is further used for determining whether the first check value and the second check value are the same, so as to determine whether the algorithm program actually operated by the data provider is the algorithm program instructed by the algorithm provider.

9. An apparatus for verifying an algorithm program, the apparatus comprising:

the system comprises a receiving and sending module, a verification module and a verification module, wherein the receiving and sending module is used for receiving a verification rule of a first algorithm program sent by an algorithm provider, and the first algorithm program is an algorithm program which indicates the data provider to operate based on local data by the algorithm provider;

the processing module is used for determining a second check instruction from a second instruction sequence of a second algorithm program according to the check rule; determining a second check value according to the check rule and the second check instruction, wherein the second algorithm program is an algorithm program which is actually operated by the data provider based on local data;

the transceiver module is further configured to send the second check value to the algorithm provider, where the second check value is used by the algorithm provider to determine whether the algorithm program actually run by the data provider is the algorithm program instructed by the algorithm provider according to whether the second check value is the same as the first check value.

10. A computer device, comprising:

a memory for storing a computer program;

a processor for calling a computer program stored in said memory to execute the method of any of claims 1 to 7 in accordance with the obtained program.

Technical Field

The present application relates to the field of network technologies, and in particular, to a method and an apparatus for verifying an algorithm program.

Background

The algorithm outsourcing computation is used as a relatively new collaborative computation form, and provides an implementation idea for 'data immobility and value mobility'. In the cooperative computing process, data of the data provider does not need to be exported, and the algorithm program provided by the algorithm provider is called through the corresponding interface, so that the local data of the data provider can be processed, the existing compliance requirements are met, and meanwhile, the challenge is brought to the verification of the accuracy of the computing result of the outsourced algorithm program.

The version verification method in the prior art generally comprises the following steps: the algorithm provider acquires the algorithm version number sent by the data provider, verifies the algorithm version number, and determines whether the algorithm version number is the algorithm version number of the correct algorithm version corresponding to the data provider, namely, the algorithm provider verifies whether the algorithm version number of the algorithm program remotely deployed on the data server is correct. So as to verify the called algorithm program. The method is easy to be attacked by misuse due to the simple version verification method, and for example, if the algorithm program version is updated by the data provider and the original algorithm version number is still returned, the algorithm provider cannot perform accurate verification.

Therefore, there is a need for a method and an apparatus for verifying an algorithm program, which can improve the accuracy of verifying the algorithm version and prevent misuse attacks.

Disclosure of Invention

The embodiment of the invention provides a method and a device for verifying an algorithm program, which can improve the accuracy of algorithm version verification and prevent misuse attack.

In a first aspect, an embodiment of the present invention provides a method for verifying an algorithm program, where the method includes:

the method comprises the steps that an algorithm provider sends a check rule of a first algorithm program to a data provider, and the first algorithm program is an algorithm program which instructs the data provider to operate 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 rule; determining a first check value according to the check rule and the first check instruction; the algorithm provider receives a second check value sent by the data provider, wherein the second check value is determined by the data provider based on the check rule and a second algorithm program; the second algorithm program is an algorithm program which is actually operated 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 operated by the data provider is the algorithm program instructed by the algorithm provider.

In the method, the algorithm provider sends the verification rule of the first algorithm program, which is an algorithm program for instructing the data provider to perform operation based on the local data, to the data provider, so that the algorithm provider can obtain the first verification value according to the verification rule and the first algorithm program, and the data provider can obtain the second verification value according to the verification rule and the second algorithm program, which is an algorithm program actually operated by the data provider. In this way, the algorithm provider may determine whether the first algorithm program and the second algorithm program are the same algorithm program according to whether the first check value and the second check value are the same, so as to further determine whether the algorithm program actually operated by the data provider is the algorithm program instructed to be operated by the algorithm provider. Compared with the prior art that the algorithm provider directly obtains the number of the algorithm program returned by the data provider for verification, the method and the device can prevent the problem that the verification result is inaccurate due to the error of the version number of the algorithm program provided by the data provider, namely improve the correctness of the verification of the version of the algorithm.

Optionally, the number of instructions in the first instruction sequence is N, and the check rule includes a random challenge value uniquely corresponding to each instruction; the algorithm provider determines a first verification instruction from a first instruction sequence of the first algorithm program according to the verification rule, and the method comprises the following steps: according to the sequence of each instruction in the first instruction sequence, the algorithm provider determines whether the instruction is a first check instruction according to the random challenge value of each instruction; the determining a first check value according to the check rule and the first check instruction includes: sequentially determining an iteration check value corresponding to each first check instruction according to the sequence of each instruction in the first instruction sequence until an iteration check value corresponding to the last first check instruction is obtained and is used as the first check value; the iteration check value corresponding to each first check instruction is obtained through the following method: and determining an iterative check value corresponding to the first check instruction according to the iterative check value of the last first check instruction, the first check instruction and the random challenge value corresponding to the first check instruction.

In the above method, the algorithm provider makes each instruction have its unique corresponding random challenge value. Then, according to the sequence of each instruction in the first instruction sequence and according to the random challenge value of each instruction, determining whether the instruction is a first check instruction, and sequentially determining the iterative check value corresponding to each check instruction until the iterative check value corresponding to the last check instruction is obtained as the first check value. Therefore, check values do not need to be calculated for all instructions in the instruction sequence, and the calculation amount can be greatly reduced.

Optionally, the check rule further includes an initial challenge value and a sampling rule; the algorithm provider determines whether the instruction is a first check instruction according to the random challenge value of each instruction, and the method comprises the following steps: for a first instruction, determining whether the instruction is a first checking instruction according to a preset trigger condition according to the sampling rule, the initial challenge value and a random challenge value of the first instruction; for an nth instruction, determining whether the nth instruction is a first check instruction according to an iteration check value of an (n-1) th instruction, a random challenge value of the nth instruction and the sampling rule; n is an integer greater than 1; determining an iterative check value of a first check instruction by: and determining an iterative verification value of the first verification instruction according to the initial challenge value, the first verification instruction and a random challenge value corresponding to the first verification instruction.

In the method, whether the random challenge value corresponding to the instruction meets the trigger condition is judged by setting the trigger condition in the check rule, if the random challenge value meets the trigger condition, the random challenge value is a check instruction, and if the random challenge value does not meet the trigger condition, the random challenge value is a non-check instruction. Therefore, the trigger condition can be used as a rule for selecting the check instruction, part of instructions in the instruction sequence can be selected as the check instruction, check values do not need to be calculated aiming at all the instructions in the instruction sequence, and the calculation amount can be greatly reduced. And the sum of the random challenge value and the iterative check value corresponding to the instruction can be processed according to the sampling rule, and the processed sampling value is judged whether to meet the triggering condition. Therefore, the randomness of the check instruction determined by the trigger condition is improved, and the accuracy of the verification of the algorithm program version is further improved.

Optionally, the trigger condition satisfies the following formula:

(C+ri)&mask==0

wherein C is an initial challenge value or an iterative check value, and r isiThe mask is the sampling rule which is a random challenge value of the ith instruction in the first instruction sequence, and the sampling rule is determined according to the sampling frequency.

In the method, the sampling rule is determined according to the sampling frequency, and the sampling frequency is determined according to an empirical value. Therefore, the relation between the number of the check instructions determined by the trigger condition and the number of the instructions in the instruction sequence is ensured to meet the requirements of resource limitation and accuracy.

Optionally, the method further includes: and the algorithm provider converts the first instruction sequence of the first algorithm program, the check rule and the first check value into a first hash value and sends the first hash value to a block chain for storage.

In the method, the first instruction sequence, the check rule, the first check value and other related information in the verification process are stored in the block chain, so that the verification and the audit can be carried out again during the subsequent audit, and the audit process is convenient to carry out.

In a second aspect, an embodiment of the present invention provides a method for verifying an algorithm program, where the method includes:

the method comprises the steps that a data provider receives a check rule of a first algorithm program sent by an algorithm provider, wherein the first algorithm program is an algorithm program which instructs the algorithm provider to operate based on local data;

the data provider determines a second check instruction from a second instruction sequence of a second algorithm program according to the check rule; determining a second check value according to the check rule and the second check instruction, wherein the second algorithm program is an algorithm program which is actually operated by the data provider based on local data;

and the data provider sends the second check value to the algorithm provider, and the second check value is used for the algorithm provider to determine whether the algorithm program actually operated by the data provider is the algorithm program indicated by the algorithm provider according to whether the second check value is the same as the first check value.

In the method, a data provider receives a verification rule of an algorithm program, namely a first algorithm program, which is sent by the algorithm provider and used for indicating the data provider to operate based on local data, so that the data provider can obtain a second verification value according to the verification rule and an actually operated algorithm program, namely a second algorithm program; and the algorithm provider may obtain the first check value according to the check rule and the first algorithm program. In this way, the algorithm provider may determine whether the first algorithm program and the second algorithm program are the same algorithm program according to whether the first check value and the second check value are the same, so as to further determine whether the algorithm program actually operated by the data provider is the algorithm program instructed to be operated by the algorithm provider. Compared with the prior art that the algorithm provider directly obtains the number of the algorithm program returned by the data provider for verification, the method and the device can prevent the problem that the verification result is inaccurate due to the error of the version number of the algorithm program provided by the data provider, namely improve the correctness of the verification of the version of the algorithm.

Optionally, the method further includes: and the data provider converts the second instruction sequence, the check rule and the second check value into a second hash value and sends the second hash value to a block chain for storage.

In the method, the second instruction sequence, the check rule, the second check value and other related information in the verification process are stored in the block chain, so that the verification and the audit can be carried out again during the subsequent audit, and the audit process is convenient to carry out.

In a third aspect, an embodiment of the present invention provides an apparatus for verifying an algorithm program, where the apparatus includes:

the system comprises a receiving and sending module, a data provider and a data processing module, wherein the receiving and sending module is used for sending a check rule of a first algorithm program to the data provider, and the first algorithm program is an algorithm program which instructs the data provider to operate based on local data;

the processing module is used for determining a verification instruction from the instruction sequence of the first algorithm program according to the verification rule; determining a first check value according to the check rule and the check instruction;

the transceiver module is further configured to receive a second check value sent by the data provider, where the second check value is determined by the data provider based on the check rule and a second algorithm program; the second algorithm program is an algorithm program which is actually operated by the data provider based on local data;

the processing module is further used for determining whether the first check value and the second check value are the same, so as to determine whether the algorithm program actually operated by the data provider is the algorithm program instructed by the algorithm provider.

In a fourth aspect, an embodiment of the present invention provides an apparatus for verifying an algorithm program, where the apparatus includes:

the system comprises a receiving and sending module, a verification module and a verification module, wherein the receiving and sending module is used for receiving a verification rule of a first algorithm program sent by an algorithm provider, and the first algorithm program is an algorithm program which indicates the data provider to operate based on local data by the algorithm provider;

the processing module is used for determining a verification instruction from the instruction sequence of the second algorithm program according to the verification rule; determining a second check value according to the check rule and the check instruction, wherein the second algorithm program is an algorithm program which is actually operated by the data provider based on local data;

the transceiver module is further configured to send the second check value to the algorithm provider, where the second check value is used by the algorithm provider to determine whether the algorithm program actually run by the data provider is the algorithm program instructed by the algorithm provider according to whether the second check value is the same as the first check value.

In a fifth aspect, an embodiment of the present application further provides a computing device, including: a memory for storing a program; a processor for calling the program stored in said memory and executing the method as described in the various possible designs of the first and second aspects in accordance with the obtained program.

In a sixth aspect, embodiments of the present application further provide a computer-readable non-volatile storage medium, which includes a computer-readable program, and when the computer-readable program is read and executed by a computer, the computer is caused to perform the method as described in the various possible designs of the first and second aspects.

These and other implementations of the present application will be more readily understood from the following description of the embodiments.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.

Fig. 1 is a schematic diagram of an architecture for verifying an algorithm according to an embodiment of the present invention;

fig. 2 is a schematic architecture diagram of an algorithm provider according to an embodiment of the present invention;

fig. 3 is a schematic architecture diagram of a data provider according to an embodiment of the present invention;

FIG. 4 is a flowchart illustrating a method for verifying an algorithm according to an embodiment of the present invention;

fig. 5(a) is a schematic flowchart of a verification method for an algorithm program according to an embodiment of the present invention;

fig. 5(b) is a schematic flowchart of a check value determining method according to an embodiment of the present invention;

fig. 5(c) is a schematic flowchart of a check value determining method according to an embodiment of the present invention;

FIG. 6 is a schematic diagram of an apparatus for verifying an algorithm program according to an embodiment of the present invention;

fig. 7 is a schematic diagram of a verification apparatus for an algorithm program according to an embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

Fig. 1 is a system architecture for verifying an algorithm program according to an embodiment of the present invention, in which 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 an operation based on local data, and determines a check rule of the first algorithm program; the check rule is sent to the data provider 102 and the algorithm provider 101 determines a first check value according to the first algorithm program and the check rule. After receiving the check rule sent by the algorithm provider, the data provider 102 checks the actually running algorithm program in the data provider 102 according to the check rule, that is, the second algorithm program, to obtain a second check value, and the data provider 102 sends the second check value to the algorithm provider 101, so that the algorithm provider 101 determines whether the actually running algorithm program of the data provider 102 is correct according to whether the first check value and the second check value are the same, that is, whether the second algorithm program is the first algorithm program. Information involved in the authentication process by both 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 a check rule, a first check value, a second check value, etc. into the block chain 103; the data provider 102 may store the collation rules, the second parity values, etc. information into the blockchain 103.

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 having an algorithm providing capability, which may be, for example, 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 cluster of servers, or a component in a server, such as a chip. Alternatively, the data provider 102 may be or have a device or apparatus that provides data capabilities, which may be, for example, a terminal device or a component in a terminal, such as a chip. The specific implementation manner can be determined according to needs, and the invention is not limited.

In addition, as shown in fig. 2, the architecture diagram of the algorithm provider provided by the embodiment of the present invention may include an algorithm library, a rule setting unit, and a verification unit. The algorithm program library can contain various versions of algorithm programs; for example, algorithm programs respectively corresponding to different types of data and multi-version algorithm programs before and after updating of the same algorithm program; for another example, algorithm programs with different calculation requirements for the same type of data, multi-version algorithm programs before and after updating of the same algorithm program, and the like; the rule setting unit can be used for generating a check rule according to the verification requirements of the algorithm program and the algorithm version; the check unit may check the first algorithm program according to the check rule in the rule setting unit to obtain a first check value, and generate a check result of the algorithm program according to the first check value and the received second check value. Here, the system architecture of the algorithm provider is only an example, and the specific system architecture of the algorithm provider is not limited.

As shown in fig. 3, the algorithm provider may include a database, a calculation unit, and a verification unit. The database can contain local data of a data provider; such as service-related data, or personal information of the user, etc.; the calculation unit may be configured to calculate the local data by the data provider according to the second algorithm program to obtain a calculation result, and may further send the calculation result to the algorithm provider; the verification unit may verify the second algorithm program according to a verification rule 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 the specific system architecture of the data provider is not limited.

Based on this, the embodiment of the present application provides a flow of a verification method of an algorithm program, as shown in fig. 4, including:

step 401, an algorithm provider sends a check rule of a first algorithm program to a data provider, wherein the first algorithm program is an algorithm program which instructs the data provider to operate based on local data;

step 402, the algorithm provider determines a first check instruction from a first instruction sequence of the first algorithm program according to the check rule; determining a first check value according to the check rule and the first check instruction;

here, the instruction sequences of different algorithm programs are different.

Step 403, the algorithm provider receives a second check value sent by the data provider, wherein the second check value is determined by the data provider based on the check rule and a second algorithm program; the second algorithm program is an algorithm program which is actually operated by the data provider based on local data;

step 404, the algorithm provider determines whether the first check value and the second check value are the same, so as to determine whether the algorithm program actually operated by the data provider is the algorithm program instructed by the algorithm provider.

In the method, the algorithm provider sends the verification rule of the first algorithm program, which is an algorithm program for instructing the data provider to perform operation based on the local data, to the data provider, so that the algorithm provider can obtain the first verification value according to the verification rule and the first algorithm program, and the data provider can obtain the second verification value according to the verification rule and the second algorithm program, which is an algorithm program actually operated by the data provider. In this way, the algorithm provider may determine whether the first algorithm program and the second algorithm program are the same algorithm program according to whether the first check value and the second check value are the same, so as to further determine whether the algorithm program actually operated by the data provider is the algorithm program instructed to be operated by the algorithm provider. Compared with the prior art that the algorithm provider directly obtains the number of the algorithm program returned by the data provider for verification, the method and the device can prevent the problem that the verification result is inaccurate due to the error of the version number of the algorithm program provided by the data provider, namely improve the correctness of the verification of the version of the algorithm.

The embodiment of the application provides a method for obtaining a check instruction and an iteration check value, wherein the number of instructions in a first instruction sequence is N, and the check rule comprises a random challenge value uniquely corresponding to each instruction; the algorithm provider determines a first verification instruction from a first instruction sequence of the first algorithm program according to the verification rule, and the method comprises the following steps:

according to the sequence of each instruction in the first instruction sequence, the algorithm provider determines whether the instruction is a first check instruction according to the random challenge value of each instruction;

the determining a first check value according to the check rule and the first check instruction includes:

sequentially determining an iteration check value corresponding to each first check instruction according to the sequence of each instruction in the first instruction sequence until an iteration check value corresponding to the last first check instruction is obtained and is used as the first check value; the iteration check value corresponding to each first check instruction is obtained through the following method:

and determining an iterative check value corresponding to the first check instruction according to the iterative check value of the last first check instruction, the first check instruction and the random challenge value corresponding to the first check instruction. That is, 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. If the random challenge value is larger than the preset value, or the instruction smaller than the preset value is a first verification instruction; or the random challenge value is subjected to corresponding calculation logic to obtain a corresponding calculation result, and whether the instruction is a first check instruction or not is determined according to the calculation result; the first check instruction may be set as desired herein with respect to how to determine the first check instruction from the random challenge value of the instruction. Even, when the number of instructions in the first instruction sequence is small, the mth bit instruction can be directly set and selected as the first check instruction, wherein M is less than or equal to N; i.e. the first check instruction can be directly specified. In addition, in the process of judging the first check instruction, each first check instruction may correspond to one 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 and the random challenge value corresponding to the first check instruction and the first check instruction.

The embodiment of the application provides another method for obtaining a check instruction, wherein the check rule further comprises an initial challenge value and a sampling rule; the algorithm provider determines whether the instruction is a first check instruction according to the random challenge value of each instruction, and the method comprises the following steps: for a first instruction, determining whether the instruction is a first checking instruction according to a preset trigger condition according to the sampling rule, the initial challenge value and a random challenge value of the first instruction; for an nth instruction, determining whether the nth instruction is a first check instruction according to an iteration check value of an (n-1) th instruction, a random challenge value of the nth instruction and the sampling rule; n is an integer greater than 1; determining an iterative check value of a first check instruction by: and determining an iterative verification value of the first verification instruction according to the initial challenge value, the first verification instruction and a random challenge value corresponding to the first verification instruction. That is, in the process of determining the first check instruction in the loop, the initial check value may be used as an initial iterative check value; thus, for a first instruction, determining whether the instruction is a first verification instruction according to a preset trigger condition according to a sampling rule, an initial challenge value (initial iteration verification value) and a random challenge value of the first instruction; if yes, determining an iterative verification value of the first verification instruction according to the initial challenge value, the first verification instruction and a random challenge value corresponding to the first verification instruction (if not, the initial verification value is not updated, and the next verification instruction is directly judged); then, aiming at the second instruction, determining whether the instruction is the first check instruction according to a preset trigger condition according to a sampling rule, the iteration check value obtained in the previous step and a random challenge value of the second instruction; if yes, determining an iterative check value of a second first check instruction according to the iterative check value obtained in the last step, the second first check instruction and a random challenge value corresponding to the second first check instruction (if not, the iterative check value is not updated, and the next iteration check value is directly judged); and circularly executing the judging process of the first checking instruction and the iterative process of the iterative checking value until the judgment of the last instruction is completed, wherein the current iterative checking value is the first checking value. In addition, the challenge value includes an initial challenge value and N random challenge values, where both the initial challenge value and the random challenge value may be randomly determined, and are not limited specifically.

The embodiment of the application provides a trigger condition, and the trigger condition meets the following formula:

(C+ri)&mask==0

wherein C is an initial challenge value or an iterative check value, and r isiThe mask is the sampling rule which is a random challenge value of the ith instruction in the first instruction sequence, and the sampling rule is determined according to the sampling frequency. That is, 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 ith instruction; for example, the sum of the initial challenge value or the iterative verification value and the random challenge value of the ith instruction is converted to obtain a binary string or a hexadecimal string, and the like, the sampling rule may be to select a last two-bit or three-bit sub-string, and determine whether the sub-string is 0, if so, the triggering condition is satisfied, otherwise, the triggering condition is not satisfied. The conversion rule of the sum of the initial challenge value or the iterative verification value and the random challenge value of the ith instruction is not specifically limited, and correspondingly, the sampling rule may also be set correspondingly. Wherein, the sampling frequency may be determined according to an empirical value, and the sampling number of the sampling rule may be a product value of the number of instructions in the first instruction sequence and the sampling frequency. Therefore, the relation between the number of the check instructions determined by the trigger condition and the number of the instructions in the instruction sequence is ensured to meet the requirements of resource limitation and accuracy.

The embodiment of the application provides a verification method of an algorithm program, which further comprises the following steps: and the algorithm provider converts the first instruction sequence of the first algorithm program, the check rule and the first check value into a first hash value and sends the first hash value to a block chain for storage. In this way, subsequent algorithm providers and data providers are facilitated to audit.

Based on the above method flow and system architecture, an embodiment of the present application provides a flow of a verification method of an algorithm program, as shown in fig. 5(a), including:

step 501, an algorithm provider determines to provide a first algorithm program for a data provider.

The first algorithm program comprises 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 is 0. 4. LOOP: . 5. s3 ═ s3+ s 2. 6. jump to LOOP if 3< 100. 7. s2 ═ s3 × 5. 8. Y-s 1+ s 2. Wherein, X1, X2 can be the sensitive data that the data provider needs to provide.

In addition, the algorithm provider may provide the first algorithm program to the data provider upon request of a third party, which may be, for example, a business or an individual, etc. Accordingly, the third party request may be a request for a business or individual loan. Alternatively, the algorithm provider may provide the first algorithm program to the data provider upon a request sent by the data provider. In one example, the algorithm provider may be a bank, and the data provider may be a mechanism that stores image information such as credit, size, turnover, etc. of an enterprise, and/or stores information such as personal property and credit; correspondingly, the algorithm program can be used for judging whether the loan amount of the enterprise accords with the loan rules according to the information of the enterprise, or judging whether the individual loan amount accords with the loan rules according to the personal information, and the like. This is merely an example and is not intended to be limiting with respect to algorithm providers and data providers.

Step 502, the algorithm provider determines the verification rule.

In one example, the algorithm provider sets a sampling frequency, which may be 1/2S(ii) a Wherein S is a positive integer parameter, and the value of the parameter may be determined empirically or in other manners, which is not limited in this application.

After the algorithm provider determines the sampling frequency, the algorithm provider may generate a sampling template according to the sampling frequency. For example, the sampling template may be mask 0b1 … 1, which indicates that the lowest S bits of the binary string are selected. Taking the sampling frequency 1/4 as an example, if S is 2, the sampling template mask is 0b11, which indicates that the lowest 2 bits of the binary string are selected.

If the first instruction sequence of the first algorithm program includes N instructions, the algorithm provider generates N +1 random challenge values as a random challenge value sequence R, which is denoted as R ═ { R ═ R0,r1,…,rN}. For the 8 instructions in the above example, R contains 8+1 ═ 9 random numbers, R respectively0、r1To r8. Where the instructions correspond to random challenge values one-to-one, e.g., the first instruction corresponds to r1The second instruction corresponds to r2The Nth instruction corresponds to rN,r0Is the initial challenge value.

Step 503, the algorithm provider sends the verification rule to the data provider.

In the above example, the algorithm provider sends the first sequence of instructions, the sampling template, the sequence of random challenge values R to the data provider.

Step 504, the algorithm provider sends the check rule to the blockchain storage.

And 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.

Based on the above example, there is provided a check value acquisition flow, as shown in fig. 5 (b): step 5051, the data provider will r0Setting the initial check value C-r0

Step 5052, the data provider loads the second instruction sequence, and determines whether the instruction satisfies the trigger condition (C + r) for the first instruction1)&mask-0. If yes, step 5053 is performed, and if not, C-r0Step 5054 is performed.

Step 5053 random challenge r from the first instruction1The initial check value C ═ r0And updating C by the first instruction to obtain an iteration check value.

In one example, assume that the binary shape of the first instruction is: 0xEAF1C866, the method for obtaining the iterative verification value may be: c ═ H (C ═ r)0||r1||0xEAF1C866)。

Step 5054, acquiring the next instruction, and judging whether the instruction meets the trigger condition (C + r) for the next instruction, i-th instructioni)&mask-0. If so, step 5055 is performed, and if not, C is unchanged, step 5054 is performed.

Step 5055 random challenge value r from the next instructioniAnd updating C by the iteration check value C and the next instruction to obtain the iteration check value.

In one example, assuming that the first instruction and the second instruction satisfy the departure condition, the binary number form of the second instruction is: 0xAAF1C899, the method for obtaining the iterative check value may be: c ═ H (C ═ r)0||r1||0xEAF1C866)||r2||0xAAF1C899)。

Step 5056, it is determined that the last instruction in the second instruction sequence is judged to be completed, and the current iteration check value is the second check value.

Step 506, the data provider sends the second check value to the algorithm provider. The data provider can also upload related information in the checking process, such as the second instruction sequence, the second checking value, the calculation result and the like, to the block chain for subsequent auditing.

Based on the above example, the data provider also sends the calculation result Y to the algorithm provider.

And step 507, the algorithm provider acquires a first check value according to the check rule and the first instruction sequence.

Based on the above example, there is provided a check value acquisition flow, as shown in fig. 5 (c):

step 5071, the algorithm provider will send r0Setting the initial check value C-r0

Step 5072, the algorithm provider loads a first instruction sequence, and determines whether the instruction satisfies a trigger condition (C + r) for the first instruction1)&mask-0. If yes, go to step 5073, if not, C ═ r0Then step 5074 is performed.

5073 random challenge r according to the first instruction1The initial check value C ═ r0And updating C by the first instruction to obtain an iteration check value.

In one example, assume that the binary shape of the first instruction is: 0xEAF1C866, the method for obtaining the iterative verification value may be: c ═ H (C ═ r)0||r1||0xEAF1C866)。

Step 5074, obtainingTaking a next instruction, and judging whether the instruction meets the trigger condition (C + r) or not aiming at the next instruction, i-th instructioni)&mask-0. If yes, step 5075 is executed, and if no, step 5074 is executed.

5075 random challenge r according to the next instructioniAnd updating C by the iteration check value C and the next instruction to obtain the iteration check value.

In one example, assuming that the first instruction and the second instruction satisfy the departure condition, the binary number form of the second instruction is: 0xAAF1C899, the method for obtaining the iterative check value may be: c ═ H (C ═ r)0||r1||0xEAF1C866)||r2||0xAAF1C899)。

Step 5076, determining that the last instruction in the first instruction sequence is judged to be complete, and the current iteration check value is the first check value.

And step 508, the algorithm provider determines whether the first check value and the second check value are the same, and if so, the second algorithm program is the same as the first algorithm program. If not, the second algorithm program is different from the first algorithm program.

It should be noted that, the above-mentioned steps of the flow are not exclusive, for example, step 507 may be executed before or after any step of steps 503 to 506.

Based on the same concept, an embodiment of the present invention provides a verification apparatus for an algorithm program, and fig. 6 is a schematic diagram of the verification apparatus for an algorithm program provided in the embodiment of the present application, as shown in fig. 6, including:

the system comprises a transceiver module 601, a data provider and a data processing module, wherein the transceiver module 601 is used for sending a check rule of a first algorithm program to the data provider, and the first algorithm program is an algorithm program which instructs the data provider to operate based on local data; a processing module 602, configured to determine a first check instruction from a first instruction sequence of the first algorithm program according to the check rule; determining a first check value according to the check rule and the first check instruction; the transceiver module 601 is further configured to receive a second check value sent by the data provider, where the second check value is determined by the data provider based on the check rule and a second algorithm; the second algorithm program is an algorithm program which is actually operated by the data provider based on local data; the processing module 602 is further configured to determine whether the first check value and the second check value are the same, so as to determine whether the algorithm program actually run by the data provider is the algorithm program instructed by the algorithm provider.

Optionally, the number of instructions in the first instruction sequence is N, and the check rule includes a random challenge value uniquely corresponding to each instruction; the processing module 602 is specifically configured to, according to an order of each instruction in the first instruction sequence, determine, by the algorithm provider, whether the instruction is a first check instruction according to a random challenge value of each instruction; the processing module 602 is specifically configured to sequentially determine, according to an order of each instruction in the first instruction sequence, an iterative check value corresponding to each first check instruction until an iterative check value corresponding to a last first check instruction is obtained as the first check value; the iteration check value corresponding to each first check instruction is obtained through the following method: and determining an iterative check value corresponding to the first check instruction according to the iterative check value of the last first check instruction, the first check instruction and the random challenge value corresponding to the first check instruction.

Optionally, the check rule further includes an initial challenge value and a sampling rule; the processing module 602 is specifically configured to, for a first instruction, determine whether the instruction is a first verification instruction according to a preset trigger condition according to the sampling rule, the initial challenge value, and a random challenge value of the first instruction; for an nth instruction, determining whether the nth instruction is a first check instruction according to an iteration check value of an (n-1) th instruction, a random challenge value of the nth instruction and the sampling rule; n is an integer greater than 1; determining an iterative check value of a first check instruction by: and determining an iterative verification value of the first verification instruction according to the initial challenge value, the first verification instruction and a random challenge value corresponding to the first verification instruction.

Optionally, the trigger condition satisfies the following formula:

(C+ri)&mask==0

wherein C is an initial challenge value or an iterative check value, and r isiThe mask is the sampling rule which is a random challenge value of the ith instruction in the first instruction sequence, and the sampling rule is determined according to the sampling frequency.

Optionally, the transceiver module 601 is further configured to convert the first instruction sequence of the first algorithm program, the check rule, and the first check value into a first hash value, and send the first hash value to the block chain for storage.

Based on the same concept, an embodiment of the present invention provides a verification apparatus for an algorithm program, and fig. 7 is a schematic diagram of the verification apparatus for an algorithm program provided in the embodiment of the present application, as shown in fig. 7, including:

the system comprises a transceiver module 701, a data providing module and a processing module, wherein the transceiver module 701 is used for receiving a check rule of a first algorithm program sent by an algorithm providing party, and the first algorithm program is an algorithm program which is used by the algorithm providing party to instruct a data providing party to operate based on local data; a processing module 702, configured to determine a second check instruction from a second instruction sequence of the second algorithm program according to the check rule; determining a second check value according to the check rule and the second check instruction, wherein the second algorithm program is an algorithm program which is actually operated by the data provider based on local data; the transceiver module 701 is further configured to send the second check value to the algorithm provider, where the second check value is used by the algorithm provider to determine whether the algorithm program actually run by the data provider is the algorithm program instructed by the algorithm provider according to whether the second check value is the same as the first check value.

Optionally, the transceiver module 701 is further configured to convert the second instruction sequence, the check rule, and the second check value into a second hash value, and send the second hash value to the block chain for storage.

As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.

The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such 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 intended to include such modifications and variations as well.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于区块链的车位管理系统及方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类