A device identification method, device, electronic device and storage medium

By dynamically intercepting the number of bits of the hash value, the device identification is performed in a way that meets the collision probability conditions, the problem of memory resource waste and collision in the device identification is solved, and the balance between resource saving and collision rate reduction is achieved.

CN116155512BActive Publication Date: 2025-07-08SHANGHAI SHIZHUANG INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310168196.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-24
Publication Date
2025-07-08
Estimated Expiration
2043-02-24

AI Technical Summary

Technical Problem

The prior art has problems of waste of memory resources and collision of device identifiers in device identification in specific areas, especially when the number of devices is small, resource waste is serious, while when the number of devices is large, the identifier cannot identify all devices.

Method used

By dynamically intercepting the hash value based on the number of intercepted bits that meet the preset conditions for the collision probability, the intercepted hash value is obtained for device identification, taking into account memory resources and reducing the collision probability.

Benefits of technology

It effectively saves memory resources and computing resources in the target area, reduces the collision probability of device identifiers, and improves the efficiency of device identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116155512B_ABST
    Figure CN116155512B_ABST
Patent Text Reader

Abstract

The present application provides a device identification method, apparatus, electronic device and storage medium. The method includes: obtaining the number of devices in a target area, and determining a plurality of truncation bits for truncating a hash value according to the number of devices; determining a target truncation bit whose collision probability meets a preset condition from the plurality of truncation bits; obtaining the device hash values in the target area, and truncating the device hash values according to the target truncation bit to obtain truncated hash values, and the truncated hash values are used to identify the devices in the target area. By dynamically truncating the hash value according to the truncation bit whose collision probability meets the preset condition to obtain the truncated hash value, and using the truncated hash value to identify the devices in the target area, the device identification is carried out by simultaneously considering the truncation of the device hash value and the collision probability, effectively taking into account the saving of memory resources and the reduction of the collision probability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of computer data processing. Specifically, it relates to a device identification method, device, electronic device, and storage medium. Background Art

[0002] Currently, when identifying all devices within a specific area (such as within a local area network or within a certain province), most often the entire string of the hash value is used as the device identifier for a preset purpose (such as advertisement distribution). For example, assume the MD5 algorithm is used to calculate the hash value, and the entire 64-bit MD5 string calculated is used as the unique identifier of the device. However, in the specific practice process, it is found that when the number of devices within the specific area is small, there is a problem of waste of memory resources. When the number of devices within the specific area is very large, the device identifier at this time cannot identify all devices, resulting in a situation where the device identifier has a collision (that is, different devices are both identified using the same device identifier). Summary of the Invention

[0003] The purpose of the embodiments of this application is to provide a device identification method, device, electronic device, and storage medium, which are used to improve the above problems of waste of memory resources and collision of device identifiers.

[0004] The embodiments of this application provide a device identification method, including: obtaining the number of devices within the target area, and determining multiple truncation bit lengths for truncating the hash value according to the number of devices; determining a target truncation bit length whose collision probability meets a preset condition from the multiple truncation bit lengths; obtaining the device hash values within the target area, and truncating the device hash values according to the target truncation bit length to obtain the truncated hash values, and the truncated hash values are used to identify the devices within the target area. In the implementation process of the above solution, by dynamically truncating the hash value according to the truncation bit length whose collision probability meets the preset condition to obtain the truncated hash value, and using the truncated hash value to identify the devices within the target area, thus considering both the truncation of the device hash value and the collision probability for device identification, effectively taking into account saving memory resources and reducing the collision probability.

[0005] Optionally, in the embodiments of this application, obtaining the device hash values within the target area includes: obtaining the unique identifier of the device within the target area; performing a hash calculation on the unique identifier of the device to obtain the device hash value. In the implementation process of the above solution, by performing a hash calculation on the unique identifier of the device to obtain the device hash value, and using the truncation bit length whose collision probability meets the preset condition among the multiple truncation bit lengths to truncate the device hash value, thus improving the situation of waste of memory resources caused by using the entire string of the unique identifier of the device to identify the device, and effectively saving the memory resources of the devices within the target area.

