CN106375983B - A method and device for generating an identifier - Google Patents
A method and device for generating an identifier Download PDFInfo
- Publication number
- CN106375983B CN106375983B CN201610943018.4A CN201610943018A CN106375983B CN 106375983 B CN106375983 B CN 106375983B CN 201610943018 A CN201610943018 A CN 201610943018A CN 106375983 B CN106375983 B CN 106375983B
- Authority
- CN
- China
- Prior art keywords
- identifier
- information
- correct
- mobile terminal
- application
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 37
- 230000008569 process Effects 0.000 claims description 6
- 230000006870 function Effects 0.000 description 15
- 238000004891 communication Methods 0.000 description 12
- 230000010365 information processing Effects 0.000 description 9
- 230000003287 optical effect Effects 0.000 description 5
- 230000002093 peripheral effect Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000013478 data encryption standard Methods 0.000 description 2
- 230000033001 locomotion Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000000295 complement effect Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000010076 replication Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W8/00—Network data management
- H04W8/18—Processing of user or subscriber data, e.g. subscribed services, user preferences or user profiles; Transfer of user or subscriber data
- H04W8/183—Processing at user equipment or user record carrier
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72403—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
- H04M1/72406—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality by software upgrading or downloading
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/02—Protecting privacy or anonymity, e.g. protecting personally identifiable information [PII]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W12/00—Security arrangements; Authentication; Protecting privacy or anonymity
- H04W12/06—Authentication
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
本发明提供了一种标识符生成方法和装置,该方法包括:获取自身的应用标识符和移动终端中的标识符信息,所述标识符信息包括多个标识符;确定所述标识符信息中多个标识符中的正确的标识符;在确定所述标识符信息中存在至少一个正确的标识符后,将所述至少一个正确的标识符生成目标标识符;根据所述目标标识符和所述应用标识符,生成移动终端唯一标识符。本发明还公开相应的标识符生成装置。
The present invention provides a method and device for generating an identifier. The method includes: acquiring its own application identifier and identifier information in a mobile terminal, where the identifier information includes a plurality of identifiers; A correct identifier among multiple identifiers; after determining that there is at least one correct identifier in the identifier information, generating a target identifier from the at least one correct identifier; according to the target identifier and the The above application identifier is used to generate a unique identifier for the mobile terminal. The invention also discloses a corresponding identifier generating device.
Description
技术领域technical field
本发明涉及通信技术领域,具体而言,涉及一种标识符生成方法和装置。The present invention relates to the field of communication technologies, and in particular, to a method and device for generating an identifier.
背景技术Background technique
当前运行有安卓操作系统的计算设备多种多样,不同的厂商在定制安卓设备时也会加入不同的标识符来保证该手机唯一性。但是,有些标识符可能不符合规范,或者不是唯一标识,导致该设备中运行的安卓应用无法获取到唯一标识符号,因此就无法判断该手机的合法性,从而导致上述应用中的功能逻辑出现问题。Currently, there are various computing devices running the Android operating system, and different manufacturers also add different identifiers when customizing Android devices to ensure the uniqueness of the mobile phone. However, some identifiers may not comply with the specifications, or may not be unique identifiers, so that the Android application running on the device cannot obtain the unique identifier, so it is impossible to judge the legitimacy of the mobile phone, which leads to problems in the functional logic of the above application .
因此,需要提出一个能够使每一台设备都拥有唯一标识符来保证其手机的唯一性。Therefore, it is necessary to propose a method that enables each device to have a unique identifier to ensure the uniqueness of its mobile phone.
发明内容Contents of the invention
有鉴于此,本发明的目的在于提供一种标识符生成方法和装置,以力图解决或者至少缓解上面存在的问题。In view of this, the object of the present invention is to provide a method and device for generating an identifier in an attempt to solve or at least alleviate the above existing problems.
第一方面,本发明提供一种标识符生成方法,该方法包括:In a first aspect, the present invention provides a method for generating an identifier, the method comprising:
获取自身的应用标识符和移动终端中的标识符信息,所述标识符信息包括多个标识符;Obtain its own application identifier and identifier information in the mobile terminal, where the identifier information includes multiple identifiers;
确定所述标识符信息中多个标识符中的正确的标识符;determining the correct identifier of the plurality of identifiers in the identifier information;
在确定所述标识符信息中存在至少一个正确的标识符后,将所述至少一个正确的标识符生成目标标识符;After determining that there is at least one correct identifier in the identifier information, generating a target identifier from the at least one correct identifier;
根据所述目标标识符和所述应用标识符,生成移动终端唯一标识符。Generate a unique identifier for the mobile terminal according to the target identifier and the application identifier.
可选地,在根据本发明的方法中,确定所述标识符信息中的多个标识符中的正确的标识符,包括:Optionally, in the method according to the present invention, determining the correct identifier among the plurality of identifiers in the identifier information includes:
遍历所述标识符信息中的每个标识符,每当判定当前标识符中每个字符的重复次数小于预定次数时,确定所述当前标识符为正确的标识符,直到所有所述标识符判定完毕。Traverse each identifier in the identifier information, and determine that the current identifier is the correct identifier whenever it is determined that the number of repetitions of each character in the current identifier is less than a predetermined number of times, until all the identifiers are determined complete.
可选地,在根据本发明的方法中,在确定所述标识符信息中存在至少一个正确的标识符后,将所述至少一个正确的标识符生成目标标识符,包括:Optionally, in the method according to the present invention, after determining that there is at least one correct identifier in the identifier information, generating the target identifier from the at least one correct identifier includes:
在确定所述标识符信息中存在至少一个正确的标识符后,利用第一规则将所述至少一个正确的标识符生成目标标识符。After determining that there is at least one correct identifier in the identifier information, generate a target identifier from the at least one correct identifier by using a first rule.
可选地,在根据本发明的方法中,确定所述标识符信息中的多个标识符中的正确的标识符,还包括:Optionally, in the method according to the present invention, determining the correct identifier among the plurality of identifiers in the identifier information further includes:
在确定所述标识符信息中的各个标识符都不正确后,则利用第二规则生成目标标识符。After determining that each identifier in the identifier information is incorrect, a second rule is used to generate a target identifier.
可选地,在根据本发明的方法中,根据所述目标标识符和所述应用标识符,生成移动终端唯一标识符,包括:Optionally, in the method according to the present invention, generating a mobile terminal unique identifier according to the target identifier and the application identifier includes:
利用第一加密算法将所述目标标识符与所述应用标识符进行组合,得到加密标识符;combining the target identifier with the application identifier using a first encryption algorithm to obtain an encrypted identifier;
利用第二加密算法将所述加密标识符进行加密,得到所述移动终端唯一标识符。The encrypted identifier is encrypted by using a second encryption algorithm to obtain the unique identifier of the mobile terminal.
第二方面,本发明提供一种标识符生成装置,该装置包括:In a second aspect, the present invention provides an identifier generation device, which includes:
信息获取单元,用于获取自身的应用标识符和移动终端中的标识符信息,所述标识符信息包括多个标识符;An information acquiring unit, configured to acquire its own application identifier and identifier information in the mobile terminal, where the identifier information includes multiple identifiers;
信息处理单元,用于确定所述标识符信息中的多个标识符中的正确的标识符;an information processing unit configured to determine a correct identifier among a plurality of identifiers in the identifier information;
第一生成单元,用于在所述信息处理单元确定所述标识符信息中存在至少一个正确的标识符后,将所述至少一个正确的标识符生成目标标识符;A first generating unit, configured to generate a target identifier from the at least one correct identifier after the information processing unit determines that there is at least one correct identifier in the identifier information;
第二生成单元,用于根据所述目标标识符和所述应用标识符,生成移动终端唯一标识符。The second generating unit is configured to generate a unique identifier of the mobile terminal according to the target identifier and the application identifier.
可选地,在根据本发明的装置中,所述信息处理单元还用于:Optionally, in the device according to the present invention, the information processing unit is further configured to:
遍历所述标识符信息中的每个标识符,每当判定当前标识符中每个字符的重复次数小于预定次数时,确定所述当前标识符为正确的标识符,直到所有所述标识符判定完毕。Traverse each identifier in the identifier information, and determine that the current identifier is the correct identifier whenever it is determined that the number of repetitions of each character in the current identifier is less than a predetermined number of times, until all the identifiers are determined complete.
可选地,在根据本发明的装置中,所述第一生成单元还用于:Optionally, in the device according to the present invention, the first generating unit is further configured to:
在确定所述标识符信息中存在至少一个正确的标识符后,利用第一规则将所述至少一个正确的标识符生成目标标识符。After determining that there is at least one correct identifier in the identifier information, generate a target identifier from the at least one correct identifier by using a first rule.
可选地,在根据本发明的装置中,所述第一生成单元还用于:Optionally, in the device according to the present invention, the first generating unit is further configured to:
在所述信息处理单元确定所述标识符信息中的各个标识符都不正确后,则利用第二规则生成目标标识符。After the information processing unit determines that each identifier in the identifier information is incorrect, a second rule is used to generate a target identifier.
可选地,在根据本发明的装置中,所述第二生成单元还用于:Optionally, in the device according to the present invention, the second generating unit is further configured to:
利用第一加密算法将所述目标标识符与所述应用标识符进行组合,得到加密标识符;combining the target identifier with the application identifier using a first encryption algorithm to obtain an encrypted identifier;
利用第二加密算法将所述加密标识符进行加密,得到所述移动终端唯一标识符。The encrypted identifier is encrypted by using a second encryption algorithm to obtain the unique identifier of the mobile terminal.
根据本发明的技术方案,通过在获取的移动终端中的正确的标识符中添加自身的应用标识符并加密得到唯一标识符,保证移动终端中标识符的唯一性以及准确性。According to the technical solution of the present invention, the uniqueness and accuracy of the identifier in the mobile terminal is guaranteed by adding its own application identifier to the obtained correct identifier in the mobile terminal and encrypting to obtain a unique identifier.
为使本发明的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present invention more comprehensible, preferred embodiments will be described in detail below together with the accompanying drawings.
附图说明Description of drawings
为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present invention more clearly, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention, and thus It should be regarded as a limitation on the scope, and those skilled in the art can also obtain other related drawings based on these drawings without creative work.
图1示出了一个移动终端100的结构框图;FIG. 1 shows a structural block diagram of a mobile terminal 100;
图2示出了本发明实施例所提供的一种标识符生成方法的流程图;FIG. 2 shows a flowchart of an identifier generation method provided by an embodiment of the present invention;
图3示出了本发明实施例所提供的一种移动终端中标识符界面的示意图;FIG. 3 shows a schematic diagram of an identifier interface in a mobile terminal provided by an embodiment of the present invention;
图4示出了本发明实施例所提供的一种标识符生成装置的结构图。Fig. 4 shows a structural diagram of an identifier generating device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本发明实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本发明的实施例的详细描述并非旨在限制要求保护的本发明的范围,而是仅仅表示本发明的选定实施例。基于本发明的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only It is a part of embodiments of the present invention, but not all embodiments. The components of the embodiments of the invention generally described and illustrated in the figures herein may be arranged and designed in a variety of different configurations. Accordingly, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts belong to the protection scope of the present invention.
图1是移动终端100的结构框图。具有多点触摸能力的移动终端100可以包括存储器接口102、一个或多个数据处理器、图像处理器和/或中央处理单元104,以及外围接口106。FIG. 1 is a structural block diagram of a mobile terminal 100 . The mobile terminal 100 with multi-touch capability may include a memory interface 102 , one or more data processors, image processors and/or a central processing unit 104 , and a peripheral interface 106 .
存储器接口102、一个或多个处理器104和/或外围接口106既可以是分立元件,也可以集成在一个或多个集成电路中。在移动终端100中,各种元件可以通过一条或多条通信总线或信号线来耦合。传感器、设备和子系统可以耦合到外围接口106,以便帮助实现多种功能。例如,运动传感器110、光传感器112和距离传感器114可以耦合到外围接口106,以方便定向、照明和测距等功能。其他传感器116同样可以与外围接口106相连,例如定位系统(例如GPS接收机)、温度传感器、生物测定传感器或其他感测设备,由此可以帮助实施相关的功能。Memory interface 102, one or more processors 104, and/or peripheral interface 106 may be discrete components or integrated into one or more integrated circuits. In the mobile terminal 100, various elements may be coupled through one or more communication buses or signal lines. Sensors, devices, and subsystems can be coupled to the peripherals interface 106 to facilitate various functions. For example, motion sensor 110, light sensor 112, and distance sensor 114 may be coupled to peripherals interface 106 to facilitate orientation, lighting, and ranging functions, among others. Other sensors 116 may also be connected to the peripheral interface 106, such as positioning systems (eg, GPS receivers), temperature sensors, biometric sensors, or other sensing devices, thereby helping to perform related functions.
相机子系统120和光学传感器122可以用于方便诸如记录照片和视频剪辑的相机功能的实现,其中所述相机子系统和光学传感器例如可以是电荷耦合器件(CCD)或互补金属氧化物半导体(CMOS)光学传感器。Camera subsystem 120 and optical sensor 122, which may be, for example, charge-coupled devices (CCDs) or complementary metal-oxide-semiconductor (CMOS) devices, may be used to facilitate camera functions such as recording photos and video clips. ) optical sensor.
可以通过一个或多个无线通信子系统124来帮助实现通信功能,其中无线通信子系统可以包括射频接收机和发射机和/或光(例如红外)接收机和发射机。无线通信子系统124的特定设计和实施方式可以取决于移动终端100所支持的一个或多个通信网络。例如,移动终端100可以包括被设计成支持GSM网络、GPRS网络、EDGE网络、Wi-Fi或WiMax网络以及BlueboothTM网络的无线通信子系统。Communications functions may be facilitated by one or more wireless communications subsystems 124, which may include radio frequency receivers and transmitters and/or optical (eg, infrared) receivers and transmitters. The specific design and implementation of wireless communication subsystem 124 may depend on one or more communication networks supported by mobile terminal 100 . For example, the mobile terminal 100 may include a wireless communication subsystem designed to support a GSM network, a GPRS network, an EDGE network, a Wi-Fi or WiMax network, and a Bluebooth™ network.
音频子系统126可以与扬声器128以及麦克风130相耦合,以便帮助实施启用语音的功能,例如语音识别、语音复制、数字记录和电话功能。Audio subsystem 126 may be coupled with speaker 128 and microphone 130 to facilitate voice-enabled functions such as voice recognition, voice replication, digital recording, and telephony functions.
I/O子系统140可以包括触摸屏控制器142和/或一个或多个其他输入控制器144。I/O subsystem 140 may include a touch screen controller 142 and/or one or more other input controllers 144 .
触摸屏控制器142可以耦合到触摸屏146。举例来说,该触摸屏146和触摸屏控制器142可以使用多种触摸感测技术中的任何一种来检测与之进行的接触和移动或是暂停,其中感测技术包括但不局限于电容性、电阻性、红外和表面声波技术。Touch screen controller 142 may be coupled to touch screen 146 . For example, the touch screen 146 and touch screen controller 142 can use any of a variety of touch sensing technologies to detect contact and movement therewith or pauses, including but not limited to capacitive, Resistive, infrared and surface acoustic wave technologies.
一个或多个其他输入控制器144可以耦合到其他输入/控制设备148,例如一个或多个按钮、摇杆开关、拇指旋轮、红外端口、USB端口、和/或指示笔之类的指点设备。一个或多个按钮(未显示)可以包括用于控制扬声器128和/或麦克风130音量的向上/向下按钮。One or more other input controllers 144 may be coupled to other input/control devices 148, such as one or more buttons, rocker switches, thumbwheels, infrared ports, USB ports, and/or pointing devices such as stylus . The one or more buttons (not shown) may include an up/down button for controlling speaker 128 and/or microphone 130 volume.
存储器接口102可以与存储器150相耦合。该存储器150可以包括高速随机存取存储器和/或非易失性存储器,例如一个或多个磁盘存储设备,一个或多个光学存储设备,和/或闪存存储器(例如NAND,NOR)。Memory interface 102 may be coupled with memory 150 . The memory 150 may include high-speed random access memory and/or non-volatile memory, such as one or more magnetic disk storage devices, one or more optical storage devices, and/or flash memory (eg, NAND, NOR).
存储器150可以存储操作系统152,例如Android、IOS或是Windows Phone之类的操作系统。该操作系统152可以包括用于处理基本系统服务以及执行依赖于硬件的任务的指令。存储器150还可以存储各种应用154。在移动设备运行时,会从存储器150中加载操作系统152,并且由处理器104执行。应用154在运行时,也会从存储器150中加载,并由处理器104执行。应用154运行在操作系统之上,利用操作系统以及底层硬件提供的接口实现各种用户期望的功能,如即时通信、网页浏览、图片管理等。应用可以是独立于操作系统提供的,也可以是操作系统自带的。The memory 150 can store an operating system 152, such as an operating system such as Android, IOS, or Windows Phone. The operating system 152 may include instructions for handling basic system services and performing hardware-dependent tasks. The memory 150 may also store various applications 154 . When the mobile device is running, an operating system 152 is loaded from memory 150 and executed by processor 104 . When running, the application 154 is also loaded from the memory 150 and executed by the processor 104 . The application 154 runs on the operating system, and utilizes the interfaces provided by the operating system and the underlying hardware to realize various user-desired functions, such as instant messaging, web browsing, picture management, and the like. The application can be provided independently of the operating system, or it can be provided by the operating system itself.
在各种应用154中,其中的一种应用为标识符生成装置,该装置可以获取移动终端中的多个标识符,在多个标识符中确定可用标识符,进而为移动终端生成一个唯一标识符,提高用户体验,保证移动终端的唯一性,下文会进行详细的叙述。Among the various applications 154, one of them is an identifier generating device, which can obtain multiple identifiers in the mobile terminal, determine available identifiers among the multiple identifiers, and then generate a unique identifier for the mobile terminal character, improve user experience, and ensure the uniqueness of the mobile terminal, which will be described in detail below.
图2示出了根据本发明实施例所提供的一种标识符生成方法的流程图。如图2所示,该方法在移动终端中执行,上述方法始于步骤S210。Fig. 2 shows a flow chart of a method for generating an identifier according to an embodiment of the present invention. As shown in FIG. 2, the method is executed in a mobile terminal, and the above method starts at step S210.
在步骤S210中,获取自身的应用标识符和移动终端中的标识符信息,上述标识符信息包括多个标识符。其中,安装在移动终端中的每一个应用都有标识符,上述应用标识符为执行该标识符生成方法的应用的标识符,如,packageID。移动终端中的标识符信息为移动终端中其他应用(不包括执行该标识符生成方法的应用)如通话应用的标识符或者移动终端中网卡序列号等等。标识符一般是字符串形式,具体可参考图3。In step S210, the own application identifier and identifier information in the mobile terminal are obtained, and the above identifier information includes a plurality of identifiers. Wherein, each application installed in the mobile terminal has an identifier, and the above-mentioned application identifier is an identifier of the application executing the method for generating the identifier, such as packageID. The identifier information in the mobile terminal is the identifier of other applications in the mobile terminal (excluding the application that executes the method for generating the identifier), such as the identifier of the call application or the serial number of the network card in the mobile terminal. The identifier is generally in the form of a character string, for details, refer to FIG. 3 .
移动终端如运行有安卓操作系统的手机中的标识符一般有很多,手机中的标识符都可以标识手机的唯一性。如,移动设备国际标识符(IMEI)、通信标识符(Pseudo-UniqueID)、无线模块标识符(The WLAN MAC Address)、蓝牙模块标识符(The BT MAC Address)等等。Generally, there are many identifiers in a mobile terminal such as a mobile phone running an Android operating system, and all the identifiers in the mobile phone can identify the uniqueness of the mobile phone. For example, International Mobile Equipment Identifier (IMEI), Communication Identifier (Pseudo-UniqueID), Wireless Module Identifier (The WLAN MAC Address), Bluetooth Module Identifier (The BT MAC Address) and so on.
IMEI可以通过获取安卓操作系统中的TelephonyManager对象,再通过调用TelephonyManager对象的getDeviceId接口则可以获取到Android设备的IMEI信息。获取IMEI的代码如下:TelephonyManagertm=(TelephonyManager)getSystemService(TELEPHONY_SERVICE);String szImei=tm.getDeviceId()。其中,getSystemService(TELEPHONY_SERVICE)用来获取到TelephonyManager对象。IMEI can obtain the IMEI information of the Android device by obtaining the TelephonyManager object in the Android operating system, and then calling the getDeviceId interface of the TelephonyManager object. The code for obtaining the IMEI is as follows: TelephonyManagerrtm=(TelephonyManager)getSystemService(TELEPHONY_SERVICE); String szImei=tm.getDeviceId(). Among them, getSystemService(TELEPHONY_SERVICE) is used to obtain the TelephonyManager object.
通信标识符是移动终端中通话应用的一个标识符,如果移动终端没有通话功能,或者通话功能有问题,那么该识别码可能就无法获取到。一般通过安卓操作系统中的组件Build获取到的手机设备的硬件信息androidBuildId,考虑每个硬件信息比较长,所以本发明只获取了每个硬件信息的长度的余10的值,即把每个硬件信息的长度值进行余10后的信息拼接起来,最终得到一个12位的数字。The communication identifier is an identifier of the call application in the mobile terminal. If the mobile terminal does not have a call function, or there is a problem with the call function, then the identification code may not be obtained. Generally, the hardware information androidBuildId of the mobile phone device obtained by the component Build in the Android operating system, considering that each hardware information is relatively long, so the present invention only obtains the value of the remaining 10 of the length of each hardware information, that is, each hardware information The length value of the information is spliced with the remaining 10 information, and finally a 12-digit number is obtained.
无线模块标识符是移动终端中有无线模块的才具有的,对于某些定制类或工业类设备,为了安全不加入无线模块就无法使用该功能获取到标识符了。移动终端通过WiFi接口getConnectionInfo来获取无线模块的信息接口info,如,WifiInfo info=wifi.getConnectionInfo(),再通过info接口的getMacAddress接口可以得到无线模块的MAC地址wifiMac,如,String wifiMac=info.getMacAddress()。The wireless module identifier is only available for mobile terminals with wireless modules. For some customized or industrial equipment, if you do not add a wireless module for safety, you cannot use this function to obtain the identifier. The mobile terminal obtains the information interface info of the wireless module through the WiFi interface getConnectionInfo, such as, WifiInfo info=wifi.getConnectionInfo (), and then the MAC address wifiMac of the wireless module can be obtained through the getMacAddress interface of the info interface, such as, String wifiMac=info.getMacAddress ().
同样,对于蓝牙模块标识符来说具有蓝牙功能才可以获取到该标识符。如,获取安卓操作系统中的BluetoothAdapter实例,BluetoothAdapter badapter=BluetoothAdapter.getDefaultAdapter(),在通过调用BluetoothAdapter的接口getAddress来获取MAC地址,String m_szBTMAC=badapter.getAddress()。Similarly, for the Bluetooth module identifier, the identifier can only be obtained if it has the Bluetooth function. For example, to obtain the BluetoothAdapter instance in the Android operating system, BluetoothAdapter badapter=BluetoothAdapter.getDefaultAdapter(), and obtain the MAC address by calling the interface getAddress of the BluetoothAdapter, String m_szBTMAC=badapter.getAddress().
不过应当理解,本发明获取的标识符不限于上述几种,所有可以获取到的、能够用来区别移动终端的标识符都在本发明的保护范围内。However, it should be understood that the identifiers obtained in the present invention are not limited to the above-mentioned types, and all identifiers that can be obtained and can be used to distinguish mobile terminals are within the protection scope of the present invention.
在步骤S220中,确定标识符信息中多个标识符中的正确的标识符。In step S220, the correct identifier among the plurality of identifiers in the identifier information is determined.
由于在步骤S210中获取的标识符可能会出错,需要确定获取的正确的标识符。在一种实施方式中,遍历标识符信息中的每个标识符,每当判定当前标识符中每个字符的重复次数小于预定次数时,确定上述当前标识符为正确的标识符,直到所有标识符判定完毕,其中,预定次数为标识符长度的一半。在遍历标识符时,会将字符保存到存储数据中,例如,存储数据为映射(map)对象,map是模板库(STL)中的的一个容器,数据一般以键/值对形式存储。在map对象中key中存储字符,当前key的value中存储字符的出现次数,如,获取的标识符为Abbbbbbbbbc,发现有相同的key就将key的value加1,遍历完当前标识符后,发现key为b字符时value为9,字符串的长度为11,该value值大于字符串长度的一般,该标识符舍弃。Since the identifier acquired in step S210 may be wrong, it is necessary to determine the correct identifier acquired. In one embodiment, each identifier in the identifier information is traversed, and whenever it is determined that the number of repetitions of each character in the current identifier is less than a predetermined number of times, the above-mentioned current identifier is determined to be the correct identifier, until all identifiers The character judgment is completed, wherein, the predetermined number of times is half of the length of the identifier. When traversing identifiers, characters are saved in storage data. For example, storage data is a map object, and map is a container in the template library (STL). Data is generally stored in the form of key/value pairs. The character is stored in the key of the map object, and the number of occurrences of the character is stored in the value of the current key. For example, the obtained identifier is Abbbbbbbbbc, and if the same key is found, the value of the key is increased by 1. After traversing the current identifier, it is found When the key is character b, the value is 9, and the length of the string is 11. If the value is greater than the length of the string, the identifier is discarded.
在步骤S230中,在确定所述标识符信息中存在至少一个正确的标识符后,将所述至少一个正确的标识符生成目标标识符。In step S230, after it is determined that there is at least one correct identifier in the identifier information, generate a target identifier from the at least one correct identifier.
根据一种实施方式,在确定标识符信息中存在至少一个正确的标识符后,利用第一规则将至少一个正确的标识符生成目标标识符。According to an implementation manner, after it is determined that there is at least one correct identifier in the identifier information, a first rule is used to generate the target identifier from the at least one correct identifier.
如果在步骤S220中确定存在一个正确的标识符,则将当前这个正确的标识符作为目标标识符。如果在步骤S220确定存在多于一个标识符如2个正确,此时,可以将两个正确的标识符进行简单的拼接作为目标标识符,如,两个标识符分别为asabcdfg和qwedfsso,目标标识符可以为asabcdfgqwedfsso。也可以将两个标识符进行混淆,将混淆后的字符串作为目标标识符,同样以上述两个标识符为例,目标标识符此时为assoceddqwfgfsab。If it is determined in step S220 that there is a correct identifier, the current correct identifier is used as the target identifier. If it is determined in step S220 that there is more than one identifier such as 2 correct, at this time, the two correct identifiers can be simply spliced as the target identifier, such as, the two identifiers are respectively asabcdfg and qwedfsso, the target identifier The character can be asabcdfgqwedfsso. It is also possible to confuse the two identifiers, and use the obfuscated character string as the target identifier. Taking the above two identifiers as an example, the target identifier is assoceddqwfgfsab at this time.
根据另一种实施方式,在确定标识符信息中的各个标识符都不正确后,则利用第二规则生成目标标识符。例如,在步骤S220中未确定正确的标识符,此时,可以将利用随机数生成器随机生成的字符串作为目标标识符,字符串的长度根据实际情况确定,将生成的上述目标标识符通过SharePreference保存在本地。According to another implementation manner, after it is determined that each identifier in the identifier information is incorrect, the second rule is used to generate the target identifier. For example, if the correct identifier is not determined in step S220, at this time, the character string randomly generated by the random number generator can be used as the target identifier, the length of the character string is determined according to the actual situation, and the above-mentioned target identifier generated by SharePreference is saved locally.
不过应当理解,所有可以生成目标标识符的规则都在本发明的保护范围内。所有可以存储目标标识符的文件也都在本发明的保护范围内。However, it should be understood that all rules that can generate target identifiers are within the protection scope of the present invention. All files that can store target identifiers are also within the protection scope of the present invention.
在步骤S240中,根据目标标识符和应用标识符,生成移动终端唯一标识符。In step S240, a unique identifier of the mobile terminal is generated according to the target identifier and the application identifier.
根据一种实施方式,利用第一加密算法将目标标识符与应用标识符进行组合,得到加密标识符。利用第二加密算法将加密标识符进行加密,得到移动终端唯一标识符。如,将步骤S230中的目标标识符与自身的应用标识符进行简单组合,对简单组合后的字符串利用如MD5算法或hash算法进行加密,得到加密字符串,然后利用如美国数据加密标准(DES算法)对上述加密字符串再次进行加密,得到移动终端唯一标识符。在一个实施例中,手机中的应用为付费应用,手机中的应用获取手机的唯一标识符并发送到服务器,服务器会保存上述唯一标识符,当手机中的应用再次被用户打开后,服务器只需要验证当前应用是否付费,不需要再次验证标识符。According to one embodiment, the target identifier and the application identifier are combined using a first encryption algorithm to obtain an encrypted identifier. The encrypted identifier is encrypted by using the second encryption algorithm to obtain the unique identifier of the mobile terminal. For example, the target identifier in step S230 is simply combined with its own application identifier, and the string after the simple combination is encrypted using an MD5 algorithm or a hash algorithm to obtain an encrypted string, and then using the US data encryption standard ( DES algorithm) encrypts the above-mentioned encrypted string again to obtain the unique identifier of the mobile terminal. In one embodiment, the application in the mobile phone is a paid application. The application in the mobile phone obtains the unique identifier of the mobile phone and sends it to the server. The server will save the unique identifier. When the application in the mobile phone is opened by the user again, the server will only It is necessary to verify whether the current application is paid, and there is no need to verify the identifier again.
根据本发明的技术方案,通过在获取的移动终端中的正确的标识符中添加自身的应用标识符并加密得到唯一标识符,保证移动终端中标识符的唯一性以及准确性。According to the technical solution of the present invention, the uniqueness and accuracy of the identifier in the mobile terminal is guaranteed by adding its own application identifier to the obtained correct identifier in the mobile terminal and encrypting to obtain a unique identifier.
图4示出了根据本发明实施例提供的一种标识符生成装置的流程图。如图4所示,该装置驻留在移动终端中,包括:信息获取单元410、信息处理单元420、第一生成单元430和第二生成单元440。Fig. 4 shows a flowchart of an identifier generating device provided according to an embodiment of the present invention. As shown in FIG. 4 , the apparatus resides in a mobile terminal and includes: an information acquiring unit 410 , an information processing unit 420 , a first generating unit 430 and a second generating unit 440 .
信息获取单元410获取自身的应用标识符和移动终端中的标识符信息,标识符信息包括多个标识符。具体的标识符已在上文进行详细的描述,此处不做过多解释。The information acquiring unit 410 acquires its own application identifier and identifier information in the mobile terminal, where the identifier information includes multiple identifiers. The specific identifiers have been described in detail above, and no further explanation is given here.
信息处理单元420确定所述标识符信息中多个标识符中的正确的标识符。如,信息处理单元420遍历所述标识符信息中的每个标识符,每当判定当前标识符中每个字符的重复次数小于预定次数时,确定所述当前标识符为正确的标识符,直到所有所述标识符判定完毕。The information processing unit 420 determines the correct identifier among the plurality of identifiers in the identifier information. For example, the information processing unit 420 traverses each identifier in the identifier information, and whenever it is determined that the number of repetitions of each character in the current identifier is less than a predetermined number of times, it is determined that the current identifier is a correct identifier until All of the identifiers are determined.
第一生成单元430在信息处理单元420确定标识符信息中存在至少一个正确的标识符后,将所述至少一个正确的标识符生成目标标识符。如,第一生成单元430在确定所述标识符信息中存在至少一个正确的标识符后,利用第一规则将所述至少一个正确的标识符生成目标标识符。如果在信息处理单元420确定标识符信息中的各个标识符都不正确后,第一生成单元430利用第二规则生成目标标识符。After the information processing unit 420 determines that there is at least one correct identifier in the identifier information, the first generation unit 430 generates the target identifier from the at least one correct identifier. For example, after determining that there is at least one correct identifier in the identifier information, the first generating unit 430 uses the first rule to generate the target identifier from the at least one correct identifier. If the information processing unit 420 determines that each identifier in the identifier information is incorrect, the first generation unit 430 generates the target identifier by using the second rule.
第二生成单元440根据所述目标标识符和应用标识符,生成移动终端唯一标识符。如,第二生成单元440利用第一加密算法将所述目标标识符与所述应用标识符进行组合,得到加密标识符。利用第二加密算法将所述加密标识符进行加密,得到所述移动终端唯一标识符。The second generating unit 440 generates a unique identifier of the mobile terminal according to the target identifier and the application identifier. For example, the second generating unit 440 uses the first encryption algorithm to combine the target identifier and the application identifier to obtain an encrypted identifier. The encrypted identifier is encrypted by using a second encryption algorithm to obtain the unique identifier of the mobile terminal.
本发明实施例所提供的一种标识符生成装置可以为设备上的特定硬件或者安装于设备上的软件或固件等。本发明实施例所提供的装置,其实现原理及产生的技术效果和前述方法实施例相同,为简要描述,装置实施例部分未提及之处,可参考前述方法实施例中相应内容。所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,前述描述的系统、装置和单元的具体工作过程,均可以参考上述方法实施例中的对应过程,在此不再赘述。An apparatus for generating an identifier provided in an embodiment of the present invention may be specific hardware on a device or software or firmware installed on the device. The implementation principles and technical effects of the device provided by the embodiment of the present invention are the same as those of the foregoing method embodiment. For brief description, for the parts not mentioned in the device embodiment, reference may be made to the corresponding content in the foregoing method embodiment. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the above-mentioned method embodiments, and will not be repeated here.
在本发明所提供的实施例中,应该理解到,所揭露装置和方法,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the embodiments provided in the present invention, it should be understood that the disclosed devices and methods may be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本发明提供的实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in the embodiments provided by the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes. .
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释,此外,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。It should be noted that like numerals and letters denote similar items in the following drawings, therefore, once an item is defined in one drawing, it does not require further definition and explanation in subsequent drawings, In addition, the terms "first", "second", "third", etc. are only used for distinguishing descriptions, and should not be construed as indicating or implying relative importance.
最后应说明的是:以上所述实施例,仅为本发明的具体实施方式,用以说明本发明的技术方案,而非对其限制,本发明的保护范围并不局限于此,尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本发明实施例技术方案的精神和范围。都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。Finally, it should be noted that: the above-described embodiments are only specific implementations of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting them, and the scope of protection of the present invention is not limited thereto, although referring to the foregoing The embodiment has described the present invention in detail, and those skilled in the art should understand that any person familiar with the technical field can still modify the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention Changes can be easily imagined, or equivalent replacements can be made to some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. All should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610943018.4A CN106375983B (en) | 2016-11-01 | 2016-11-01 | A method and device for generating an identifier |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610943018.4A CN106375983B (en) | 2016-11-01 | 2016-11-01 | A method and device for generating an identifier |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106375983A CN106375983A (en) | 2017-02-01 |
CN106375983B true CN106375983B (en) | 2019-11-15 |
Family
ID=57892999
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610943018.4A Expired - Fee Related CN106375983B (en) | 2016-11-01 | 2016-11-01 | A method and device for generating an identifier |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106375983B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107707686B (en) * | 2017-10-09 | 2019-10-08 | 深圳市沃特沃德股份有限公司 | Equipment identification method and device |
CN114090522B (en) * | 2022-01-17 | 2022-04-22 | 泰山信息科技有限公司 | Electronic file identifier definition method, device and equipment |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7801642B2 (en) * | 2004-08-18 | 2010-09-21 | Walgreen Co. | System and method for checking the accuracy of a prescription fill |
CN103686821B (en) * | 2012-08-27 | 2016-08-31 | 上海亿动信息技术有限公司 | The control method carrying out application rs traffic statistics is uniquely identified according to mobile terminal |
CN103401957B (en) * | 2013-08-07 | 2016-09-28 | 五八同城信息技术有限公司 | A kind of unique method identifying client machine under web environment |
US9430556B2 (en) * | 2013-12-19 | 2016-08-30 | Sap Se | System for self-distinguishable identifier and generation |
CN104601436B (en) * | 2013-12-31 | 2016-11-16 | 腾讯科技(深圳)有限公司 | Generation method, terminal and the background server of a kind of account |
CN105681039B (en) * | 2016-04-15 | 2021-04-13 | 上海上讯信息技术股份有限公司 | Method and apparatus for generating keys and corresponding decryption |
-
2016
- 2016-11-01 CN CN201610943018.4A patent/CN106375983B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN106375983A (en) | 2017-02-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107643977B (en) | Anti-addiction methods and related products | |
EP2975821B1 (en) | Network connection method and apparatus | |
CN104683458B (en) | The method and server that a kind of wallpaper is recommended | |
US20170155750A1 (en) | Method and Apparatus for Bluetooth Device Management | |
CN104484200A (en) | Method and device for updating firmware | |
KR101642019B1 (en) | Method, apparatus, program, and recording medium of verifying terminal | |
WO2016204993A1 (en) | Pairing of nearby devices using a synchronized cue signal | |
CN106375465B (en) | A data migration method and server | |
US10021213B2 (en) | Systems and methods for adaptive cloning of mobile devices | |
WO2015149235A1 (en) | Privacy protection method and terminal device | |
CN104992120A (en) | Picture encryption method and mobile terminal | |
CN105263126B (en) | Short-message verification method, apparatus and system | |
CN104766005A (en) | Management method and device for application software access authority | |
CN103914520A (en) | Data query method, terminal equipment and server | |
CN106375983B (en) | A method and device for generating an identifier | |
CN105005489B (en) | A kind of the starting method and terminal device of terminal device | |
CN105282162A (en) | Processing method and device for account management business | |
CN104239095A (en) | Operating-system starting method, device and terminal equipment | |
CN111338971A (en) | Application testing method and device, electronic equipment and storage medium | |
CN106325710B (en) | Mobile terminal control method and device and mobile terminal | |
CN106375350A (en) | Brush verification method and device | |
EP3249566B1 (en) | Method and device for encrypting application | |
US10019604B2 (en) | Method and apparatus of verifying terminal and medium | |
CN106331337A (en) | Method and device for starting terminal peripherals | |
CN110139230B (en) | Method and device for forwarding short message and intelligent equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20191115 |