A method for anti-repackaging, the method comprising: running, by an operating system, a target file in an installation package installed on the operating system, and loading, by the operating system, a secure dynamic library in the installation package, wherein the secure dynamic library stores verification information about the installation package; obtaining, by the operating system, digital watermark information embedded in the target file and verification information stored in the secure dynamic library based on code in the target file; and verifying, by the operating system, based on the digital watermark information and the verification information, whether the installation package is a repackaged installation package, comprising: determining that the digital watermark information is an instruction: performing an operation based on the instruction to obtain an operation result; verifying whether the operation result is consistent with an operation result in the verification information, and verifying whether the instruction is consistent with an instruction in the verification information; if the operation result is consistent with the operation result in the verification information and the instruction is consistent with the instruction in the verification information, determining that the installation package is an original installation package; and if the operation result is inconsistent with the verification information or the instruction is inconsistent with the instruction in the verification information, determining that the installation package is the repackaged installation package. running, by an operating system, a target file in an installation package installed on the operating system, and loading, by the operating system, a secure dynamic library in the installation package, wherein the secure dynamic library stores verification information about the installation package; obtaining, by the operating system, digital watermark information embedded in the target file and verification information stored in the secure dynamic library based on code in the target file; and verifying, by the operating system, based on the digital watermark information and the verification information, whether the installation package is a repackaged installation package, comprising: determining that the digital watermark information is an instruction: performing an operation based on the instruction to obtain an operation result; verifying whether the operation result is consistent with an operation result in the verification information, and verifying whether the instruction is consistent with an instruction in the verification information; if the operation result is consistent with the operation result in the verification information and the instruction is consistent with the instruction in the verification information, determining that the installation package is an original installation package; and if the operation result is inconsistent with the verification information or the instruction is inconsistent with the instruction in the verification information, determining that the installation package is the repackaged installation package. performing an operation based on the instruction to obtain an operation result; verifying whether the operation result is consistent with an operation result in the verification information, and verifying whether the instruction is consistent with an instruction in the verification information; if the operation result is consistent with the operation result in the verification information and the instruction is consistent with the instruction in the verification information, determining that the installation package is an original installation package; and if the operation result is inconsistent with the verification information or the instruction is inconsistent with the instruction in the verification information, determining that the installation package is the repackaged installation package.