[0006] Optionally, in the embodiments of the present application, determining a target truncation bit number whose collision probability meets a preset condition from multiple truncation bit numbers includes: determining a truncation bit number whose corresponding collision probability is less than a preset threshold from multiple truncation bit numbers as the target truncation bit number, where the collision probability corresponding to the truncation bit number is calculated based on the number of devices and the truncation bit number. In the implementation process of the above solution, by using the truncation bit number corresponding to the target collision probability less than the preset threshold to truncate the hash value, the situation of wasting computing resources caused by calculating the collision probabilities corresponding to all multiple truncation bit numbers is improved, and the situation of wasting memory resources caused by using all strings of the device unique identifier to identify the device is improved, effectively saving the computing resources and memory resources of the devices in the target area.

[0007] Optionally, in the embodiments of the present application, determining a target truncation bit number whose collision probability meets a preset condition from multiple truncation bit numbers includes: for each truncation bit number among multiple truncation bit numbers, calculating the collision probability based on the number of devices and the truncation bit number to obtain multiple collision probabilities; screening out the minimum collision probability from the multiple collision probabilities, and determining the truncation bit number corresponding to the minimum collision probability as the target truncation bit number. In the implementation process of the above solution, by using the truncation bit number corresponding to the minimum collision probability to truncate the device hash value, the device identification is performed by simultaneously considering the truncated device hash value and the collision probability, effectively taking into account both saving memory resources and reducing the collision probability.

[0008] Optionally, in the embodiments of the present application, after determining the truncation bit number corresponding to the minimum collision probability as the target truncation bit number, it further includes: sending the target truncation bit number to the target devices in the target area, so that the target devices use the target truncation bit number to truncate the device hash value. In the implementation process of the above solution, by sending the truncation bit number corresponding to the minimum collision probability to the target devices in the target area, so that the target devices use the truncation bit number corresponding to the minimum collision probability to truncate the device hash value, the device identification is performed by simultaneously considering the truncated device hash value and the minimum collision probability, effectively taking into account both saving memory resources and reducing the collision probability.

[0009] Optionally, in the embodiments of the present application, after obtaining the truncated hash value, it further includes: using the truncated hash value to identify the devices in the target area to obtain device identifiers; obtaining advertisement data, and sending the advertisement data to the devices in the target area according to the device identifiers. In the implementation process of the above solution, by using the truncated hash value to identify the devices in the target area and sending the advertisement data to the devices in the target area according to the device identifiers, the situation of wasting memory resources caused by using all strings of the device unique identifier to identify the devices of the advertisement data is improved, effectively saving the memory resources of the devices in the target area.

[0010] Optionally, in the embodiments of the present application, the number of digits to be intercepted is the number of digits for intercepting the hash value from the back to the front, or the number of digits for intercepting the hash value from the front to the back.

[0011] The embodiments of the present application further provide a device identification device, including: an interception digit determination module, configured to obtain the number of devices in the target area and determine multiple numbers of digits for intercepting the hash value according to the number of devices; a target digit determination module, configured to determine a target number of digits whose collision probability meets a preset condition from the multiple numbers of digits; a device hash interception module, configured to obtain the device hash values in the target area and intercept the device hash values according to the target number of digits to obtain the intercepted hash values, and the intercepted hash values are used to identify the devices in the target area.

[0012] Optionally, in the embodiments of the present application, the device hash interception module includes: a unique identifier acquisition sub-module, configured to obtain the unique identifier of the device in the target area; a device hash calculation sub-module, configured to perform hash calculation on the unique identifier of the device to obtain the device hash value.

[0013] Optionally, in the embodiments of the present application, the device hash interception module includes: a target probability determination sub-module, configured to determine, from the multiple numbers of digits, the number of digits whose corresponding collision probability is less than a preset threshold as the target number of digits, where the collision probability corresponding to the number of digits is calculated according to the number of devices and the number of digits.

[0014] Optionally, in the embodiments of the present application, the device hash interception module includes: a collision probability calculation sub-module, configured to calculate the collision probability for each of the multiple numbers of digits according to the number of devices and the number of digits to obtain multiple collision probabilities; an interception digit acquisition sub-module, configured to screen out the minimum collision probability from the multiple collision probabilities and determine the number of digits corresponding to the minimum collision probability as the target number of digits.

