CN113448542A - Product key generation method and device, electronic equipment and storage medium - Google Patents
Product key generation method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113448542A CN113448542A CN202010232107.4A CN202010232107A CN113448542A CN 113448542 A CN113448542 A CN 113448542A CN 202010232107 A CN202010232107 A CN 202010232107A CN 113448542 A CN113448542 A CN 113448542A
- Authority
- CN
- China
- Prior art keywords
- product key
- code
- generating
- random code
- random
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 230000004913 activation Effects 0.000 claims description 3
- 238000004590 computer program Methods 0.000 claims description 3
- 230000008901 benefit Effects 0.000 abstract description 5
- 238000005516 engineering process Methods 0.000 description 8
- 238000012545 processing Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 3
- 230000001788 irregular Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000008092 positive effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/58—Random or pseudo-random number generators
- G06F7/588—Random number generators, i.e. based on natural stochastic processes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/10—Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Analysis (AREA)
- Pure & Applied Mathematics (AREA)
- Mathematical Optimization (AREA)
- Multimedia (AREA)
- Computational Mathematics (AREA)
- Technology Law (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention discloses a product key generation method, a product key generation device, electronic equipment and a storage medium. The method comprises the following steps: responding to a request for generating a product key sent by a partner, and generating a service code according to a partner identifier in the request; arranging all characters in the character set into a character string; generating a random code: randomly generating a positive integer N which is less than or equal to the number of characters in the character string, copying the character string arranged at the Nth bit as a digit of the random code, adding the digit into the random code, and repeating the step until the random code reaches a preset digit; generating a check code of the random code; and splicing the service code, the random code and the check code into a product key. The method has the advantages of high efficiency of generating the product key, low repetition rate of the product key and adjustable length.
Description
Technical Field
The invention relates to a product key generation method, a product key generation device, electronic equipment and a storage medium.
Background
In real life, product keys are widely used in various fields as a carrier of interest. The holder of the product key can use the product key to exchange the corresponding goods or services at the issuer of the product key.
For example, a partner at an internet hospital purchases a set of inquiry benefits from the internet hospital, which are provided to the partner in the form of product keys, and the partner distributes the benefit codes to its users. The user inputs the product key on the webpage of the internet hospital to obtain the corresponding medical service.
Before the partner purchases the rights, the product key cannot be generated in advance, and the kind and the number of the product key need to be determined by relying on the business data of the partner. The partner usually buys in a large amount when buying rights and interests, so the internet hospital needs to generate a large amount of product keys in real time to meet the demand. The partner's system may have individualized requirements on the length of the product key. Meanwhile, the generation efficiency of the product key is high, the partner obtains the product key by calling the system interface, and if the generation efficiency of the product key is low, the calling system interface may be overtime, so that the partner cannot obtain the product key.
The existing technologies for generating product keys mainly include the following three types:
(1) generating a product key by adopting a symmetric encryption technology;
(2) generating a secret string by using md5 and intercepting the first n bits as a product key;
(3) and carrying out bit operation by adopting a random number to generate a product key.
Each of these three techniques has its own deficiencies: the product key generation technology in the step (1) is adopted, so that the length of the product key is limited by an encryption algorithm, and the product key with any length cannot be generated; the technology that md5 in (2) is adopted to generate a secret string and intercept the first n bits as the product key can ensure that the repetition rate of the generated product key is high; the technology of generating the product key by performing bit operation by using the random number in (3) has the problems of large calculation amount and low efficiency of generating the product key.
The above information disclosed in this background section is only for enhancement of understanding of the background of the invention and therefore it may contain information that does not constitute prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
In this summary, concepts in a simplified form are introduced that are further described in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
It is a primary object of the present invention to overcome at least one of the above-mentioned drawbacks of the prior art, and to provide a product key generation method, which includes:
responding to a request for generating a product key sent by a partner, and generating a service code according to a partner identifier in the request;
arranging all characters in the character set into a character string;
generating a random code: randomly generating a positive integer N which is less than or equal to the number of characters in the character string, copying the character string arranged at the Nth bit as a digit of the random code, adding the digit into the random code, and repeating the step until the random code reaches a preset digit;
generating a check code of the random code;
and splicing the service code, the random code and the check code into a product key.
According to one embodiment of the present invention, a check code for generating a random code includes:
converting each character in the random code into an ASCII code value;
accumulating all ASCII code values to obtain the sum of the values;
and dividing the sum of the numerical values by a preset positive integer to obtain a remainder as a check code.
According to one embodiment of the invention, when arranging characters, all characters in the character set are randomly arranged.
According to an embodiment of the present invention, the product key generation method further includes:
and after the product keys are spliced, judging whether the historical product keys identical to the product keys exist in the database or not, and if so, re-entering the step of generating the random codes.
According to an embodiment of the present invention, the product key generation method further includes:
and after the random code is generated every time, judging whether the random code accords with a preset rule, and if so, re-entering the step of generating the random code.
According to an embodiment of the present invention, the product key generation method further includes:
after the product key is generated, associating a service serial number which is not associated with the product key in the request with the product key;
and judging whether the request has a service serial number which is not associated with the product key, if so, entering a step of arranging the characters into a character string, and otherwise, sending all the service serial numbers and the product key associated with each service serial number to the partner.
According to one embodiment of the present invention, the character set includes 26 capital English letters, 26 lowercase English letters, and Arabic numerals 0-9.
According to one embodiment of the invention, the product key is a redemption code or an activation code.
The present invention also provides a product key generation apparatus, which includes:
the service code generating module is used for responding to a request for generating a product key sent by a partner and generating a service code according to a partner identifier in the request;
the arrangement module is used for arranging all the characters in the character set into a character string;
the random code generating module is used for randomly generating a positive integer N which is less than or equal to the number of characters in the character string, copying the character string arranged at the Nth bit as a digit of the random code and adding the digit into the random code, and repeating the step until the random code reaches a preset digit;
the check code generating module is used for generating a check code of the random code;
and the splicing module is used for splicing the service code, the random code and the check code into a product key.
The present invention also proposes a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the product key generation method as described above.
The invention also proposes an electronic device comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the product key generation method as described above via execution of the executable instructions.
According to the technical scheme, the product key generation method has the advantages and positive effects that:
the product key generated by the product key generation method is formed by splicing the service code, the random code and the check code. Since the repetition rate of the random code is extremely low, the repetition rate of the product key is correspondingly extremely low. Meanwhile, the length of the random code can be preset, so that the length of the product key can be adjusted by adjusting the length of the random code. In particular, the time for generating a product key is very short, and the product key generation efficiency is high.
Drawings
Various objects, features and advantages of the present invention will become more apparent from the following detailed description of preferred embodiments of the invention, when considered in conjunction with the accompanying drawings. The drawings are merely exemplary of the invention and are not necessarily drawn to scale. In the drawings, like reference characters designate the same or similar parts throughout the different views. Wherein:
FIG. 1 is a flow chart illustrating a method of product key generation according to an example embodiment.
Fig. 2 is a schematic structural diagram illustrating a product key generation apparatus according to an exemplary embodiment.
FIG. 3 is a schematic diagram of an electronic device shown in accordance with an exemplary embodiment;
FIG. 4 is a schematic diagram illustrating a computer-readable storage medium according to an example embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar structures, and thus their detailed description will be omitted.
Referring to fig. 1, fig. 1 is a flowchart of a redemption generation method in this embodiment. The conversion generation method comprises the following steps:
s1: responding to a request for generating a product key sent by a partner, and generating a service code according to a partner identifier in the request;
in this embodiment, the exchange generation method is implemented in the product key generation server. The partner sends the request for generating the product key by calling the product key generating interface of the product key generating server. The partner identifier is used to identify which partner the partner is, and may be an IP address or a number for distinguishing the partner. When the partner calls the product key generation interface, the partner needs to first send the partner identifier to the product key generation server so that the product key generation server can identify which partner needs to obtain the product key. The product key may be a redemption code or an activation code.
The service number is a manually defined number for distinguishing different services. For example, the service number of the medical service is 01, the service number of the information technology service is 02, and the like. Each partner identity is associated in advance with a service number. For example, the partner identities of the partners in the medical class are each associated with a service number of a medical service, and the partner identities of the partners in the information technology service class are each associated with a service number of an information technology service. A corresponding list of partner identities and service numbers may be established associating the partner identities with the service numbers.
And acquiring a service code corresponding to the partner identifier according to the partner identifier in the request, wherein the service code is a component of a product key, and a manager of the product key generation server can judge which service the product key belongs to according to the service code in the product key.
S2: arranging all characters in the character set into a character string;
the character set includes a plurality of characters, and there are no repeated characters in the character set. In this embodiment, the character set includes 26 upper case english letters, 26 lower case english letters and arabic numerals 0-9, so that the number of characters in the character set in this embodiment is as many as 62. Of course, the characters in the character set may not be limited to these 62 characters, and may also include other characters such as punctuation marks. The character set is stored in advance in the product key generation server. In the present embodiment, 26 capital english letters, 26 small english letters and arabic numerals 0 to 9 are arranged in a character string.
S3: randomly generating a positive integer N which is less than or equal to the number of characters in the character string, copying the character string arranged at the Nth bit as a digit of the random code, adding the digit into the random code, and repeating the step until the random code reaches a preset digit; the step S3 includes steps S31 to 33.
S31: randomly generating a positive integer N which is less than or equal to the number of characters in the character string;
in the present embodiment, since the number of characters in the character string is 62, a positive integer N less than or equal to 62 is generated using the random code generator.
S32: the character string arranged in the Nth bit character is copied and added to the random code to add one bit character to the random code.
And searching the nth character in the character string by taking the positive integer N as an index. After the character is inquired, the character is copied and added to the last of the random code to add a character to the random code. And when the random code is empty and no character exists, taking the copied character as the first character of the random code.
S33: judging whether the length of the random code reaches a preset digit, if not, entering a step S31, and if so, jumping out and circularly entering the next step;
in this embodiment, the product key is formed by splicing the service code, the random code and the check code. The length of the traffic code and the length of the check code are both determined lengths, for example, the length of the traffic code may be 4 bits and the length of the check code may be 1 bit. Therefore, the length of the entire product key can be adjusted by changing the length of the random code.
The preset number of bits may be set according to the length requirement of the partner for the product key. For example, the request for obtaining the product key sent by the partner further includes the required product key bit number, and the product key generation server subtracts the bit number of the service code and the bit number of the check code from the product key bit number to obtain the preset bit number of the product key.
The repetition rate of the random code generated by adopting the method is extremely low. The maximum number of random numbers that can be generated is abAnd a is the number of characters in the character set, and b is the preset digit of the random code. In this embodiment, the number of characters in the character set is 62, the preset digit is 10 bits, and the maximum number of the random codes is 6210Each of about 8 × 1017Therefore, the maximum number value of the random codes is extremely large, and the probability of generating the repeated random codes is extremely low.
S4: generating a check code of the random code; the step S4 includes steps S41 to S43;
step S41: converting each character in the random code into an ASCII code value;
an ASCII character Code table may be pre-stored in the product key generation server, and characters may be associated with corresponding ASCII Code values one-to-one, so that each character constituting the random Code corresponds to an ASCII (American Standard Code for Information exchange) Code value. For example, the value of the ASCII code is a decimal number. For example, the character "a" has an ASCII code value of 65 and the character "a" has an ASCII code value of 97.
Step S42: accumulating all ASCII code values to obtain the sum of the values;
and accumulating the numerical values of the ASCII codes of each character forming the random code to obtain the sum of the numerical values.
Step S43: and dividing the sum of the numerical values by a preset positive integer to obtain a remainder as a check code.
The predetermined positive integer is typically a positive integer greater than 1. The preset positive integer is preset by the product key issuer. The preset positive integer is also used for verifying whether the random code is a forged product key. For example, when the product key exchange service or commodity is used, the exchange system extracts the random code in the product key, obtains the ASCII number value of each character in the random code, accumulates all the ASCII number values, and divides the accumulated value by the preset positive integer to obtain a remainder, wherein if the remainder is consistent with the verification code, the product key is considered to be true, and if the remainder is inconsistent with the verification code, the product key is considered to be a forged product key.
S5: and splicing the service code, the random code and the check code into a product key.
In this embodiment, the product key is formed by sequentially splicing the service code, the random code and the check code. Since the repetition rate of the random code is extremely low, the repetition rate of the product key is correspondingly extremely low. Meanwhile, the length of the random code can be preset, so that the length of the product key can be adjusted by adjusting the length of the random code. In particular, the time for generating a product key is very short, and the product key generation efficiency is high. Because the random code is randomly selected in the character string bit by bit and is irregular, any other random code can not be guessed and solved according to some known random codes, and the product key can not be cracked.
In the method for generating a product key in this embodiment, 20 tests are performed, 10000000 product keys are generated each time, the length of the random code in each product key is 12, the average repetition rate is 0.000025%, and the average consumed time is 2123 milliseconds. Under the same condition, the average repetition rate of generating a secret string by using md5 and intercepting the first n bits as a product key is 99 percent; under the same condition, the average time consumption for generating the product key by using the random number to perform the bit operation is 37010 milliseconds, and the efficiency of the product key generation method in the embodiment is improved by about 1643%.
Further, in step S2, all the characters in the character set are randomly arranged.
And randomly arranging all characters in the character set to form a character string, wherein the characters in the character string are randomly arranged out of order. That is, the arrangement of character strings is different each time the random code is generated. Thus, the characters randomly selected from the irregular character string are more irregular and cannot be cracked.
In another embodiment, in step S2, all the characters in the character set may be arranged in a preset fixed order.
Further, the product key generation method further includes step S6 after step S5.
Step S6: it is determined whether or not the database has a historical product key that is the same as the product key, and if so, the process proceeds to step S3.
After each successful generation of a product key, the product key generation server also stores the product key into a database, wherein the database has all the historical product keys which have been successfully generated. If the newly generated product key is the same as one historical product key in the database, the newly generated product key is discarded, the step S3 is re-executed to regenerate a product key, and the product key is compared with the historical product key in the database again until a product key which is never generated is obtained, so that the system can be ensured not to generate repeated product keys.
Further, the product key generation method further includes step S3a between step S3 and step S4;
step S3 a: and judging whether the random code meets a preset rule, and if so, entering the step S3.
The preset rule is a manually preset rule, and if the random code meets the preset rule, the random code has a rule which can be circulated or the symbol arrangement is particularly simple. The preset rule includes a rule that each character of the random code is the same, the random code is formed by arranging two different characters, and the like, which constrains the simple random code.
The step filters the generated special random codes, for example, the whole string of the random codes is composed of the same character, the random codes are discarded, and the random codes obtained finally are all strings without special rules.
Further, the product key generation method further includes step S7 after step S6.
In step S6, if the database does not have the same historical product key as the product key, the process proceeds to step S7.
Step S7: associating a service serial number which is not associated with the product key in the request with the product key, and entering the step S8;
step S8: judging whether the request has a service serial number which is not associated with the product key, if so, entering the step S2, otherwise, entering the step S9;
step S9: all service serial numbers are sent to the partners along with the product key associated with each service serial number.
Steps S7 to S9 can satisfy the scenario that the partner requests to generate a large number of product keys at one time. When the partner sends a request, the request may contain a plurality of service sequence numbers, for example, one thousand service sequence numbers. A corresponding product key needs to be generated for each service serial number, and the number of the service serial numbers is equal to the number of the product keys needing to be generated. The steps S2-S8 can generate one product key for one service serial number at a time, and the steps are repeated to generate corresponding product keys for all service serial numbers. Thus, the partner may request generation of a large batch of product keys by sending a request once.
Referring to fig. 2, the present embodiment also proposes a product key generation apparatus 1. The product key generation apparatus 1 includes: the system comprises a service code generation module 11, an arrangement module 12, a random code generation module 13, a check code generation module 14 and a splicing module 15.
The service code generating module 11 is used for responding to a request for generating a product key sent by a partner, and generating a service code according to a partner identifier in the request;
the arranging module 12 is configured to arrange all the characters in the character set into a character string;
the random code generating module 13 is configured to randomly generate a positive integer N smaller than or equal to the number of characters in the character string, copy the character string arranged in the nth bit character as a digit of the random code, add the digit into the random code, and repeat this step until the random code reaches a preset digit;
the check code generating module 14 is configured to generate a check code of the random code;
the splicing module 15 is configured to splice the service code, the random code, and the check code into a product key.
An electronic device 800 according to this embodiment of the invention is described below with reference to fig. 3. The electronic device 800 shown in fig. 3 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present invention.
As shown in fig. 3, electronic device 800 is in the form of a general purpose computing device. The components of the electronic device 800 may include, but are not limited to: the at least one processing unit 810, the at least one memory unit 820, and a bus 830 that couples the various system components including the memory unit 820 and the processing unit 810.
Wherein the storage unit stores program code that is executable by the processing unit 810 to cause the processing unit 810 to perform steps according to various exemplary embodiments of the present invention as described in the above section "exemplary methods" of the present specification.
The storage unit 820 may include readable media in the form of volatile memory units such as a random access memory unit (RAM)8201 and/or a cache memory unit 8202, and may further include a read only memory unit (ROM) 8203.
The storage unit 820 may also include a program/utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The electronic device 800 may also communicate with one or more external devices 700 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable an insurance customer to interact with the electronic device 800, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 800 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 850. Also, the electronic device 800 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 860. As shown, the network adapter 860 communicates with the other modules of the electronic device 800 via the bus 830. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to make a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) execute the product key generation method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing one of the product key generation methods described above in this specification. In some possible embodiments, aspects of the invention may also be implemented in the form of a program product comprising program code means for causing a terminal device to carry out the steps according to various exemplary embodiments of the invention described in the above section "exemplary methods" of the present description, when said program product is run on the terminal device.
Referring to fig. 4, a program product 900 for implementing the above-described product key generation method according to an embodiment of the present invention is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the insurance client computing device, partly on the insurance client device, as a stand-alone software package, partly on the insurance client computing device and partly on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the insurance client computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the product key generation method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
Although the present invention has been disclosed with reference to certain embodiments, numerous variations and modifications may be made to the described embodiments without departing from the scope and ambit of the present invention. It is to be understood, therefore, that this invention is not limited to the particular embodiments disclosed, but it is intended to cover modifications within the scope of the appended claims and their equivalents.
Claims (11)
1. A method for generating a product key, comprising:
responding to a request for generating a product key sent by a partner, and generating a service code according to a partner identifier in the request;
arranging all characters in the character set into a character string;
generating a random code: randomly generating a positive integer N which is less than or equal to the number of characters in the character string, copying the character string arranged at the Nth bit as a digit of the random code, adding the digit into the random code, and repeating the step until the random code reaches a preset digit;
generating a check code of the random code;
and splicing the service code, the random code and the check code into a product key.
2. The product key generation method of claim 1, wherein generating the check code of the random code comprises:
converting each character in the random code into an ASCII code value;
accumulating all ASCII code values to obtain the sum of the values;
and dividing the sum of the numerical values by a preset positive integer to obtain a remainder as a check code.
3. The product key generation method of claim 1, wherein all characters in the character set are randomly arranged when the characters are arranged.
4. The product key generation method of claim 1, further comprising:
and after the product keys are spliced, judging whether the historical product keys identical to the product keys exist in the database or not, and if so, re-entering the step of generating the random codes.
5. The product key generation method of any one of claims 1 to 4, wherein the product key generation method further comprises:
and after the random code is generated every time, judging whether the random code accords with a preset rule, and if so, re-entering the step of generating the random code.
6. The product key generation method of any one of claims 1 to 4, wherein the product key generation method further comprises:
after the product key is generated, associating a service serial number which is not associated with the product key in the request with the product key;
and judging whether the request has a service serial number which is not associated with the product key, if so, entering a step of arranging the characters into a character string, and otherwise, sending all the service serial numbers and the product key associated with each service serial number to the partner.
7. The method for generating a product key according to claim 1, wherein the character set comprises 26 capital English letters, 26 lowercase English letters and Arabic numerals 0-9.
8. The product key generation method of claim 1, wherein the product key is a redemption code or an activation code.
9. A product key generation apparatus, characterized by comprising:
the service code generating module is used for responding to a request for generating a product key sent by a partner and generating a service code according to a partner identifier in the request;
the arrangement module is used for arranging all the characters in the character set into a character string;
the random code generating module is used for randomly generating a positive integer N which is less than or equal to the number of characters in the character string, copying the character string arranged at the Nth bit as a digit of the random code and adding the digit into the random code, and repeating the step until the random code reaches a preset digit;
the check code generating module is used for generating a check code of the random code;
and the splicing module is used for splicing the service code, the random code and the check code into a product key.
10. A computer-readable storage medium on which a computer program is stored, the computer program, when executed by a processor, implementing the product key generation method of any one of claims 1 to 8.
11. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the product key generation method of any of claims 1-8 via execution of the executable instructions.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010232107.4A CN113448542A (en) | 2020-03-27 | 2020-03-27 | Product key generation method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010232107.4A CN113448542A (en) | 2020-03-27 | 2020-03-27 | Product key generation method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113448542A true CN113448542A (en) | 2021-09-28 |
Family
ID=77808173
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010232107.4A Pending CN113448542A (en) | 2020-03-27 | 2020-03-27 | Product key generation method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113448542A (en) |
-
2020
- 2020-03-27 CN CN202010232107.4A patent/CN113448542A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10911455B2 (en) | Using third party information to improve predictive strength for authentications | |
CN112287379B (en) | Service data using method, device, equipment, storage medium and program product | |
US8484482B1 (en) | Password generation and validation system and method | |
CN111242462B (en) | Data processing method and device, computer storage medium and electronic equipment | |
CN112528262A (en) | Application program access method, device, medium and electronic equipment based on token | |
CN114844792B (en) | Dynamic monitoring method, device, equipment and storage medium based on LUA language | |
CN110351672B (en) | Information pushing method and device and electronic equipment | |
CN109492985A (en) | A kind of checking method, apparatus and system | |
CN111210109A (en) | Method and device for predicting user risk based on associated user and electronic equipment | |
CN111586177B (en) | Cluster session loss prevention method and system | |
CN111046010A (en) | Log storage method, device, system, electronic equipment and computer readable medium | |
CN113282591B (en) | Authority filtering method, authority filtering device, computer equipment and storage medium | |
US20220391529A1 (en) | Searching, matching, and masking of composite formats | |
CN113704222A (en) | Method and device for processing service request | |
EP4365808A1 (en) | Data verification method and apparatus | |
US20240275848A1 (en) | Content initialization method, electronic device and storage medium | |
CN111047444A (en) | Data transaction method and device based on block chain network | |
CN113448542A (en) | Product key generation method and device, electronic equipment and storage medium | |
CN112800006B (en) | Log storage method and device for network equipment | |
US11681822B2 (en) | Managing sensitive user information | |
CN111416711B (en) | Transaction message processing method and device | |
CN116136844A (en) | Entity identification information generation method, device, medium and electronic equipment | |
CN113590310A (en) | Resource allocation method and device based on rule touch rate scoring and electronic equipment | |
CN118395479B (en) | Data protection method and device for online mall system, electronic equipment and medium | |
CN110175305B (en) | Data processing method, data processing device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |