Hardware Trojan horse detection method and device based on circuit netlist characteristics and storage medium

By analyzing the characteristics of the circuit netlist and using machine learning methods to build a classifier, the problem of low detection accuracy of hardware Trojans is solved, and higher detection accuracy and flexibility are achieved.

CN119577850APending Publication Date: 2025-03-07TIANJIN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411453443.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The prior art has low accuracy in hardware Trojan detection, making it difficult to effectively identify potential hardware Trojans.

Method used

By analyzing the characteristics of the circuit netlist, the number of input and output ports, topology, triggers, inverters and multiplexers of the nodes are extracted, and the feature set is constructed and a classifier is built using machine learning methods such as KNN and Random Forests to distinguish and detect hardware Trojan nodes.

Benefits of technology

It improves the accuracy of hardware Trojan detection, can flexibly adjust the data set, avoid machine learning overfitting, and achieve high distinction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005089799030000031
    Figure BDA0005089799030000031
  • Figure BDA0005089799030000032
    Figure BDA0005089799030000032
  • Figure BDA0005089799030000041
    Figure BDA0005089799030000041
Patent Text Reader

Abstract

A hardware Trojan horse detection method based on circuit netlist characteristics belongs to the field of integrated circuit hardware security detection, solves the problem of how to improve the accuracy of hardware Trojan horse detection, and comprises the following steps: abstracting examples, a main input port and a main output port into nodes for processing, and abstracting wire type variables directly connected with the examples, the input port and the output port into directed edges for processing; after being abstracted, the netlist is regarded as a topological structure in which nodes are directly connected with one another, and each node feature comprises a directed edge taking the node as an initial node, a directed edge taking the node as an end point and a module type corresponding to the node; nine structural features including node fan-in and fan-out, the number of inverters before and after the node, the number of multiplexers, the number of triggers, the number of layers from the node to the main input and the main output, and the distance from the node to a key link are established; and higher distinguishing accuracy is achieved by using fewer feature types, and when different types of circuit nodes are distinguished, hardware Trojan horse node distinguishing can be flexibly adjusted to train a classifier data set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of integrated circuit hardware security detection, and relates to a hardware Trojan detection method, device and storage medium based on circuit netlist features. Background Art

[0002] With the development of computer and network technology, the importance of hardware security has become increasingly prominent. The globalization trend of the integrated circuit (IC) industry chain has led to untrusted links in the design and manufacturing process, increasing the risk of hardware Trojan implantation, which may cause problems such as tampering with the design, performance degradation, and information leakage. In recent years, the importance of hardware Trojan detection technology in the field of information security has been increasing. Due to the high reliance on the trustworthiness of hardware by traditional concepts, the defense measures at the hardware level are relatively weak, which makes the detection and defense research of hardware Trojans in the IC design stage a key issue.

[0003] There are two main methods for detecting hardware Trojans: static detection and dynamic detection. Hardware Trojans are malicious circuits hidden inside integrated circuits. Under certain circumstances, hardware Trojans will be activated and perform stealing, tampering or destruction operations, which seriously threaten the security of the chip. Static detection methods analyze data such as gate-level netlists in the integrated circuit design stage to find abnormal structures that do not conform to normal circuits to identify potential hardware Trojans. In contrast, dynamic detection methods focus more on detecting abnormal behaviors or abnormal power consumption characteristics by monitoring the behavior and performance of circuits during chip operation, thereby identifying hardware Trojans. Since hardware Trojans can disguise themselves as part of a normal circuit, dynamic detection is often more challenging than static detection in actual applications, but it is also more effective. Currently, widely used dynamic detection methods include power consumption analysis, timing analysis, and temperature monitoring.

[0004] Among them, analysis at the netlist level is one of the important methods for hardware Trojan detection. The netlist is an intermediate product in the integrated circuit design stage, which describes the logical structure and connection relationship of the circuit. By analyzing the netlist, potential hardware Trojans can be detected. Specifically, the detection methods at the netlist level include structure matching and abnormal behavior analysis. The structure matching method compares the netlist structure of the normal circuit, finds abnormal circuits that do not match it, and identifies possible hardware Trojans. The abnormal behavior analysis is based on the logical function and timing characteristics of the circuit to identify malicious circuits that may be triggered at runtime. This method plays an important role in hardware Trojan detection because it can detect problems early in the design stage. Summary of the invention

[0005] The technical solution of the present invention is used to solve the problem of how to improve the accuracy of hardware Trojan detection.

[0006] The present invention solves the above technical problems through the following technical solutions:

[0007] The present invention provides a hardware Trojan detection method based on circuit netlist features, comprising the following steps:

[0008] Step 1. Download the infected circuit containing the hardware Trojan and the corresponding benchmark circuit without the hardware Trojan from the Trust-HUB website. The downloaded files include RTL code files and netlist files. Perform structural feature extraction of the hardware Trojan and information extraction on the netlist based on Python. The netlists used include the circuit netlist without the Trojan and the circuit netlist containing the Trojan to construct a feature set containing normal nodes and Trojan nodes for training the classifier. Abstract all instantiated devices and input and output ports in the netlist into node processing, so as to distinguish all nodes into hardware Trojan nodes and normal nodes.

[0009] Step 2: Remove the redundant information contained in the netlist, and construct a regular expression to extract and store the key information of the netlist: input port name, output port name, instantiated device and corresponding module.

[0010] Step 3: Extract information from all modules according to the symbol library definition file, including module name and input / output port name, and store them as mio_txt file; distinguish the input and output ports of each instantiated device in the netlist_txt file according to the mio_txt file and save the vio_txt file; store the total input / output ports in the flattened netlist file;

[0011] Step 4: Count the number of input ports and output ports of each instantiated device, so as to establish the number of input ports and output ports of each node;

[0012] Step 5. Establish the topological structure of the netlist. According to the distinguished vio_txt file, construct a directed graph structure, including directed edges and nodes. The directed edges are represented as start instances and end instances. The name of each directed edge is named after the declared wire type variable name, that is, "wire network type: start instance --> end instance", which is stored as an arc_txt file; extract the construction point set of each node's brief information, that is, module name, instance name, input port name and output port name, and store it as a vex_txt file;

[0013] Step 6: Perform a breadth-first traversal before and after each node in the established directed graph, and count the number of triggers in multiple layers before and after the traversal of all nodes;

[0014] Step 7: Perform a breadth-first traversal before and after each node in the established directed graph, and count the number of inverters in multiple layers before and after the traversal of all nodes;

[0015] Step 8: Perform a breadth-first traversal before and after each node in the established directed graph, and count the number of multiplexers in multiple layers before and after the traversal of all nodes;

[0016] Step 9: Establish a directed graph structure for the netlist, start traversing from the total input port node of the entire netlist, end at all total output port nodes, add a layer number label to each node, that is, the distance of each node from the main input, traverse all nodes and total output ports at the same time, calculate the distance of each node from the output port as the distance of each node from the total output port node, and use these two parameters to construct a feature set;

[0017] Step 10: Traverse from all starting points to the end points in the established netlist topology structure to obtain all possible data links, retain the length of the data link and all instance names contained in this data link, compare all data links, compare the lengths, retain the data link with the largest number of instances, i.e., the longest data link as the key path, and store all instances as a key_road file;

[0018] Step 11: Calculate the distance between all nodes in the netlist and nodes on the critical path. For instances that are already on the critical path, their distance to the critical connection is defined as 0. For all other instance nodes, calculate the distance between the instance nodes with similar layers in the critical link according to their layers. Take the minimum distance as the distance between the node and the critical path, which is used as one of the features for constructing the feature set.

[0019] Step 12: Repeat steps 2 to 11 for all netlists until the feature sets of all netlists are obtained. The feature sets are sorted into an xlsx table, and the default values ​​in the table are filled with '-1'. For repeated node feature rows, delete them, denoise the normal nodes, and use the SMOTE method to expand the features of the hardware Trojan nodes, adjust the ratio of majority class samples to minority class samples, and avoid overfitting when training the classifier using the machine learning method.

[0020] Step 13: Use machine learning methods to build a classifier, set the parameters of the classifier, label the preprocessed feature set with two types of labels, '0' and '1', and divide them into training sets and test sets, convert the data types and feed them to the classifier one by one;

[0021] Step 14: Calculate detection indicators, which include Trojan detection accuracy, true positive rate, and true negative rate.

[0022] Preferably, the method of constructing a classifier using a machine learning method is: selecting a KNN machine learning method to construct a classifier, and setting the K value in the KNN machine learning method to 5.

[0023] Preferably, the method of constructing a classifier using a machine learning method is: selecting a Random Forests machine learning method to construct a classifier, and setting the number of trees in the Random Forests method to 100.

[0024] Furthermore, the calculation formula of the Trojan detection accuracy is as follows:

[0025]

[0026] Among them, TPR is the Trojan detection accuracy rate, TP is the number of Trojan signals detected, and FN is the number of Trojan signals that were not detected.

[0027] Furthermore, the calculation formula of the true positive rate is as follows:

[0028]

[0029] Among them, TNR is the true positive rate, TN is the number of normal signals detected, and FP is the number of normal signals mistakenly identified as Trojans.

[0030] Furthermore, the calculation formula of the true negative rate is as follows:

[0031]

[0032] Among them, ACC is the true negative rate, TP is the number of Trojan signals detected, FN is the number of Trojan signals that are not detected, TN is the number of normal signals detected, and FP is the number of normal signals that are mistakenly judged as Trojans.

[0033] The present invention also provides a device, including a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the above-mentioned hardware Trojan detection method based on circuit netlist features, and the processor is configured to execute the program stored in the memory.

[0034] The present invention also provides a storage medium on which a computer program is stored. When the computer program is run by a processor, the steps of the above-mentioned hardware Trojan detection method based on circuit netlist features are executed.

[0035] The advantages of the present invention are:

[0036] Compared with the prior art, the present invention utilizes fewer types of features to achieve a higher distinction accuracy. At the same time, the hardware Trojan node distinction method of the present invention can flexibly adjust the data set used to train the classifier when distinguishing different types of circuit nodes, and is flexible. The SMOTE method is used to preprocess the feature set to avoid machine learning overfitting caused by extreme imbalance of the data set. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a flow chart of a hardware Trojan detection method based on circuit netlist features according to the first embodiment of the present invention;

[0038] Figure 2 It is a flow chart of a hardware Trojan detection method based on circuit netlist features according to the second embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of 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.

[0040] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and specific embodiments:

[0041] Embodiment 1

[0042] like Figure 1 As shown, the hardware Trojan detection method based on circuit netlist features of this embodiment includes the following steps:

[0043] Step 1. Download the infected circuit containing the hardware Trojan and the corresponding "golden chip" without the hardware Trojan from the Trust-HUB website. A personal computer is used. The downloaded files include RTL code files and netlist files. For the RTL code that has not yet been synthesized into a netlist, use DC synthesis to synthesize it into a flattened netlist and then process it together. The methods for extracting the structural features of the hardware Trojan and extracting information from the netlist are both based on Python. The netlists used are the circuit netlist without the Trojan and the circuit netlist containing the Trojan, so as to construct a feature set containing normal nodes and Trojan nodes to train the classifier for distinguishing and extracting nodes from the netlist. All the instantiated devices and input and output ports in the netlist are abstracted into nodes for processing, so that all nodes can be distinguished into hardware Trojan nodes and normal nodes. The "golden chip" is the golden reference model (Golden Reference), which is a thoroughly verified hardware design that does not contain any hardware Trojans or other security vulnerabilities. This model is used as a comparison benchmark to detect abnormal behaviors or potential hardware Trojans that may exist in other hardware designs.

[0044] Step 2: Remove redundant information such as comments and blank lines contained in the netlist, and construct a regular expression to extract and store the key information of the netlist: input port name, output port name, instantiated device and corresponding module, and store it as a netlist_txt file. Regular expressions describe or match the required text pattern by defining a series of rules, for example, start:(.*?)->end:(.*?)$ can be used to match the start and end nodes of each directed edge in the directed edge information file.

[0045] Step 3. Extract information from all modules based on the comprehensive symbol library definition file, including module name and input / output port name, and store it as mio_txt file. Distinguish the input / output ports of each instantiated device in the netlist_txt file based on the mio_txt file and save the vio_txt file. Store the total input / output ports in the flattened netlist file.

[0046] Step 4: Count the number of input ports and output ports of each instantiated device, so as to establish the number of input ports and output ports characteristics of each node.