[0015] Optionally, in the embodiments of the present application, the device hash interception module further includes: an interception digit sending unit, configured to send the number of digits corresponding to the minimum collision probability to the target device in the target area, so that the target device intercepts the device hash value using the number of digits corresponding to the minimum collision probability.

[0016] Optionally, in the embodiments of the present application, the device identification device further includes: a device identifier acquisition module, configured to identify the devices in the target area using the intercepted hash values to obtain device identifiers; an advertisement data sending module, configured to obtain advertisement data and send the advertisement data to the devices in the target area according to the device identifiers.

[0017] Optionally, in the embodiments of the present application, the number of bits to be intercepted is the number of bits for intercepting the hash value from the back to the front, or the number of bits to be intercepted is the number of bits for intercepting the hash value from the front to the back.

[0018] The embodiments of the present application further provide an electronic device, including: a processor and a memory, where the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the methods described above are executed.

[0019] The embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is run by a processor, the methods described above are executed.

[0020] Other features and advantages of the embodiments of the present application will be described in the subsequent description, and partly will be obvious from the description, or will be understood by implementing the embodiments of the present application. Description of the Drawings

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments in the embodiments of the present application, and thus should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0022] Figure 1 A schematic flowchart of the device identification method provided by the embodiments of the present application shown;

[0023] Figure 2 A schematic diagram of the number of bits to be intercepted of the hash value provided by the embodiments of the present application shown;

[0024] Figure 3 A schematic structural diagram of the device identification device provided by the embodiments of the present application shown;

[0025] Figure 4 A schematic structural diagram of the electronic device provided by the embodiments of the present application shown. Detailed Embodiments

[0026] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. It should be understood that the accompanying drawings in the embodiments of this application are only for the purposes of illustration and description, and are not used to limit the protection scope of the embodiments of this application. Additionally, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in the embodiments of this application illustrate the operations implemented according to some embodiments of the embodiments of this application. It should be understood that the operations in the flowchart may not be implemented in sequence, and steps without a logical context relationship may be reversed in order or implemented simultaneously. Furthermore, those skilled in the art may add one or more other operations to the flowchart or remove one or more operations from the flowchart under the guidance of the content of the embodiments of this application.

[0027] In addition, the described embodiments are only a part of the embodiments of this application, rather than all of the embodiments. The components of the embodiments of this application generally described and illustrated in the accompanying drawings herein may be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed embodiments of this application, but merely represents selected embodiments of this application.

[0028] It can be understood that "first" and "second" in the embodiments of this application are used to distinguish similar objects. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order, and terms such as "first" and "second" do not necessarily limit to being different. In the description of the embodiments of this application, the term "and / or" is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, the character " / " in this text generally represents an "or" relationship between the associated objects before and after. The term "plural" refers to two or more (including two). Similarly, "multiple groups" refers to two or more groups (including two groups).

[0029] Before introducing the device identification method provided by the embodiments of this application, some concepts involved in the embodiments of this application will be introduced first:

[0030] The hash algorithm (Hash function), also known as the hash function, hash algorithm, or hash function, is a method for creating a small digital fingerprint from any kind of data; the hash function compresses the message or data into a digest, making the data volume smaller and fixing the data format; this hash function shuffles and mixes the data to recreate a fingerprint called a hash value (hash values, hash codes, hash sums, or hashes).

[0031] It should be noted that the device identification method provided by the embodiments of the present application can be executed by an electronic device. Here, the electronic device refers to a device terminal or a server with the function of executing computer programs. Examples of device terminals include: smart phones, personal computers, tablet computers, personal digital assistants, or mobile Internet devices, etc. A server refers to a device that provides computing services through a network. Examples of servers include: x86 servers and non-x86 servers. Non-x86 servers include: mainframes, minicomputers, and UNIX servers.

[0032] The following introduces the application scenarios applicable to the device identification method. Here, the application scenarios include but are not limited to: when pushing advertisement data to devices within a specific area (such as within a local area network or within a certain province), this device identification method can be used to identify the devices in the specific area, so as to perform personalized advertisement data pushing based on the device identifier, etc. Since this device identification method simultaneously considers intercepting the device hash value and the collision probability for device identification, therefore, compared with directly using the entire string of the device hash value as the device identifier, this device identification method can save the total memory resources of all devices in the specific area by intercepting the device hash value, and screen out the intercepting bit lengths whose collision probabilities meet the preset conditions from multiple intercepting bit lengths for interception, thereby effectively taking into account saving memory resources and reducing the collision probability.

[0033] Please refer to Figure 1 the schematic flowchart of the device identification method provided by the embodiments of the present application shown in; the main idea of this device identification method is to dynamically intercept the hash value according to the intercepting bit lengths whose collision probabilities meet the preset conditions, and simultaneously consider intercepting the device hash value and the collision probability for device identification, so as to achieve the effect of effectively balancing saving memory resources and reducing the collision probability. The implementation manners of the above device identification method may include:

[0034] Step S110: Obtain the number of devices in the target area, and determine multiple intercepting bit lengths for intercepting the hash value according to the number of devices.

[0035] The target area refers to the interior of a specific area of the target object. Here, the target object can be a virtual local area network, a virtual website, or a virtual three-dimensional space, etc. Of course, it can also be an administratively divided area, such as: an area within a certain province or an area within a city, etc.

[0036] Please refer to Figure 2Schematic diagram of the number of bits intercepted for the hash value provided by the embodiment of the present application; the number of bits intercepted refers to the number of bits intercepted from the front-to-back direction or the back-to-front direction for the device hash value. For the convenience of understanding and explanation, here, the example of intercepting a 32-bit MD5 hash value in the front-to-back direction is used for illustration. Specifically, for example: The first number of bits intercepted can be the first n bits of the 32-bit MD5 hash value intercepted in the front-to-back direction, where n can be less than or equal to 16. The second number of bits intercepted can be the first 2×n bits of the 32-bit MD5 hash value intercepted in the front-to-back direction, where 2×n can be less than or equal to 32.

[0037] For example, the implementation manner of the above step S110 is as follows: Assume that the above target object is a virtual website. Then, the server running the above virtual website can count the number of devices accessing the virtual website within the target area, and can count according to the MAC address and / or IP address of the device, so as to obtain the number of devices within the target area. Taking a 32-bit MD5 hash value as an example for illustration, 1 bit in the MD5 hash value can represent 16 numbers. Then, assume that the number of devices is less than 16. One bit can be used as a number of bits intercepted, or 2, 3,..., 30 or 31 bits can be used as the number of bits intercepted. Therefore, when the number of devices is less than 16, there can be 31 numbers of bits intercepted. Similarly, when the number of devices is greater than 16 and less than 16 2 = 256, there can be 30 numbers of bits intercepted; when the number of devices is greater than 16 2 = 256 and less than 16 3 = 4096, there can be 29 numbers of bits intercepted, and so on.

[0038] Step S120: Determine a target number of bits intercepted whose collision probability meets a preset condition from multiple numbers of bits intercepted.

[0039] It can be understood that there are many kinds of preset conditions in the above step S120. For example: the collision probability is less than a preset threshold, or the minimum collision probability, etc.

[0040] Step S130: Obtain the device hash values within the target area, and intercept the device hash values according to the target number of bits intercepted to obtain the intercepted hash values, and the intercepted hash values are used to identify the devices within the target area.

[0041] It can be understood that there are many preset conditions in the above step S120. For example, the collision probability is less than a preset threshold, or the minimum collision probability, etc. Therefore, there are also many implementation manners of the above step S120, including but not limited to: the first implementation manner is to screen out the intercepted bits with a collision probability less than the preset threshold from multiple intercepted bit numbers; the second implementation manner is to screen out the intercepted bits with the minimum collision probability from multiple intercepted bit numbers. Therefore, the implementation manners of step S120 will be described in detail below.

[0042] In the above implementation process, by dynamically intercepting the hash value according to the intercepted bit numbers whose collision probability meets the preset conditions, the intercepted hash value is obtained, and the intercepted hash value is used to identify the devices in the target area. Thus, both the intercepted device hash value and the collision probability are considered for device identification, effectively taking into account saving memory resources and reducing the collision probability.

[0043] As an optional implementation manner of obtaining the device hash value in the above step S120, the device hash value in the target area can be obtained according to the device unique identifier. This implementation manner may include:

[0044] Step S121: Obtain the device unique identifier in the target area.

