Method for generating equipment ID to guarantee data security according to browser information

Obtaining browser information and generating device ID through JavaScript solves the problem of account and data security in the browser environment, and realizing the uniqueness of device ID and browser compatibility.

CN119830363APending Publication Date: 2025-04-15BEIJING AEROSPACE CLOUD ROAD CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411884259.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In the browser environment, there are problems with account security and data security, and it is difficult to generate a unique ID through the device hardware information to ensure security.

Method used

Use JavaScript to obtain UserAgent information and device information, combine the value range and grouping length, generate the device ID, ensure its uniqueness and store it in the browser for subsequent verification.

Benefits of technology

It realizes the generation of unique device IDs in the browser environment, improves the security of accounts and data, and is suitable for multi-platform and multi-browser environments.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention discloses a method for generating a device ID (Identity) to guarantee data security according to browser information, which comprises the following steps of: acquiring User Agent information and device information of user equipment through JavaScript, and further defining a certain browser in the device; setting a value range and a grouping length, outputting an equipment ID value under the current setting, and obtaining the equipment ID value after confirmation; determining initial to-be-processed information according to the setting of the value range and the grouping length; the initial to-be-processed information is converted into Unicode codes, and to-be-processed information represented by UTF-16 is obtained; grouping the to-be-processed information represented by the UTF-16 according to the setting of the grouping length; returning the data grouped according to the given length; setting a standard array used as a reference during subsequent conversion; the original character strings correspond to the standard array in the step S305 one by one; through technologies such as JavaScript, when a browser is used, the unique ID is determined according to equipment information, and the beneficial effect of guaranteeing account security and data security is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of JavaScript technology in web front-end development, and in particular to a method for generating a device ID based on browser information to ensure data security. Background Art

[0002] There are many types of mobile device ID identifiers, including but not limited to IMEI, MEID, MAC address, Android ID, IDFA, OAID, GAID, UUID, UDID, etc. These identifiers play a key role in different business scenarios. For example, IMEI and MEID are mainly used for device identification at the hardware level, while Android ID and IDFA are used for user tracking at the software level.

[0003] However, there are still serious account security and data security issues when using browsers. Summary of the invention

[0005] In view of the above technical problems in the related art, the present invention proposes a method for generating a device ID according to browser information to ensure data security, which can overcome the above shortcomings of the prior art.

[0006] To achieve the above technical objectives, the technical solution of the present invention is implemented as follows: A method for generating a device ID based on browser information to ensure data security; The method for generating a device ID based on browser information to ensure data security includes the following specific steps: Step S1: Obtain the UserAgent information and device information of the user device through JavaScript, and then define a browser in the device; Step S2: Set the value range and group length, and output the device ID value under the current setting. After confirmation, the device ID value can be obtained; Step S3: Determine the initial information to be processed according to the value range and packet length set in step S2; Step S4: converting the initial information to be processed into Unicode code to obtain the information to be processed represented by UTF-16; Step S5: Group the information to be processed represented by UTF-16 according to the setting of the group length; and return the data grouped with the given length; Step S6: Setting a standard array to be used as a reference for subsequent conversion; Step S7: Align the original character strings one by one to the standard array described in step S305.

[0007] Furthermore, the optional items of the value range in step S3 include "only include value" and "including key, value", and the default value of the value range in step S3 is "only include value".

[0008] Furthermore, the optional range of the packet length in step S3 is 2-32, and the packet length includes two modes: input adjustment or up and down adjustment. The default value of the packet length in step S202 is 12.

[0009] Furthermore, when the device ID value is obtained by the Google Chrome browser in step S3, the device ID value under the default setting is 7ow9yC8cXwg.

[0010] Furthermore, when the Firefox browser obtains the device ID value in step S3, the device ID value under the default setting is 7owO9NOA.

[0011] Furthermore, the length of the standard array obtained in step S6 is 62.

[0012] Furthermore, the device information is screen information, and the screen information includes width, height, and color depth values.

[0013] The beneficial effects of the present invention are as follows: through the technical solution of the method of the present invention, technical means such as JavaScript are used to solve the problem of determining a unique ID based on device information when using a browser, thereby ensuring account security and data security, thereby achieving the beneficial technical effect of improving account security. In addition, the browser compatibility of this method is good, and it can meet the needs of multi-platform and multi-browser use. DETAILED DESCRIPTION

[0014] In current mobile devices, the hardware device ID is unique, ensuring that each device has a unique identifier. This uniqueness can be achieved through hardware characteristics (such as IMEI, MAC address, etc.). This uniqueness helps to identify and track devices and prevent devices from being tampered with or counterfeited. In the browser environment, hardware information cannot be obtained.

[0017] A specific algorithm is used to generate the Device ID. The algorithm tries to ensure that no two devices on the same system or platform will have the same ID. The algorithm may consider multiple factors, such as the device's hardware configuration, system time, random number generator, etc., to increase the complexity and uniqueness of the ID. It helps establish secure and reliable user associations and improve account security.

[0018] In some cases, such as a device reset or system update, the Device ID may change. However, these changes are usually strictly managed to ensure that the ID generated in the new environment is still unique. The system may take additional steps, such as requiring the user to reactivate the device after a device reset, to generate a new unique ID.

[0019] The purpose of the present invention is to solve the problem of determining a unique ID based on device information to ensure account security and data security when using a browser through technologies such as JavaScript.

[0020] According to an embodiment of the present invention, a method for generating a device ID based on browser information to ensure data security specifically includes the following steps: Step S1: Obtain the UserAgent information and device information of the user device through JavaScript, and then define a browser in the device; Step S2: Set the value range and group length, and output the device ID value under the current setting. After confirmation, the device ID value can be obtained; Step S3: Determine the initial information to be processed according to the value range and packet length set in step S2; Step S4: converting the initial information to be processed into Unicode code to obtain the information to be processed represented by UTF-16; Step S5: Group the information to be processed represented by UTF-16 according to the setting of the group length; and return the data grouped with the given length; Step S6: Setting a standard array to be used as a reference for subsequent conversion; Step S7: Align the original character strings one by one to the standard array described in step S305.

[0021] According to a method for generating a device ID based on browser information to ensure data security according to an embodiment of the present invention, in a specific embodiment, the optional options for the value range in step S3 include "only include value" and "include key, value", and the default value of the value range in step S3 is "only include value".

[0022] According to a method for generating a device ID based on browser information to ensure data security according to an embodiment of the present invention, in a specific embodiment, the optional range of the group length in step S3 is 2-32, and the group length includes two modes: input adjustment or up and down adjustment. The default value of the group length in step S202 is 12.

[0023] According to a method for generating a device ID based on browser information to ensure data security described in an embodiment of the present invention, in a specific embodiment, when the device ID value is obtained by the Google Chrome browser in step S3, the device ID value under the default setting is 7ow9yC8cXwg.

[0024] According to a method for generating a device ID based on browser information to ensure data security according to an embodiment of the present invention, in a specific embodiment, when the Firefox browser obtains the device ID value in step S3, the device ID value under the default setting is 7owO9NOA.

[0025] According to a method for generating a device ID according to browser information to ensure data security according to an embodiment of the present invention, in a specific embodiment, the length of the standard array obtained in step S6 is 62.

[0026] According to a method for generating a device ID based on browser information to ensure data security according to an embodiment of the present invention, in a specific embodiment, the device information is screen information, and the screen information includes width, height, and color depth values.

[0027] In order to facilitate understanding of the above technical solutions of the present invention, the above technical solutions of the present invention are described in detail below through specific usage methods.

[0028] In specific use, a method for generating a device ID based on browser information to ensure data security is described in the present invention.

[0029] It also covers the user interface and instructions and use of the system, specifically: Among them, the user interface and instructions include the following three parts: 1. Overall interface: The entire interface is divided into two areas: basic information area and function area; 2. Basic information area: Here you can get the basic information of the current device, including browser version, screen width, height, color depth, etc. Click the "Get" button to get the basic information; 3. Function area: Here you can set the value range and group length, and output the device ID value under the current settings. Click the "Confirm" button to get the device ID value.

[0030] Among them, the system usage includes the following three parts: 1. Get the UserAgent information, device information (screen information), etc. of the user's device: const navigatorObj = window.navigator; const deviceObj = {userAgent: navigatorObj.userAgent,width:screenObj.availWidth,height:screenObj.availHeight,colorDepth:screenObj.colorDepth}; 2. Select the value range and group length: The available options for the value range are "Only include value" and "Include key, value", the default value is "Only include value", and the optional range of group length is 2~32, which can be entered or adjusted up or down, and the default value is 12; 3. Get the device ID value: Click the "Confirm" button in the function area, and the corresponding device ID value will be displayed in the "Device ID value under current settings" area below.

[0031] The device ID value of Google Chrome browser under default settings (value range is "only include value" and group length is 12) is 7ow9yC8cXwg; The device ID value of Firefox browser under the default settings (value range is "only include value" and group length is 12) is 7owO9NOA.

[0032] This patent discloses a method for generating a device ID based on browser information to ensure data security, which specifically includes the following steps: Step 1: Get the UserAgent information of the user's device, the width, height, color depth, etc. of the device information (screen information). This information can be obtained through JavaScript and can better define a browser on the device.