[0047] Step 5, establish the topological structure of the netlist, and construct a directed graph structure based on the distinguished vio_txt file, including directed edges and nodes. Directed edges are represented as starting instances and ending instances. The name of each directed edge is named after the declared wire type variable name, that is, "wire network type: starting instance-->ending instance", and stored as an arc_txt file. Extract the construction point set of the brief information of each node, that is, the module name, instance name, input port name and output port name, and store it as a vex_txt file. A directed graph is a mathematical model used to represent an ordered pair relationship (called an edge or arc) between a series of objects (called vertices or nodes). In a directed graph, each edge has a clear starting point and end point, indicating the direction from one vertex to another. In the present invention, the instantiated devices and ports are abstracted into nodes in a directed graph, and their connection relationships are abstracted into edges in a directed graph.

[0048] Step 6: Perform breadth-first traversal before and after each node in the established directed graph. Compared with depth-first traversal, breadth-first traversal can traverse more modules of a certain type in the same layer. The number of triggers in X layers before and after the traversal of all nodes (one of the characteristics of timing Trojans) is counted. The present invention selects X=4 for calculation, and the two characteristics are the number of triggers in the first 4 layers of each node and the number of triggers in the last 4 layers of each node.

[0049] Step 7: Perform a breadth-first traversal before and after each node in the established directed graph, and count the number of inverters in X layers before and after the traversal of all nodes (one of the characteristics of timing Trojans). The present invention selects X=4 for calculation, and the number of inverters in 4 layers of each node is used as one of the structural feature sets of each node.

[0050] Step 8: Perform a breadth-first traversal before and after each node in the established directed graph, and count the number of multiplexers in X layers before and after the traversal of all nodes (one of the characteristics of timing Trojans). The present invention selects X=4 for calculation, and the number of multiplexers in 4 layers of each node is used as one of the structural feature sets of each node.

[0051] Step 9. Establish a directed graph structure for the netlist, start traversing from the total input port node of the entire netlist, and end at all the total output port nodes. Add a layer number label to each node, that is, the distance of each node from the main input. At the same time, traverse all nodes and total output ports, calculate the distance of each node from the output port as the distance of each node from the total output port node, and use these two parameters to construct the feature set.

[0052] Step 10. Traverse from all starting points to the end points in the established netlist topology to obtain all possible data links, retain the length of the data link and all instance names contained in this data link, compare all data links, compare the lengths, retain the data link with the largest number of instances, i.e. the longest data link, as the key path, and store all instances as the key_road file.

[0053] Step 11: Calculate the distance between all nodes in the netlist and nodes on the critical path. For instances that are already on the critical path, their distance to the critical connection is defined as 0. For all other instance nodes, calculate the distance between the instance nodes with similar layers in the critical link according to their layers, and take the minimum distance as the distance between the node and the critical path, as one of the features for constructing the feature set. Set the two nodes to be calculated as the starting node and the ending node, and use the breadth-first traversal method to calculate the distance. Since the weight of the edge is 1, when the distance calculation passes through a node, the distance result to be calculated is increased by one.

[0054] Step 12. Repeat steps 2 to 11 for all netlists until the feature sets of all netlists are obtained. The feature sets are organized into an xlsx table, and '-1' is filled in for default values ​​in the table. Repeated node feature rows are deleted. At the same time, since the order of magnitude of hardware Trojan nodes is much smaller than that of normal nodes, normal nodes need to be denoised. At the same time, the SMOTE method is used to expand the features of hardware Trojan nodes, and the ratio of majority class samples to minority class samples is adjusted to avoid overfitting when training classifiers based on machine learning methods.

[0055] Step 13. Select the KNN machine learning method to build a classifier. The sk-learn library in Python has encapsulated many machine learning methods. You only need to call and set key parameters to use them. Set the K value in the KNN machine learning method to 5. Label the preprocessed feature set with '0' and '1' and divide it into training set and test set. Convert the data type and feed them to the classifier one by one.

[0056] Step 14: The purpose of the research on hardware Trojan detection is to detect whether an unknown IC contains a Trojan circuit more efficiently and accurately. There are three main detection indicators, namely, Trojan detection accuracy (ACC), the proportion of circuits judged as Trojans that are actually Trojan circuits, namely the true positive rate (TPR), and the proportion of circuits judged as normal that are actually normal circuits, namely the true negative rate (TNR). The corresponding calculation formula is:

[0057]