[0045] For example, the implementation manner of the above step S121: It can be understood that since the device unique identifiers of different types of devices in the target area are also different. Assuming that the operating system of the device is the operating system of a mobile phone (iPhone OS, IOS), then the advertising identifier (IDentifier For Advertising, IDFA) of the device can be determined as the unique identifier of the device. Similarly, assuming that the operating system of the device is the Android operating system, then the International Mobile Equipment Identity (IMEI) of the device can be selected as the unique identifier of the device.

[0046] Step S122: Perform a hash calculation on the device unique identifier to obtain the device hash value.

[0047] For example, the implementation manner of the above step S122: Use hash algorithms such as MD5, SHA-256 / 224, SHA-512 / 384, and WHIRLPOOL to perform a hash calculation on the device unique identifier to obtain the device hash value. Among them, the MD5 algorithm refers to a widely used cryptographic hash function that can generate a 128-bit (16-byte) hash value for ensuring the integrity and consistency of information transmission.

[0048] As a first alternative implementation of the device hash value truncation in the above step S120, the preset condition of the above collision probability can be that the collision probability is less than a preset threshold. Therefore, the truncation bits corresponding to the target collision probability with a collision probability less than the preset threshold can be used for truncation. This implementation of device hash value truncation can include:

[0049] Step S123: Determine the truncation bits corresponding to a collision probability less than the preset threshold from multiple truncation bits as the target truncation bits, where the collision probability corresponding to the truncation bits is calculated based on the number of devices and the truncation bits.

[0050] An implementation of the above step S123 is as follows: The above collision probability can be calculated based on the number of devices and the truncation bits. For example, using the formula Calculate the number of devices and the truncation bits to obtain the collision probability. Here, a represents the collision probability, e is the natural constant, k represents the number of devices in the target area, and N represents the number of devices corresponding to the truncation bits. Still taking the 32-bit MD5 hash value as an example, assume that 1 bit is used as a truncation bit, then the number of devices corresponding to the truncation bit is 16. Similarly, assume that 2 bits are used as a truncation bit, then the number of devices corresponding to the truncation bit is 16 2 = 256. Similarly, assume that 3 bits are used as a truncation bit, then the number of devices corresponding to the truncation bit is 16 3 = 4096, and so on.

[0051] Step S124: Determine whether there is a collision probability less than the preset threshold among the collision probabilities corresponding to multiple truncation bits. If there is a collision probability less than the preset threshold among the collision probabilities corresponding to multiple truncation bits, then use the truncation bits corresponding to the collision probability to truncate the hash value to obtain the truncated hash value.

[0052] For example, the implementation of step S124 above can be as follows: First, calculate the collision probability according to the number of devices and the truncation bits in the same way as step S123 above. After calculating the collision probability, an executable program compiled or interpreted using a preset programming language can be used to determine whether there is a collision probability less than the preset threshold in the collision probabilities. If there is a collision probability less than the preset threshold in the collision probabilities, immediately use the truncation bits corresponding to the collision probability to truncate the hash value to obtain the truncated hash value, and there is no need to calculate the remaining collision probabilities. In other words, if you are lucky enough, it may be determined that there is a collision probability less than the preset threshold when calculating the collision probability for the first time, and in this case, there is no need to calculate the remaining collision probabilities. Among them, the above preset threshold can be set according to specific circumstances. For example, the preset threshold can be set to 0.01 or 0.03, etc. The above programming languages can include C, C++, Java, BASIC, JavaScript, LISP, Shell, Perl, Ruby, Python, and PHP, etc.

[0053] As the second alternative implementation of device hash value truncation in step S120 above, the preset condition of the above collision probability can be the minimum collision probability. Therefore, the target truncation bits corresponding to the minimum collision probability can be used for truncation. This implementation of device hash value truncation can include:

[0054] Step S125: For each truncation bit among multiple truncation bits, calculate the collision probability according to the number of devices and the truncation bit to obtain multiple collision probabilities.

[0055] For example, the implementation of step S125 above: For each truncation bit among multiple truncation bits, use the formula to calculate the number of devices and the truncation bit to obtain the collision probability. Among them, a represents the collision probability, e is the natural constant, k represents the number of devices in the target area, and N represents the number of devices corresponding to the truncation bit. Still taking the 32-bit MD5 hash value as an example, assume that 1 bit is used as a truncation bit, then the number of devices corresponding to the truncation bit is 16. Similarly, assume that 2 bits are used as a truncation bit, then the number of devices corresponding to the truncation bit is 16 2 = 256. Similarly, assume that 3 bits are used as a truncation bit, then the number of devices corresponding to the truncation bit is 16 3 = 4096, and so on.

