Method and device for generating a set of guard nodes based on k-medoids algorithm in anonymous communication
By generating a set of guardian nodes using the K-Medoids algorithm, the problem of insufficient node bandwidth similarity in anonymous communication is solved, and high-quality generation of node sets is achieved, meeting the usage requirements of the Tor network.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies struggle to guarantee the similarity of node bandwidth within the generated guard node set in anonymous communication, especially when the number of backup guard nodes in the network is small, which affects the quality of node set generation.
The K-Medoids algorithm is adopted, and the standard deviation is introduced as an evaluation criterion for the quality of node set generation. The number of clusters and the initial centroid are selected. The clustering operation is performed to generate the guard node set, ensuring the similarity of node bandwidth.
It effectively ensures the similarity of node bandwidth within the generated node set, meets the usage requirements of the Tor network, and improves the generation quality of the node set.
Smart Images

Figure CN118740397B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication technology, in particular to a method and device for generating a guard node set based on K-Medoids algorithm in anonymous communication. BACKGROUND
[0002] In anonymous communication, the bandwidths of the nodes in a guard node set should be similar according to the design requirements of the guard node set, and the higher the similarity of the bandwidths of the nodes is, the better the quality of the guard node set is. In the original scheme of the guard node set, the generation algorithm of the guard node set only arranges the backup guard nodes in descending order of bandwidth size, iteratively selects and accumulates the bandwidth units of the nodes, until the total bandwidth of the selected nodes meets the bandwidth generation threshold of the guard node set, and then the selected backup guard nodes are added to the network to form the guard node set. The algorithm is relatively simple and does not evaluate the quality of the generated guard node set. In the initial generation process of the guard node set, since the number of nodes is large and the bandwidth distribution of the nodes is uniform, the original generation algorithm can ensure that the bandwidths of the nodes in the generated guard node set are similar. However, in the subsequent generation process, since the number of backup guard nodes in the network is small, it is difficult to ensure that the bandwidths of these nodes are in a relatively ideal distribution range, which may greatly affect the generation quality of the guard node set. SUMMARY
[0003] The purpose of the embodiments of the present application is to provide a method and device for generating a guard node set based on K-Medoids algorithm in anonymous communication, which can effectively ensure the similarity of the bandwidths of the nodes in the generated guard node set.
[0004] In order to achieve the above-mentioned purpose, the embodiments of the present application provide a method for generating a guard node set based on K-Medoids algorithm in anonymous communication, which comprises: judging whether the total bandwidth and the number of backup guard nodes meet the generation conditions of the guard node set; when the generation conditions of the guard node set are met, obtaining the bandwidth values of all backup guard nodes, and generating a bandwidth data set; calculating the bandwidth units of each backup guard node according to the bandwidth data set; judging whether the bandwidth unit of each backup guard node is equal to the bandwidth value, and replacing the bandwidth value in the bandwidth data set with the bandwidth unit when the bandwidth unit is not equal to the bandwidth value; calculating the cluster number of each backup node according to the bandwidth of each backup node and the bandwidth generation threshold of the guard node set; selecting an initial centroid; performing a clustering operation based on K-Medoids algorithm according to the cluster number, the initial centroid; and generating a guard node set according to the total bandwidth of each cluster result.
[0005] Preferably, the step of generating a threshold based on the bandwidth of each backup node and the bandwidth of the guard node set, and calculating the number of clusters for each backup node, includes: calculating the number of clusters for each backup node using the following formula:
[0006]
[0007]
[0008] Among them, Threshold BW To generate a bandwidth threshold for the guard node set, bw_b i N represents the bandwidth of each backup node. k This represents the number of clusters for each backup node.
[0009] Preferably, the selection of the initial centroid includes: performing a deduplication operation on the backup guard node dataset to generate an initial centroid set; and selecting the initial centroid based on the initial centroid set.
[0010] Preferably, selecting the initial centroid based on the initial centroid set includes selecting the initial centroid using the following formula:
[0011]
[0012] Where i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N. k -1, interval is the sampling interval.
[0013] This invention also provides a guard node set generation device based on the K-Medoids algorithm for anonymous communication. The device includes: a bandwidth dataset generation unit, a bandwidth unit determination unit, a parameter calculation unit, and a guard node set generation unit. The bandwidth dataset generation unit is used to: determine whether the total bandwidth and number of backup guard nodes meet the conditions for generating a guard node set; when the conditions are met, obtain the bandwidth values of all backup guard nodes and generate a bandwidth dataset. The bandwidth unit determination unit is used to: calculate the bandwidth unit of each backup guard node based on the bandwidth dataset; determine whether the bandwidth unit of each backup guard node is equal to the bandwidth value, and replace the bandwidth value in the bandwidth dataset with the bandwidth unit if the bandwidth unit is not equal to the bandwidth value. The parameter calculation unit is used to: calculate the number of clusters for each backup node based on the bandwidth of each backup node and the bandwidth generation threshold of the guard node set; select an initial centroid. The guard node set generation unit is used to: perform clustering operations based on the number of clusters and the initial centroids using the K-Medoids algorithm; and generate a guard node set based on the total bandwidth of each clustering result.
[0014] Preferably, the parameter calculation unit is used to calculate the number of clusters for each backup node using the following formula:
[0015]
[0016]
[0017] Among them, Threshold BW To generate a bandwidth threshold for the guard node set, bw_b i N represents the bandwidth of each backup node. k This represents the number of clusters for each backup node.
[0018] Preferably, the parameter calculation unit is used to: perform deduplication on the backup guard node dataset to generate an initial centroid set; and select an initial centroid based on the initial centroid set.
[0019] Preferably, the parameter calculation unit is used to select the initial centroid using the following formula:
[0020]
[0021] Where i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N. k -1, interval is the sampling interval.
[0022] Through the above technical solution, embodiments of the present invention provide a method and apparatus for generating a guard node set based on the K-Medoids algorithm in anonymous communication. By using the K-Medoids clustering algorithm and introducing standard deviation as an evaluation criterion for the quality of node set generation, the similarity of node bandwidth within the generated node set can be effectively guaranteed, ensuring that the node sets added to the Tor network can all meet the system's usage requirements.
[0023] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0024] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:
[0025] Figure 1 This is a flowchart of a method for generating a set of guard nodes based on the K-Medoids algorithm in anonymous communication, provided by an embodiment of the present invention.
[0026] Figure 2This is a structural block diagram of a guardian node set generation device based on the K-Medoids algorithm in anonymous communication provided by another embodiment of the present invention.
[0027] Explanation of reference numerals in the attached figures
[0028] 1. Bandwidth Dataset Generation Unit; 2. Bandwidth Unit Determination Unit
[0029] 3. Parameter calculation unit; 4. Guard node set generation unit Detailed Implementation
[0030] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.
[0031] Figure 1 This is a flowchart of a method for generating a set of guard nodes based on the K-Medoids algorithm in anonymous communication, provided by an embodiment of the present invention. Figure 1 As shown, the method includes:
[0032] Step S101: Determine whether the total bandwidth and number of backup guard nodes meet the conditions for generating the guard node set.
[0033] Specifically, the number of standby guard nodes and the total bandwidth in the network are periodically counted. The condition for generating the guard node set is ∑bw_b i ≥Threshold BW And N min ≤N b ≤N unusual , where ∑bw_b i Threshold represents the total bandwidth of the standby guard nodes. BW To generate a bandwidth threshold for the guard node set, N b N represents the number of backup guard nodes. min N represents the minimum number of spare guard nodes required to generate a set of good-quality guard nodes. unusual N represents the minimum number of standby guard nodes that meet the anomaly detection criteria. min The preferred setting is 30, N unusual The preferred setting is 60.
[0034] Step S102: When the conditions for generating the guard node set are met, obtain the bandwidth values of all standby guard nodes and generate a bandwidth dataset.
[0035] When the conditions in step S101 are met, the bandwidth dataset can be generated by sorting the bandwidths in descending order.
[0036] Step S103: Calculate the bandwidth unit of each backup guard node based on the bandwidth dataset;
[0037] Step S104: Determine whether the bandwidth unit of each backup guard node is equal to the bandwidth value, and if the bandwidth unit is not equal to the bandwidth value, replace the bandwidth value in the bandwidth dataset with the bandwidth unit;
[0038] Among them, the bandwidth unit quanta of each node is calculated based on the dataset. i If quanta i ≠bw i The system then deletes bw from the dataset. i and quanta i Insert at the specified position.
[0039] Step S105: Calculate the number of clusters for each backup node based on the bandwidth of each backup node and the bandwidth of the guard node set.
[0040] The number of clusters for each backup node can be calculated using the following formula:
[0041]
[0042]
[0043] Among them, Threshold BW To generate a bandwidth threshold for the guard node set, bw_b i N represents the bandwidth of each backup node. k This represents the number of clusters for each backup node.
[0044] Step S106: Select the initial centroid;
[0045] In this process, the backup guard node dataset can be deduplicated to generate an initial centroid set, and then the initial centroid can be selected based on the initial centroid set.
[0046] The initial centroid can be selected using the following formula:
[0047]
[0048] Where i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N. k -1, interval is the sampling interval.
[0049] The purpose of the initial centroid set is to prevent the system from selecting initial centroids of the same size, which could lead to computational errors during clustering. Since the data samples after descending order have a good decreasing distribution characteristic, an equidistant sampling method can be used to select the initial centroids, ensuring that the size distribution of the initial centroids is consistent with the distribution characteristics of the sample set. To avoid the algorithm crashing due to the number of samples in the initial centroid set being less than the number of clusters, the system also needs to determine the number of clusters. If N... k >h, then the system is set to N k =h, to ensure the normal operation of the algorithm. The sampling interval can be calculated as follows:
[0050] Step S107: Perform clustering operation based on the K-Medoids algorithm according to the number of clusters and the initial centroids;
[0051] The K-Medoids Clustering Algorithm is an iterative clustering analysis algorithm, where K represents the number of clusters. Those skilled in the art will understand how to use the K-Medoids algorithm, and will not elaborate further here.
[0052] Step S108: Generate a set of guard nodes based on the total bandwidth of each clustering result.
[0053] Specifically, clustering results with a total bandwidth greater than the threshold for generating the guard node set are selected to generate the guard node set.
[0054] Figure 2 This is a structural block diagram of a guardian node set generation device based on the K-Medoids algorithm in anonymous communication, provided by another embodiment of the present invention. Figure 2As shown, the device includes: a bandwidth dataset generation unit 1, a bandwidth unit determination unit 2, a parameter calculation unit 3, and a guard node set generation unit 4. The bandwidth dataset generation unit 1 is used to: determine whether the total bandwidth and number of backup guard nodes meet the conditions for generating a guard node set; when the conditions are met, obtain the bandwidth values of all backup guard nodes and generate a bandwidth dataset. The bandwidth unit determination unit 2 is used to: calculate the bandwidth unit of each backup guard node based on the bandwidth dataset; determine whether the bandwidth unit of each backup guard node is equal to the bandwidth value, and replace the bandwidth value in the bandwidth dataset with the bandwidth unit if the bandwidth unit is not equal to the bandwidth value. The parameter calculation unit 3 is used to: calculate the number of clusters for each backup node based on the bandwidth of each backup node and the bandwidth generation threshold of the guard node set; and select an initial centroid. The guard node set generation unit 4 is used to: perform clustering operations based on the number of clusters and the initial centroid using the K-Medoids algorithm; and generate a guard node set based on the total bandwidth of each clustering result.
[0055] Preferably, the parameter calculation unit 3 is used to calculate the number of clusters for each backup node using the following formula:
[0056]
[0057]
[0058] Among them, Threshold BW To generate a bandwidth threshold for the guard node set, bw_b i N represents the bandwidth of each backup node. k This represents the number of clusters for each backup node.
[0059] Preferably, the parameter calculation unit 3 is used to: perform deduplication on the backup guard node dataset to generate an initial centroid set; and select an initial centroid based on the initial centroid set.
[0060] Preferably, the parameter calculation unit 3 is used to select the initial centroid using the following formula:
[0061]
[0062] Where i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N. k -1, interval is the sampling interval.
[0063] The guardian node set generation device based on the K-Medoids algorithm in anonymous communication described above is similar to the guardian node set generation method based on the K-Medoids algorithm in anonymous communication described above, and will not be repeated here.
[0064] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can 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, etc.) containing computer-usable program code.
[0065] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can 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, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0066] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0067] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0068] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0069] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0070] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0071] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0072] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for generating a guard node set based on the K-Medoids algorithm in anonymous communication, characterized in that, The method includes: Determine whether the total bandwidth and number of backup guard nodes meet the conditions for generating the guard node set. When the conditions for generating the guard node set are met, obtain the bandwidth values of all standby guard nodes and generate a bandwidth dataset. Based on the bandwidth dataset, calculate the bandwidth unit for each backup guard node; Determine whether the bandwidth unit of each backup guard node is equal to the bandwidth value, and replace the bandwidth value in the bandwidth dataset with the bandwidth unit if the bandwidth unit is not equal to the bandwidth value. Calculate the number of clusters for each backup node based on the bandwidth of each backup node and the bandwidth generation threshold of the guard node set. Select an initial centroid; Based on the number of clusters and the initial centroids, perform clustering operations using the K-Medoids algorithm; Based on the total bandwidth of each clustering result, a set of guard nodes is generated.
2. The method for generating a guard node set based on the K-Medoids algorithm in anonymous communication according to claim 1, characterized in that, The step of generating a threshold based on the bandwidth of each backup node and the bandwidth of the guard node set, and calculating the number of clusters for each backup node, includes: The number of clusters for each spare node is calculated using the following formula: Among them, Threshold BW To generate a bandwidth threshold for the guard node set, bw_b i N represents the bandwidth of each backup node. k This represents the number of clusters for each backup node.
3. The method for generating a set of guard nodes based on the K-Medoids algorithm in anonymous communication according to claim 1, characterized in that, The selection of the initial centroid includes: The backup guard node dataset is deduplicated to generate an initial centroid set; The initial centroid is selected based on the initial centroid set.
4. The method for generating a set of guard nodes based on the K-Medoids algorithm in anonymous communication according to claim 3, characterized in that, The step of selecting the initial centroid based on the initial centroid set includes: The initial centroid is selected using the following formula: Where i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N. k -1, interval is the sampling interval.
5. A device for generating a set of guard nodes based on the K-Medoids algorithm in anonymous communication, characterized in that, The device includes: The system includes a bandwidth dataset generation unit, a bandwidth unit determination unit, a parameter calculation unit, and a guard node set generation unit. The bandwidth dataset generation unit is used for: Determine whether the total bandwidth and number of backup guard nodes meet the conditions for generating the guard node set. When the conditions for generating the guard node set are met, obtain the bandwidth values of all standby guard nodes and generate a bandwidth dataset. The bandwidth unit determining unit is used for: Based on the bandwidth dataset, calculate the bandwidth unit for each backup guard node; Determine whether the bandwidth unit of each backup guard node is equal to the bandwidth value, and replace the bandwidth value in the bandwidth dataset with the bandwidth unit if the bandwidth unit is not equal to the bandwidth value. The parameter calculation unit is used for: Calculate the number of clusters for each backup node based on the bandwidth of each backup node and the bandwidth generation threshold of the guard node set. Select an initial centroid; The guard node set generation unit is used for: Based on the number of clusters and the initial centroids, perform clustering operations using the K-Medoids algorithm; Based on the total bandwidth of each clustering result, a set of guard nodes is generated.
6. The guardian node set generation device based on the K-Medoids algorithm in anonymous communication according to claim 5, characterized in that, The parameter calculation unit is used for: The number of clusters for each spare node is calculated using the following formula: Among them, Threshold BW To generate a bandwidth threshold for the guard node set, bw_b i N represents the bandwidth of each backup node. k This represents the number of clusters for each backup node.
7. The guardian node set generation device based on the K-Medoids algorithm in anonymous communication according to claim 5, characterized in that, The parameter calculation unit is used for: The backup guard node dataset is deduplicated to generate an initial centroid set; The initial centroid is selected based on the initial centroid set.
8. The guardian node set generation device based on the K-Medoids algorithm in anonymous communication according to claim 7, characterized in that, The parameter calculation unit is used for: The initial centroid is selected using the following formula: Where i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N. k -1, interval is the sampling interval.
Citation Information
Patent Citations
Beamforming and localizing in a configurable monitoring device system
CN102648472A
Anonymous protection method for user nodes of annular guard network and electronic equipment
CN112019502A