[0058] Among them, TP is the number of detected Trojan signals, FN is the number of undetected Trojan signals, TN is the number of detected normal signals, and FP is the number of normal signals misjudged as Trojans. TPR reflects the detection rate of HT. The higher the TPR, the better the detection effect of HT. TPR reflects the ability of the classifier to correctly identify normal nodes. If TNR is too low, it indicates that a large number of normal nodes are mistakenly judged as HT nodes, resulting in a high misjudgment rate. At the same time, the feature set integration method of the present invention is to integrate the xlsx files of each netlist in the folder, so when using new netlist data, it is only necessary to add adjustments in the folder, and it has the flexibility of adjustment.

[0059] Embodiment 2

[0060] like Figure 2As shown, the hardware Trojan detection method based on circuit netlist features of this embodiment is different from that of Embodiment 1 in that step 13 of this embodiment is: selecting the Random Forests machine learning method to build a classifier, setting the number of trees in the RandomForests method to 100, and setting the random seed to ensure that the pseudo-random process can be reproduced.

[0061] Starting from the structural features, the present invention abstracts the instance, main input, and main output ports into node processing, and abstracts the wire type variables directly connecting the instance and the input and output ports into directed edge processing. After abstraction, the netlist can be regarded as a topological structure in which nodes are directly connected to each other. The characteristics of each node include the directed edge with the node as the starting node, the directed edge with the node as the end point, and the node corresponding module type. Combining these three attributes and the connection relationship between nodes, the present invention establishes nine structural features including node fan-in and fan-out, the number of inverters before and after the node, the number of multiplexers, the number of triggers, and the number of layers of the node from the main input and main output, and the distance from the key link.

[0062] The present invention studies the hardware Trojan detection method at the circuit netlist level. By establishing a directed graph structure of the circuit netlist, a feature set of nine dimensions including the number of fan-in and fan-out nodes, the number of multiplexers, the distance between the node and the main input and output, and the distance to the key link is established for all nodes in the netlist by relying on "noun search" and structure traversal. The feature set is preprocessed using the SMOTE method to avoid the overfitting phenomenon of machine learning caused by the extreme imbalance of the data set.

[0063] The present invention constructs a classifier based on two machine learning methods, KNN and random forest, and performs training and testing on a part of the netlist in Trust-HUB. The classification results show that the classifiers based on K-nearest neighbor and random forest have a hardware Trojan node discrimination accuracy of 94.64% and 95.60% respectively, and an average discrimination accuracy of 99.51% and 99.66% respectively for normal nodes; the number of test sets is 33,000, the time for the trained random forest model to distinguish all test set nodes is 0.18s, the time for KNN to distinguish all test set nodes is 0.95s, the training time for the model based on random forest is 1.27s, and the training time for the model based on KNN is 0.094s. Compared with the prior art, the present invention utilizes fewer feature types to achieve a higher discrimination accuracy, and the hardware Trojan node discrimination method invented by the present invention can flexibly adjust the data set used to train the classifier when distinguishing different types of circuit nodes, and has flexibility.

[0064] Embodiment 3

[0065] A device includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the hardware Trojan detection method based on circuit netlist features in embodiment one or embodiment two, and the processor is configured to execute the program stored in the memory.

[0066] Embodiment 4

[0067] A storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the hardware Trojan detection method based on circuit netlist features in embodiment 1 or embodiment 2 are executed.