[0056] It can be understood that if the above formula is used to calculate for each truncation bit among multiple truncation bits, the collision probability of each truncation bit among multiple truncation bits can be obtained, that is, multiple collision probabilities can be obtained.

[0057] Step S126: Screen out the minimum collision probability from multiple collision probabilities, and determine the truncation bits corresponding to the minimum collision probability as the target truncation bits.

[0058] An implementation manner of the above step S126 is described by taking a 32-bit MD5 hash value as an example. Suppose the minimum collision probability screened out from multiple collision probabilities is the collision probability corresponding to 32-bit truncation bits, then the obtained truncation bits corresponding to the minimum collision probability are 32 bits. In the specific practice process, the maximum truncation bits can be set. For example, the value range of the truncation bits is set to 5 bits to 30 bits. Then, if the minimum collision probability screened out from multiple collision probabilities is the collision probability corresponding to 30-bit truncation bits, then the obtained truncation bits corresponding to the minimum collision probability are 30 bits.

[0059] Step S127: Truncate the device hash value using the target truncation bits to obtain the truncated hash value.

[0060] An implementation manner of the above step S127 is described by taking an example. Suppose the truncation bits corresponding to the minimum collision probability are 30 bits, then the device hash value can be truncated using 30-bit truncation bits to obtain the truncated hash value. Specifically, suppose the hash value is 098f6bcd4621d373cade4e832627b4f6, then truncating the device hash value from front to back using 30-bit truncation bits, the obtained truncated hash value can be 098f6bcd4621d373cade4e832627b4. Similarly, suppose the hash value is 098f6bcd4621d373cade4e832627b4f6, then truncating the above device hash value from back to front using 30-bit truncation bits, the obtained truncated hash value can be 8f6bcd4621d373cade4e832627b4f6.

[0061] As an optional implementation manner of the above step S127, when truncating the device hash value using the truncation bits corresponding to the minimum collision probability, the truncation bits can be sent to the target device, and let the target device use the truncation bits to truncate the device hash value. This implementation manner may include:

[0062] Step S127a: Send the truncation bits corresponding to the minimum collision probability to the target device in the target area, so that the target device truncates the device hash value using the truncation bits corresponding to the minimum collision probability to obtain the truncated hash value.

[0063] For example, in a specific actual process of the above step S127a, if a preset application APP (such as an application APP developed by the company) is installed on the target device in the target area, then the truncation bits corresponding to the minimum collision probability can be directly sent to the target device in the target area, so that the application APP on the target device uses the truncation bits corresponding to the minimum collision probability to truncate the device hash value, thereby obtaining the truncated hash value.

[0064] As an alternative implementation of the above device identification method, after obtaining the truncated hash value, the truncated hash value can also be used for identification and sending advertisement data. This implementation can include:

[0065] Step S130: Use the truncated hash value to identify the devices in the target area to obtain device identifiers.

[0066] For example, in the implementation of the above step S130, an executable program compiled or interpreted by a preset programming language is used to identify the devices in the target area with the truncated hash value to obtain device identifiers; among them, the above programming languages can include C, C++, Java, BASIC, JavaScript, LISP, Shell, Perl, Ruby, Python, and PHP, etc.

[0067] Step S140: Obtain advertisement data and send the advertisement data to the devices in the target area according to the device identifiers.

[0068] For example, in the implementation of the above step S140, advertisement data is obtained from an advertisement server or an advertisement database through an executable program, and the advertisement data is sent to the devices in the target area according to the device identifiers. Among them, the databases that can be used here include: in-memory databases, relational databases, and non-relational databases; examples of in-memory databases that can be used are Memcached and Redis, etc., examples of relational databases that can be used are Mysql, PostgreSQL, Oracle, and SQLSever, etc., and non-relational databases that can be used include Grakn database, Hadoop subsystem HBase, MongoDB, and CouchDB, etc.