[0033] Step 2: Determine the initial information to be processed according to the setting of the value range. Different value ranges will result in different initial information to be processed.

[0034] Step 3: Convert the initial information to be processed into Unicode code to obtain the information to be processed represented by UTF-16.

[0035] Code: let strArr = [];jsonStr.split('').forEach(function (c) { / / Convert to Unicode code and return the integer representing the UTF-16 code of the character strArr.push(c.charCodeAt(0));}); The charCodeAt() method in JavaScript is used to return the UTF-16 encoding of the character at the specified index in a string. This method returns an integer between 0 and 65535, representing the UTF-16 code unit value of the character at the given index.

[0036] Information after conversion to Unicode code: Step 4: Group the information to be processed represented by UTF-16 according to the group length setting. Return the data grouped with the given length.

[0037] Code: const sliceArr = (arr, pageSize) =>{ / / Group arr into groups of pageSize characters each const result = []; let count = 0; while (count * pageSize <arr.length){result.push(arr.slice(count * pageSize, pageSize * (count + 1)));count++;}return result;};let resultArr = sliceArr(strArr, PieceLength); Step 5: Set the standard array. Subsequent conversions will be based on this standard array. The length of the obtained standard array is 62.

[0038] Code: const standardArr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Y', 'U', 'V', 'W', 'X', 'Y','Z', 'a', 'b', 'c', 'd', 'e', ​​'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r','s', 't','u', 'v', 'w', 'x', 'y', 'z']; const length = standardArr.length; Step 6: For each data in the one-dimensional array converted into Unicode code, multiply the position index value by its own value one by one, and add them up to get the total.

[0039] Code: let data = 0; let tempArr = []; resultArr.forEach(function (c) {data= 0;c.forEach(function (item, index) {data += item * index;});tempArr.push(data % length);}); Step 7: Match the original strings one by one to the standard array.

[0040] Code: let resultStr = ''; tempArr.forEach(function (item) {resultStr +=standardArr[item]}); return resultStr; In some cases, direct access to device hardware information may be limited, so JavaScript can be used to generate a long ID that is statistically guaranteed to be unique and stored in the browser's localStorage or cookies. It is then passed to the database for storage and the device ID is verified the next time the user visits to prevent login on other devices. When an inconsistency in the device ID is detected, the user can be asked to log in again or a verification code can be used to ensure data security.

[0041] To sum up, with the help of the above-mentioned technical scheme of the present invention, through the technical scheme of the method of the present invention, technical means such as JavaScript are used to solve the problem of determining a unique ID based on device information when using a browser, so that account security and data security can be guaranteed, thereby achieving the beneficial technical effect of improving account security. In addition, the browser compatibility of this method is good, and it can meet the needs of multi-platform and multi-browser use.

[0042] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for generating a device ID based on browser information to ensure data security, characterized in that: The specific steps include: Step S1: Obtain the UserAgent information and device information of the user device through JavaScript, and then define a browser in the device; Step S2: Set the value range and group length, and output the device ID value under the current setting. After confirmation, the device ID value can be obtained; Step S3: Determine the initial information to be processed according to the value range and packet length set in step S2; Step S4: converting the initial information to be processed into Unicode code to obtain the information to be processed represented by UTF-16; Step S5: Group the information to be processed represented by UTF-16 according to the setting of the group length; and return the data grouped with the given length; Step S6: Setting a standard array to be used as a reference for subsequent conversion; Step S7: Align the original character strings one by one to the standard array described in step S305.

2. A method for ensuring data security by generating a device ID based on browser information according to claim 1, characterized in that: The optional options for the value range in step S3 include "only include value" and "include key, value", and the default value of the value range in step S3 is "only include value".

3. A method for ensuring data security by generating a device ID based on browser information according to claim 1, characterized in that: The optional range of the packet length in step S3 is 2-32, and the packet length includes two modes: input adjustment or up and down adjustment. The default value of the packet length in step S202 is 12.

4. A method for ensuring data security by generating a device ID based on browser information according to claim 1, characterized in that: When the device ID value is obtained by the Google Chrome browser in step S3, the device ID value under the default setting is 7ow9yC8cXwg.

5. The method for ensuring data security by generating a device ID based on browser information according to claim 1, characterized in that: When the Firefox browser obtains the device ID value in step S3, the device ID value under the default setting is 7owO9NOA.

6. A method for ensuring data security by generating a device ID based on browser information according to claim 1, characterized in that: The length of the standard array obtained in step S6 is 62.

7. A method for ensuring data security by generating a device ID based on browser information according to claim 1, characterized in that: The device information is screen information, and the screen information includes width, height, and color depth values.