[0068] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A hardware Trojan detection method based on circuit netlist features, characterized in that: The following steps are involved: Step 1. Download the infected circuit containing the hardware Trojan and the corresponding benchmark circuit without the hardware Trojan from the Trust-HUB website. The downloaded files include RTL code files and netlist files. Perform structural feature extraction of the hardware Trojan and information extraction on the netlist based on Python. The netlists used include the circuit netlist without the Trojan and the circuit netlist containing the Trojan to construct a feature set containing normal nodes and Trojan nodes for training the classifier. Abstract all instantiated devices and input and output ports in the netlist into node processing, so as to distinguish all nodes into hardware Trojan nodes and normal nodes. Step 2: Remove the redundant information contained in the netlist, and construct a regular expression to extract and store the key information of the netlist: input port name, output port name, instantiated device and corresponding module. Step 3: Extract information from all modules according to the symbol library definition file, including module name and input / output port name, and store them as mio_txt file; distinguish the input and output ports of each instantiated device in the netlist_txt file according to the mio_txt file and save the vio_txt file; store the total input / output ports in the flattened netlist file; Step 4: Count the number of input ports and output ports of each instantiated device, so as to establish the number of input ports and output ports of each node; Step 5. Establish the topological structure of the netlist. According to the distinguished vio_txt file, construct a directed graph structure, including directed edges and nodes. The directed edges are represented as start instances and end instances. The name of each directed edge is named after the declared wire type variable name, that is, "wire network type: start instance-->end instance", and is stored as an arc_txt file; extract the construction point set of each node's brief information, that is, module name, instance name, input port name, and output port name, and store it as a vex_txt file; Step 6: Perform a breadth-first traversal before and after each node in the established directed graph, and count the number of triggers in multiple layers before and after the traversal of all nodes; Step 7: Perform a breadth-first traversal before and after each node in the established directed graph, and count the number of inverters in multiple layers before and after the traversal of all nodes; Step 8: Perform a breadth-first traversal before and after each node in the established directed graph, and count the number of multiplexers in multiple layers before and after the traversal of all nodes; Step 9: Establish a directed graph structure for the netlist, start traversing from the total input port node of the entire netlist, end at all total output port nodes, add a layer number label to each node, that is, the distance of each node from the main input, traverse all nodes and total output ports at the same time, calculate the distance of each node from the output port as the distance of each node from the total output port node, and use these two parameters to construct a feature set; Step 10: Traverse from all starting points to the end points in the established netlist topology structure to obtain all possible data links, retain the length of the data link and all instance names contained in this data link, compare all data links, compare the lengths, retain the data link with the largest number of instances, i.e., the longest data link as the key path, and store all instances as a key_road file; Step 11: Calculate the distance between all nodes in the netlist and nodes on the critical path. For instances that are already on the critical path, their distance to the critical connection is defined as 0. For all other instance nodes, calculate the distance between the instance nodes with similar layers in the critical link according to their layers. Take the minimum distance as the distance between the node and the critical path, which is used as one of the features for constructing the feature set. Step 12: Repeat steps 2 to 11 for all netlists until the feature sets of all netlists are obtained. The feature sets are sorted into an xlsx table, and the default values ​​in the table are filled with '-1'. For repeated node feature rows, delete them, denoise the normal nodes, and use the SMOTE method to expand the features of the hardware Trojan nodes, adjust the ratio of majority class samples to minority class samples, and avoid overfitting when training the classifier using the machine learning method. Step 13: Use machine learning methods to build a classifier, set the parameters of the classifier, label the preprocessed feature set with two types of labels, '0' and '1', and divide them into training sets and test sets, convert the data types and feed them to the classifier one by one; Step 14: Calculate detection indicators, which include Trojan detection accuracy, true positive rate, and true negative rate.

2. The method for detecting hardware Trojans based on circuit netlist features according to claim 1, characterized in that: The method of constructing a classifier using a machine learning method is: selecting a KNN machine learning method to construct a classifier, and setting the K value in the KNN machine learning method to 5.

3. The method for detecting hardware Trojans based on circuit netlist features according to claim 1, characterized in that: The method of constructing a classifier using a machine learning method is: selecting a Random Forests machine learning method to construct a classifier, and setting the number of trees in the Random Forests method to 100.

4. The method for detecting hardware Trojans based on circuit netlist features according to claim 1, characterized in that: The calculation formula of the Trojan detection accuracy is as follows: Among them, TPR is the Trojan detection accuracy rate, TP is the number of Trojan signals detected, and FN is the number of Trojan signals that were not detected.

5. The method for detecting hardware Trojans based on circuit netlist features according to claim 1, characterized in that: The calculation formula of the true positive rate is as follows: Among them, TNR is the true positive rate, TN is the number of normal signals detected, and FP is the number of normal signals mistakenly identified as Trojans.

6. The method for detecting hardware Trojans based on circuit netlist features according to claim 1, characterized in that: The calculation formula of the true negative rate is as follows: Among them, ACC is the true negative rate, TP is the number of Trojan signals detected, FN is the number of Trojan signals that are not detected, TN is the number of normal signals detected, and FP is the number of normal signals that are mistakenly judged as Trojans.

7. A device comprising a memory and a processor, characterized in that: The memory is used to store a program that supports the processor to execute the hardware Trojan detection method based on circuit netlist features as described in any one of claims 1 to 6, and the processor is configured to execute the program stored in the memory.

8. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for detecting hardware Trojans based on circuit netlist features according to any one of claims 1 to 6 are executed.