[0069] As an alternative embodiment of the above device identification method, the number of bits to be intercepted is the number of bits for intercepting the hash value from the back to the front, or the number of bits for intercepting the hash value from the front to the back. Specifically, assuming the hash value is 098f6bcd4621d373cade4e832627b4f6, then using the method of intercepting 30 bits from the back to the front for the above device hash value, the intercepted hash value can be 8f6bcd4621d373cade4e832627b4f6. Similarly, assuming the hash value is 098f6bcd4621d373cade4e832627b4f6, then using the method of intercepting 30 bits from the front to the back for the device hash value, the intercepted hash value can be 098f6bcd4621d373cade4e832627b4.

[0070] Please refer to Figure 3 the structural schematic diagram of the device identification device provided by the embodiment of the present application shown; The embodiment of the present application provides a device identification device 200, including:

[0071] An interception bit number determination module 210, configured to obtain the number of devices in a target area, and determine multiple interception bit numbers for intercepting the hash value according to the number of devices.

[0072] A target bit number determination module 220, configured to determine a target interception bit number whose collision probability meets a preset condition from the multiple interception bit numbers.

[0073] A device hash interception module 230, configured to obtain the device hash value in the target area, and intercept the device hash value according to the target interception bit number to obtain an intercepted hash value, and the intercepted hash value is used to identify the devices in the target area.

[0074] Optionally, in the embodiment of the present application, the device hash interception module includes:

[0075] A unique identifier acquisition sub-module, configured to acquire the unique identifier of the device in the target area.

[0076] A device hash calculation sub-module, configured to perform hash calculation on the unique identifier of the device to obtain the device hash value.

[0077] Optionally, in the embodiment of the present application, the device hash interception module includes:

[0078] A target probability determination sub-module, configured to determine, from the multiple interception bit numbers, an interception bit number whose corresponding collision probability is less than a preset threshold as the target interception bit number, where the collision probability corresponding to the interception bit number is calculated according to the number of devices and the interception bit number.

[0079] Optionally, in an embodiment of the present application, the device hash interception module includes:

[0080] The collision probability calculation submodule is used to calculate the collision probability for each of the multiple interception bit numbers according to the number of devices and the interception bit number to obtain multiple collision probabilities.

[0081] The interception digit acquisition submodule is used to screen out the minimum collision probability from multiple collision probabilities, and determine the interception digit corresponding to the minimum collision probability as the target interception digit.

[0082] Optionally, in the embodiment of the present application, the device hash interception module further includes:

[0083] The interception bit sending unit is used to send the interception bit corresponding to the minimum collision probability to the target device in the target area, so that the target device uses the interception bit corresponding to the minimum collision probability to intercept the device hash value.

[0084] Optionally, in the embodiment of the present application, the device identification apparatus further includes:

[0085] The device identification acquisition module is used to use the intercepted hash value to identify the device in the target area and obtain the device identifier.

[0086] The advertisement data sending module is used to obtain advertisement data and send the advertisement data to the device in the target area according to the device identifier.

[0087] Optionally, in an embodiment of the present application, the number of truncated bits is the number of bits used to truncate the hash value from back to front, or the number of truncation bits is the number of bits used to truncate the hash value from front to back.

[0088] It should be understood that the device corresponds to the above-mentioned device identification method embodiment and can execute the various steps involved in the above-mentioned method embodiment. The specific functions of the device can be found in the above description, and the detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the device.

[0089] See also Figure 4 The electronic device 300 provided in the embodiment of the present application includes: a processor 310 and a memory 320, wherein the memory 320 stores machine-readable instructions executable by the processor 310, and when the machine-readable instructions are executed by the processor 310, the above method is executed.

[0090] The embodiments of the present application also provide a computer-readable storage medium 330, on which a computer program is stored. When the computer program is run by a processor 310, the above method is executed. Among them, the computer-readable storage medium 330 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM for short), Electrically Erasable Programmable Read-Only Memory (EEPROM for short), Erasable Programmable Read Only Memory (EPROM for short), Programmable Read-Only Memory (PROM for short), Read-Only Memory (ROM for short), magnetic memory, flash memory, magnetic disk or optical disk.

[0091] It should be noted that the various embodiments in this specification are all described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other. For device embodiments, since they are basically similar to method embodiments, they are described relatively simply. For related parts, reference can be made to the partial description of the method embodiments.

