# US 2025/0148081 A1 · Virus detection method, apparatus, and electronic device, storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0148081 A1
- Document ID: US20250148081A1
- Status: Published application
- Kind: A1
- Application number: 18/934,107
- Filed: 2024-10-31
- Published: 2025-05-08
- Earliest claimed: 2023-11-06
- Assignees: New H3C Network Information Security Software Co., Ltd.
- Applicants: New H3C Network Information Security Software Co., Ltd.
- Inventors: Longfei HU
- Web page: https://patentgrep.com/patent/US20250148081A1

## CPC

- G06F 21/56: Computer malware detection or handling, e.g. anti-virus arrangements
- G06F 21/564: {by virus signature recognition}
- G06F 16/152: {using file content signatures, e.g. hash values}
- H04L 63/101: {Access control lists [ACL]}
- H04L 63/145: {the attack involving the propagation of malware through the network, e.g. viruses, trojans or worms}
- G06F 2221/034: Test or assess a computer or a system
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

Method apparatus, storage medium, and electronic device for virus detection are provided. The method includes: computing a target hash digest of a file to be detected, and based on the hash functions of a preset Bloom filter and the target hash digest, computing the bit indices of the file to be detected in the preset Bloom filter; the bit indices of each known virus file in the preset Bloom filter are determined based on a hash digest of the corresponding known virus file, and all of parameter values corresponding to the bit indices of each known virus file in the preset Bloom filter are a preset value; determining whether the file to be detected is a virus file based on the preset Bloom filter and the corresponding bit index of the file to be detected.

## Claims

### Claim 1

A virus detection method, the method comprising:
computing a target hash digest of a file to be detected;
computing bit indices of the file to be detected in a preset Bloom filter based on hash functions of the preset Bloom filter and the target hash digest; wherein bit indices of each known virus file in the preset Bloom filter are determined based on a hash digest of the corresponding known virus file; and all of parameter values corresponding to the bit indices of each known virus file in the preset Bloom filter are a preset value;
determining whether the file to be detected is a virus file based on the preset Bloom filter and the bit indices corresponding to the file to be detected.

### Claim 2 (depends on 1)

The method according to claim 1, wherein computing the bit indices of the file to be detected in the preset Bloom filter based on the hash functions of the preset Bloom filter and the target hash digest comprises:
computing hash values of the target hash digest respectively based on the hash functions of the preset Bloom filter;
determining the computed hash values as corresponding bit indices of the file to be detected in the preset Bloom filter.

### Claim 3 (depends on 1)

The method according to claim 1, wherein determining whether the file to be detected is a virus file based on the preset Bloom filter and the bit indices corresponding to the file to be detected comprises:
querying target parameter values of the bit indices corresponding to the file to be detected in the preset Bloom filter;
in response to a determination that at least one of the target parameter values is not the preset value, determining that the file to be detected is not a virus file;
in response to a determination that all the target parameter values of the bit indices are the preset value, performing virus detection on the file to be detected based on at least one of a preset whitelist, a preset blacklist, and an external storage device to identify whether the file to be detected is a virus file;
wherein the preset whitelist stores hash digests of a plurality of non-virus files, the preset blacklist stores hash digests of a plurality of virus files, and the external storage device stores hash digests of each known virus file.

### Claim 4 (depends on 3)

The method according to claim 3, wherein performing virus detection on the file to be detected based on the preset whitelist and the preset blacklist comprises:
in response to a determination that the target hash digest of the file to be detected exists in the preset whitelist, determining that the file to be detected is not a virus file; or,
in response to a determination that the target hash digest of the file to be detected does not exist in the preset whitelist but exists in the preset blacklist, determining that the file to be detected is a virus file.

### Claim 5 (depends on 3)

The method according to claim 3, wherein performing virus detection on the file to be detected based on the preset whitelist, the preset blacklist, and the external storage device comprises:
in response to a determination that the target hash digest of the file to be detected does not exist in both the preset whitelist and the preset blacklist but exists in the hash digests of known virus files stored in the external storage device, determining that the file to be detected is a virus file and storing the target hash digest of the file to be detected in the preset blacklist;
in response to a determination that the target hash digest of the file to be detected does not exist in both the preset whitelist and the preset blacklist and does not exist in the hash digests of known virus files stored in the external storage device, determining that the file to be detected is not a virus file and storing the target hash digest of the file to be detected in the preset whitelist.

### Claim 6 (depends on 5)

The method according to claim 5, wherein the method further comprises:
in response to a determination that the target hash digest of the file to be detected exists in the preset whitelist or the preset blacklist, obtaining a historical storage time of an existing hash digest that is identical to the target hash digest of the file to be detected;
updating the historical storage time to a current time.

### Claim 7 (depends on 5)

The method according to claim 5, wherein storing the target hash digest of the file to be detected in the preset blacklist comprises:
in a case where an amount of data in the preset blacklist reaches a preset amount, obtaining a hash digest with an earliest storage time from the preset blacklist; deleting the hash digest with the earliest storage time; storing the target hash digest of the file to be detected to the preset blacklist; or in a case where the amount of data in the preset blacklist does not reach the preset amount, directly storing the target hash digest of the file to be detected to the preset blacklist;
setting a storage time of the target hash digest to a current time.