[0092] In several embodiments provided by the embodiments of the present application, it should be understood that the disclosed device and method can also be implemented in other ways. The device embodiments described above are only illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of the device, method, and computer program product according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code. A module, a program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may also occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, which mainly depends on the functions involved.

[0093] In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part. In addition, in the description of this specification, the descriptions with reference to the terms "one embodiment", "some embodiments", "example", "specific example", "some examples", etc. mean that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the embodiments of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0094] The above description is only an alternative implementation manner of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the embodiments of the present application, and all should be covered by the protection scope of the embodiments of the present application.

Claims

1. A device identification method, characterized in that, Including: Obtain the number of devices in the target area, and determine multiple truncation bits for truncating the hash value according to the number of devices, where the value range of the multiple truncation bits is less than all the bits of the hash value; Determine a target truncation bit from the multiple truncation bits, where the collision probability of the target truncation bit meets a preset condition; Obtain the device hash value in the target area, and truncate the device hash value according to the target truncation bit to obtain a truncated hash value, where the truncated hash value is used to identify the devices in the target area; Wherein, the truncation bit is the number of bits for truncating the device hash value in the forward or backward direction; determining a target truncation bit from the multiple truncation bits, where the collision probability meets a preset condition, includes: determining, from the multiple truncation bits, a truncation bit whose corresponding collision probability is less than a preset threshold as the target truncation bit, where the collision probability corresponding to the truncation bit is calculated according to the number of devices and the truncation bit; or, for each truncation bit in the multiple truncation bits, calculate the collision probability according to the number of devices and the truncation bit to obtain multiple collision probabilities; screen out the minimum collision probability from the multiple collision probabilities, and determine the truncation bit corresponding to the minimum collision probability as the target truncation bit.

2. The method according to claim 1, characterized in that, The obtaining the device hash value in the target area includes: Obtain the unique identifier of the device in the target area; Perform a hash calculation on the unique identifier of the device to obtain the device hash value.

3. The method according to claim 1, characterized in that, After determining the truncation bit corresponding to the minimum collision probability as the target truncation bit, it further includes: Send the truncation bit corresponding to the minimum collision probability to the target device in the target area, so that the target device uses the truncation bit corresponding to the minimum collision probability to truncate the device hash value.

4. The method according to any one of claims 1 to 3, characterized in that After obtaining the truncated hash value, it further includes: Use the truncated hash value to identify the devices in the target area to obtain a device identifier; Obtain advertisement data, and send the advertisement data to the devices in the target area according to the device identifier.

5. An apparatus identification device, characterized in that, Including: A truncation bit determination module, configured to obtain the number of devices in the target area, and determine multiple truncation bits for truncating the hash value according to the number of devices, where the value range of the multiple truncation bits is less than all the bits of the hash value; A target bit determination module, configured to determine a target truncation bit from the multiple truncation bits, where the collision probability of the target truncation bit meets a preset condition; A device hash truncation module, configured to obtain the device hash value in the target area, and truncate the device hash value according to the target truncation bit to obtain a truncated hash value, where the truncated hash value is used to identify the devices in the target area; Wherein, the number of bits intercepted is the number of bits intercepted from the front-to-back direction or the back-to-front direction of the device hash value; determining the target number of bits intercepted whose collision probability meets the preset condition from the multiple numbers of bits intercepted includes: determining the number of bits intercepted whose corresponding collision probability is less than the preset threshold from the multiple numbers of bits intercepted as the target number of bits intercepted, wherein the collision probability corresponding to the number of bits intercepted is calculated according to the number of devices and the number of bits intercepted; or, for each of the multiple numbers of bits intercepted, calculating the collision probability according to the number of devices and the number of bits intercepted to obtain multiple collision probabilities; screening out the minimum collision probability from the multiple collision probabilities, and determining the number of bits intercepted corresponding to the minimum collision probability as the target number of bits intercepted.

6. An electronic device, characterized in that, Including: A processor and a memory, the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the method according to any one of claims 1 to 4 is executed.

7. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, the method according to any one of claims 1 to 4 is executed.

Citation Information

Patent Citations

  • Method and device for determining back-end devices of current session through load balancing equipment

    CN112311876A

  • Hash table determination method and device

    CN115576954A