### Claim 8 (depends on 1)

The method according to claim 1, wherein determining bit indices of each known virus file in the preset Bloom filter based on a hash digest of the corresponding known virus file comprises:
computing a hash digest of each known virus file according to a preset hash function;
computing hash values of the hash digest of each known virus file respectively according to the hash functions of the preset Bloom filter;
determining the computed hash values corresponding to each known virus file as corresponding bit indices of the corresponding known virus file in the preset Bloom filter;
setting parameter values corresponding to the bit indices of the respective known virus files in the preset Bloom filter to the preset value.

### Claim 9 (depends on 1)

A non-transitory computer storage medium, wherein the computer storage medium stores a plurality of instructions, which are suitable for being loaded and executed by a processor, causing the processor to perform the method according to claim 1.

### Claim 10

An electronic device, wherein the electronic device comprises: a processor and a memory; wherein, the memory stores computer programs, which are suitable for being loaded and executed by the processor, causing the processor to perform operations comprising:
computing a target hash digest of a file to be detected;
computing bit indices of the file to be detected in a preset Bloom filter based on hash functions of the preset Bloom filter and the target hash digest; wherein bit indices of each known virus file in the preset Bloom filter are determined based on a hash digest of the corresponding known virus file; and all of parameter values corresponding to the bit indices of each known virus file in the preset Bloom filter are a preset value;
determining whether the file to be detected is a virus file based on the preset Bloom filter and the bit indices corresponding to the file to be detected.

### Claim 11 (depends on 10)

The electronic device according to claim 10, wherein computing the bit indices of the file to be detected in the preset Bloom filter based on the hash functions of the preset Bloom filter and the target hash digest comprises:
computing hash values of the target hash digest respectively based on the hash functions of the preset Bloom filter;
determining the computed hash values as corresponding bit indices of the file to be detected in the preset Bloom filter.

### Claim 12 (depends on 10)

The electronic device according to claim 10, wherein determining whether the file to be detected is a virus file based on the preset Bloom filter and the bit indices corresponding to the file to be detected comprises:
querying target parameter values of the bit indices corresponding to the file to be detected in the preset Bloom filter;
in response to a determination that at least one of the target parameter values is not the preset value, determining that the file to be detected is not a virus file;
in response to a determination that all the target parameter values of the bit indices are the preset value, performing virus detection on the file to be detected based on at least one of a preset whitelist, a preset blacklist, and an external storage device to identify whether the file to be detected is a virus file;
wherein the preset whitelist stores hash digests of a plurality of non-virus files, the preset blacklist stores hash digests of a plurality of virus files, and the external storage device stores hash digests of each known virus file.

### Claim 13 (depends on 12)

The electronic device according to claim 12, wherein performing virus detection on the file to be detected based on the preset whitelist and the preset blacklist comprises:
in response to a determination that the target hash digest of the file to be detected exists in the preset whitelist, determining that the file to be detected is not a virus file; or,
in response to a determination that the target hash digest of the file to be detected does not exist in the preset whitelist but exists in the preset blacklist, determining that the file to be detected is a virus file.

### Claim 14 (depends on 12)

The electronic device according to claim 12, wherein performing virus detection on the file to be detected based on the preset whitelist, the preset blacklist, and the external storage device comprises:
in response to a determination that the target hash digest of the file to be detected does not exist in both the preset whitelist and the preset blacklist but exists in the hash digests of known virus files stored in the external storage device, determining that the file to be detected is a virus file and storing the target hash digest of the file to be detected in the preset blacklist;
in response to a determination that the target hash digest of the file to be detected does not exist in both the preset whitelist and the preset blacklist and does not exist in the hash digests of known virus files stored in the external storage device, determining that the file to be detected is not a virus file and storing the target hash digest of the file to be detected in the preset whitelist.

### Claim 15 (depends on 14)

The electronic device according to claim 14, wherein the operations further comprise:
in response to a determination that the target hash digest of the file to be detected exists in the preset whitelist or the preset blacklist, obtaining a historical storage time of an existing hash digest that is identical to the target hash digest of the file to be detected;
updating the historical storage time to a current time.

### Claim 16 (depends on 14)

The electronic device according to claim 14, wherein storing the target hash digest of the file to be detected in the preset blacklist comprises:
in a case where an amount of data in the preset blacklist reaches a preset amount, obtaining a hash digest with an earliest storage time from the preset blacklist; deleting the hash digest with the earliest storage time; storing the target hash digest of the file to be detected to the preset blacklist; or in a case where the amount of data in the preset blacklist does not reach the preset amount, directly storing the target hash digest of the file to be detected to the preset blacklist;
setting a storage time of the target hash digest to a current time.

### Claim 17 (depends on 10)

The electronic device according to claim 10, wherein determining bit indices of each known virus file in the preset Bloom filter based on a hash digest of the corresponding known virus file comprises:
computing a hash digest of each known virus file according to a preset hash function;
computing hash values of the hash digest of each known virus file respectively according to the hash functions of the preset Bloom filter;
determining the computed hash values corresponding to each known virus file as corresponding bit indices of the corresponding known virus file in the preset Bloom filter;
setting parameter values corresponding to the bit indices of the respective known virus files in the preset Bloom filter to the preset value.
