CN105373927B - Ticket code generation method and device of electronic ticket and server - Google Patents

Ticket code generation method and device of electronic ticket and server Download PDF

Info

Publication number
CN105373927B
CN105373927B CN201410425690.5A CN201410425690A CN105373927B CN 105373927 B CN105373927 B CN 105373927B CN 201410425690 A CN201410425690 A CN 201410425690A CN 105373927 B CN105373927 B CN 105373927B
Authority
CN
China
Prior art keywords
sequence
ticket
digit
code
password
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.)
Active
Application number
CN201410425690.5A
Other languages
Chinese (zh)
Other versions
CN105373927A (en
Inventor
胡长晰
刘伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201410425690.5A priority Critical patent/CN105373927B/en
Publication of CN105373927A publication Critical patent/CN105373927A/en
Application granted granted Critical
Publication of CN105373927B publication Critical patent/CN105373927B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The invention discloses a coupon code generation method and device of an electronic coupon and a server, and belongs to the technical field of computers. The method comprises the following steps: acquiring a globally unique incremental sequence which is allocated to the electronic ticket in advance; acquiring a user identification sequence according to a service account of a user; acquiring a first random value, and acquiring a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digit numbers; and carrying out encryption operation on the first random value, the increment sequence and the user identification sequence through the first password to obtain a coupon code of the electronic coupon. According to the invention, the first password corresponding to the preset first random value is obtained, the increasing sequence, the first random value and the user identification sequence are encrypted through the first password to generate the ticket code, after the encryption operation is carried out by using the first password corresponding to the first random value, the ticket codes of other users are not easy to calculate according to the existing ticket code, and the generated ticket code has higher safety.

Description

Ticket code generation method and device of electronic ticket and server
Technical Field
The invention relates to the technical field of computers, in particular to a method, a device and a server for generating a coupon code of an electronic coupon.
Background
The electronic ticket is an electronic consumption certificate issued on line and is sent to a corresponding terminal of a user in an electronic form. The ticket code of the electronic ticket is a random number sequence code which can be mapped to a certain electronic ticket uniquely and is used for identifying a certain electronic ticket uniquely. When the user uses the electronic ticket, the user inputs the ticket code of the electronic ticket. Since the electronic ticket is related to the property of the user and the ticket code of the electronic ticket is used to uniquely identify the electronic ticket, a ticket code generation method of the electronic ticket needs to be provided in order to ensure the security of the electronic ticket.
In the related art, when the coupon code of the electronic coupon is generated, the adopted method comprises the following steps: and acquiring a globally unique increment sequence which is allocated to the electronic ticket in advance, acquiring information such as the prefix and the date of the merchant, and combining the increment sequence with the prefix and the date of the merchant to obtain the ticket code of the electronic ticket.
In the process of implementing the invention, the inventor finds that the related art has at least the following problems:
because the related technology directly uses the combination code of the increment sequence and the information such as the prefix and the date of the merchant as the ticket code of the electronic ticket, a malicious user can easily calculate or crack the ticket code of other users through the existing ticket code. Since the electronic ticket is based on the ticket code when it is used, the electronic ticket of another user is easily stolen or faked, and the security of the electronic ticket is not high when the electronic ticket is identified by using the ticket code.
Disclosure of Invention
In order to solve the problems of the related art, the embodiment of the invention provides a method and a device for generating a coupon code of an electronic coupon and a server. The technical scheme is as follows:
in a first aspect, a method for generating a coupon code of an electronic coupon is provided, the method comprising:
acquiring a globally unique incremental sequence which is allocated to the electronic ticket in advance;
acquiring a user identification sequence according to a service account of a user;
acquiring a first random value and acquiring a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digits;
and carrying out encryption operation on the first random value, the increment sequence and the user identification sequence through the first password to obtain a coupon code of the electronic coupon.
In a second aspect, there is provided an apparatus for generating a ticket code of an electronic ticket, the apparatus including:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a globally unique incremental sequence which is allocated to an electronic ticket in advance;
the second acquisition module is used for acquiring a user identification sequence according to the service account of the user;
the third acquisition module is used for acquiring a first random value;
the fourth obtaining module is used for obtaining a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digit numbers;
and the encryption module is used for carrying out encryption operation on the first random value, the increment sequence and the user identification sequence through the first password to obtain the coupon code of the electronic coupon.
In a third aspect, a coupon code generation server for an electronic coupon is provided, the server comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs including instructions for:
acquiring a globally unique incremental sequence which is allocated to the electronic ticket in advance;
acquiring a user identification sequence according to a service account of a user;
acquiring a first random value and acquiring a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digits;
and carrying out encryption operation on the first random value, the increment sequence and the user identification sequence through the first password to obtain a coupon code of the electronic coupon.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the method comprises the steps of obtaining a first password corresponding to a preset first random value, carrying out encryption operation on an incremental sequence, the first random value and a user identification sequence through the first password to generate a ticket code, carrying out encryption operation through the first password corresponding to the first random value, and then calculating the ticket codes of other users according to the existing ticket codes, wherein the generated ticket codes have higher safety.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a coupon code generation method for an electronic coupon according to an embodiment of the present invention;
fig. 2 is a flowchart of a coupon code generation method for an electronic coupon according to another embodiment of the present invention;
fig. 3 is a schematic structural diagram of a ticket code generating apparatus of an electronic ticket according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a ticket code generating apparatus of an electronic ticket according to another embodiment of the present invention;
fig. 5 is a schematic structural diagram of a ticket code generating apparatus of an electronic ticket according to another embodiment of the present invention;
fig. 6 is a schematic structural diagram of a ticket code generating apparatus of an electronic ticket according to another embodiment of the present invention;
fig. 7 is a schematic structural diagram of a ticket code generating apparatus of an electronic ticket according to another embodiment of the present invention;
fig. 8 is a schematic structural diagram of a server according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Fig. 1 is a flowchart of a coupon code generation method of an electronic coupon according to an exemplary embodiment. Referring to fig. 1, a method flow provided by the embodiment of the present invention includes:
101: a globally unique incrementing sequence that was previously assigned to the electronic ticket is obtained.
102: and acquiring a user identification sequence according to the service account of the user.
103: and acquiring a first random value and a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digit numbers.
Optionally, after obtaining a first random value, the method further includes:
and combining the first random value and the increasing sequence into an identifier of the electronic ticket, and storing the combined identifier of the electronic ticket into a database corresponding to the user identifier sequence to be used as a basis for verifying the validity of the electronic ticket subsequently.
104: and carrying out encryption operation on the first random value, the incremental sequence and the user identification sequence through the first password to obtain the coupon code of the electronic coupon.
Optionally, the encrypting the first random value, the incrementing sequence, and the user identification sequence by the first password includes:
carrying out modulus calculation on each digit of the user identification sequence by using each digit at a first preset position in the first password to obtain a first modulus value, wherein the digit number of the digit contained at the first preset position is the same as the digit number of the digit contained in the user identification sequence;
positioning and defining the first modulus value according to the number at the second preset position in the first password to obtain a first positioning sequence;
determining a second random value according to the user identification sequence and the first modulus value, and acquiring a preset second password corresponding to the second random value;
performing modulo operation on each digit of the incremental sequence by using each digit at a third preset position in the second password to obtain a second modular value, wherein the digit of the digit at the third preset position is the same as the digit of the digit contained in the incremental sequence;
positioning and defining the second modulus value according to the number at the fourth preset position in the second password to obtain a second positioning sequence;
and dispersing the second modulus value according to the second positioning sequence to obtain a first ticket code sequence, dispersing the first modulus value into the first ticket code sequence according to the first positioning sequence to obtain a second ticket code sequence, and taking the second ticket code sequence as a ticket code obtained by performing encryption operation on the electronic ticket.
Optionally, after generating the ticket code of the electronic ticket, the method further includes:
receiving a coupon code updating request sent by a terminal corresponding to the user identification sequence;
and returning to the step of obtaining the first random value according to the ticket code updating request until a new ticket code of the electronic ticket is regenerated, and taking the new ticket code as the ticket code of the electronic ticket.
Optionally, after generating the ticket code of the electronic ticket, the method further includes:
acquiring a coupon code input by a user when the user uses the electronic coupon;
decrypting the input coupon code to obtain an increasing sequence, a first random value and a user identification sequence corresponding to the input coupon code;
inquiring a database corresponding to the user identification sequence according to the first random value and the incremental sequence, and determining whether the electronic ticket is valid;
if the electronic ticket is determined to be valid, the user is allowed to use the electronic ticket.
Optionally, after allowing the user to use the electronic ticket, the method further includes:
sending prompt information for using the electronic ticket to a mobile terminal corresponding to the user identification sequence;
determining whether a confirmation use message returned by the mobile terminal is received;
and if the confirmation use message returned by the mobile terminal is received, consuming the electronic ticket.
According to the method provided by the embodiment of the invention, the first password corresponding to the preset first random value is obtained, the increasing sequence, the first random value and the user identification sequence are encrypted through the first password to generate the ticket code, after the encryption operation is carried out through the first password corresponding to the first random value, the ticket codes of other users are not easy to calculate according to the existing ticket codes, and the generated ticket code has higher safety.
In conjunction with the method for generating a coupon code of an electronic ticket provided in the embodiment shown in fig. 1, fig. 2 provides a method for generating a coupon code of an electronic ticket according to an exemplary embodiment. Referring to fig. 2, a method flow provided by the embodiment of the present invention includes:
201: a globally unique incrementing sequence that was previously assigned to the electronic ticket is obtained.
There is often a certain number and order of electronic coupons for a particular transaction. In order to make the electronic ticket identified by the ticket code unique, it is necessary to provide a number sequence in the security code that makes the electronic ticket unique. Therefore, when the coupon code of the electronic coupon is generated, the uniqueness of the electronic coupon is identified by using the globally unique sequence, and the sequence of the electronic coupon is identified by using the ascending sequence, so that the globally unique ascending sequence which is allocated to the electronic coupon in advance needs to be acquired. By acquiring the globally unique incremental sequence which is allocated to the electronic ticket in advance, the uniqueness of the electronic ticket generated subsequently can be ensured.
For example, if 1000 electronic tickets are to be generated for a certain service, 1000 incrementing sequences are preset, and therefore, when each ticket code is generated, one incrementing sequence is selected from the 1000 preset incrementing sequences as the globally unique incrementing sequence obtained when the ticket code is generated.
202: and acquiring a user identification sequence according to the service account of the user.
In order to ensure the security of the electronic ticket of the user, the user needs to perform a login operation through a corresponding service account before obtaining the electronic ticket, and the service account of the user can often uniquely identify a certain user. In addition, since the number of users may be large, when storing the user information of all users of a certain service, the user information of different users is often stored for the sub-base sub-table, so that the user information of different users is stored in different base tables of different databases. In the embodiment of the present invention, in order to correlate the generated ticket code with the user information of the user, a user identification sequence may be determined according to the service account number of the user, and the user identification sequence is also involved in calculation when the ticket code is generated. The embodiment of the present invention is not particularly limited with respect to a manner of obtaining a user identifier sequence according to a service account of a user. However, in order to confirm the validity of the coupon code later, an association can be established with the database storing the coupon code, and when the user identification sequence is acquired, the number of the base tables established in connection with the service is determined. Thus, the user identification sequence can be used as a user identification or a database identification for storing the generated coupon code.
For example, if the service account of the user is 652358452, and 1000 different library tables are established in advance for the service, when the user information of the user is stored, it is stored in the library table numbered 452, so 452 can be used as the identification sequence of the user obtained according to the service account of the user. Of course, the numerical values herein are merely examples and do not constitute a limitation on the embodiments of the present invention.
203: and acquiring a first random value and a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digit numbers.
In order to make the generated ticket code more secure, in the embodiment of the present invention, the generation of the ticket code is implemented by using a certain encryption algorithm. In addition, in order to make the generated ticket code have randomness and avoid being easily deduced through the existing ticket code, a random value can be obtained first, and a preset password corresponding to the random value is used for assisting in generating the ticket code. In addition, in order to meet the operation of the encryption process, each preset password consists of preset numerical digits. The embodiment of the present invention is not particularly limited with respect to the specific values of the preset values. For example, each preset password may contain 32 digits, and so on.
The embodiment of the present invention is not limited to a specific manner of obtaining the first random value, and in a specific implementation, a random scrolling manner may be adopted to obtain a value as the first random value. The embodiment of the present invention also does not specifically limit the manner of obtaining the preset first password corresponding to the first random value. It should be noted that, in order to ensure that the first password corresponding to the first random value exists, a mapping relationship between the random value and the password needs to be established in advance.
When the mapping relation between the random value and the password is established, aiming at a certain service, the method can be realized by establishing a service password dictionary containing a preset numerical value strip password. Therefore, when the first password corresponding to the first random value is obtained, the first password corresponding to the first random value may be obtained in a pre-established service password dictionary according to the first random value.
For example, for a certain service, a service password dictionary containing 100 passwords may be established. In addition, the numerical value of the random value may be made to correspond to the number of the password in the service password dictionary. Specifically, if the acquired first random value is 5, the 5 th password may be acquired in the service password dictionary, and the 5 th password may be taken as the first password.
Optionally, since the embodiment of the present invention performs the encryption operation when generating the ticket code. And because the increasing sequence can uniquely identify one electronic ticket, the first random value can ensure the randomness of the security code and the first random value corresponds to the preset first password. In addition, the user identification sequence can identify in which preset database the user information of the user is stored. Therefore, after a first random value is obtained, the first random value and the increment sequence can be combined into the identification of the electronic ticket, and the combined identification of the electronic ticket is stored in a database corresponding to the user identification sequence to be used as a basis for verifying the validity of the electronic ticket subsequently.
The embodiment of the present invention is not particularly limited with respect to the manner in which the first random value and the increasing sequence are combined into the identifier of the electronic ticket. In specific implementation, the first random value can be set to be before, and the increment sequence is after; or setting the delivery sequence to be at the front and the first random value to be at the back; the first random value and the increasing sequence may be sorted in a certain order and then combined, and so on.
For example, if the first random value is 5, the increment sequence is 0000001234, and when the first random value and the increment sequence are combined, the first random value is set to be before and the increment sequence is after, the combined electronic ticket is identified as 50000001234. In addition, the embodiment of the present invention does not limit the manner in which the combined identifier of the electronic ticket is stored in the database corresponding to the user identifier sequence.
The identifier of the electronic ticket combined by the first random value and the increment sequence is stored in the database corresponding to the user identifier sequence, so that the identifier can be inquired in the database corresponding to the user identifier sequence when the validity of the electronic ticket is verified according to the electronic ticket code. In addition, only the identifier of the electronic ticket combined by the first random value and the increment sequence is stored in the database, and the ticket code generated according to the subsequent encryption algorithm is not directly stored, so that even if an illegal user acquires the first random value and the increment sequence from the database, the ticket code cannot be easily deduced, and the security of the electronic ticket can be ensured.
204: and carrying out encryption operation on the first random value, the incremental sequence and the user identification sequence through the first password to obtain the coupon code of the electronic coupon.
The first random value, the increment sequence and the user identification sequence are encrypted by the first password to obtain the coupon code of the electronic coupon in various ways. The specific implementation method comprises but is not limited to the following steps:
the method comprises the following steps: and performing modulo calculation on each digit of the user identification sequence by using each digit at a first preset position in the first password to obtain a first modular value, wherein the digit number of the digit contained at the first preset position is the same as the digit number of the digit contained in the user identification sequence.
The method provided by the embodiment of the invention also participates in the calculation of the user identification sequence when generating the coupon code. Thus, in the encryption process, each digit of the user identification sequence may be modulo by using each digit at a first preset position in the first password. Since the user id sequence may contain multiple digits, in order to implement modulo calculation on the user id sequence, the number of digits contained in the first preset position is required to be the same as the number of digits contained in the user id sequence. For example, if the user identification sequence contains three digits, each digit of the user identification sequence is modulo by using each digit at a first predetermined position in the first password containing three digits. The specific location of the first location is not limited in the embodiment of the present invention, and the first location may be any location pre-specified in the first password. For example, the first to third digits in the first password may be designated in advance as the digits at the first position, and so on.
The embodiment of the present invention is not particularly limited as to the way of modulo each digit of the user identification sequence by using each digit at the first preset position in the first password. In particular, each digit at the first preset position in the first password may be added to each digit of the user identification sequence in a bit-by-bit manner. In addition, in order to ensure the reversibility of the encryption process, when each digit at a first preset position in the first password is added with each digit of the user identification sequence in a bit manner, if the sum of the digit at a certain position in the first password and the digit of the corresponding bit in the user identification sequence is 10, the addition result is used for carrying out modulo operation on 10.
Specifically, when modulo each digit of the user identification sequence is performed by using each digit at a first preset position in the first password, the modulo operation is implemented by, but not limited to, the following formula:
decA=(key[i]+srcA)%10
the key [ i ] is a certain digit at a first preset position in the first password, the srcA is a certain digit in the user identification sequence, and the decA is a certain digit in a first modulus value obtained by modulo the certain digit in the user identification sequence by using the certain digit at the first preset position in the first password.
For example, if the first password is 32582314256325254784561236985000, the user identification sequence is 452, and the modulo of the user identification sequence using the 5 th digit through the 7 th digit in the first password is pre-specified. Since 32582314256325254784561236985000 digits 5 through 7 are 231, the modulus of 452 is calculated using 231 to obtain 683 the first modulus value.
Step two: and positioning and defining the first modulus value according to the number at the second preset position in the first password to obtain a first positioning sequence.
The positioning definition refers to how to sort a certain sequence, or to which position of an existing sequence a certain sequence is inserted, and so on. In general, the sequence defined by the localization can change the order of the existing sequences. The embodiment of the present invention is not particularly limited with respect to the manner of defining the positioning of the first modulus value according to the number at the second preset position in the first password. The specific position of the second preset position is not specifically limited in the embodiments of the present invention. In specific implementation, the second preset position may also be any position in the first password. For example, the first module value may be defined by selecting the first to third digits of the first code. In combination with the above example, since the number from the first bit to the third bit in 32582314256325254784561236985000 is 325, the first positioning sequence is 325.
Step three: and determining a second random value according to the user identification sequence and the first modulus value, and acquiring a preset second password corresponding to the second random value.
There are many ways to determine the second random value according to the user identification sequence and the first modulus value. For example, the user identification sequence and the first modulus value may be added to determine the second random value, the user identification sequence and the first modulus value may be multiplied to determine the second random value, the user identification sequence and each digit of the first modulus value may be added to determine the second random value, and so on.
Regarding the principle of obtaining the preset second password corresponding to the second random value, the principle is consistent with the principle of obtaining the preset first password corresponding to the first random value in step 203, and specific reference may be made to the contents in step 203, which is not described herein again. For example, if the second random value determined according to the user identification sequence and the first modulus value is 23, a second password corresponding to 23 needs to be acquired.
Step four: and performing modulo calculation on each digit of the incremental sequence by using each digit at a third preset position in the second password to obtain a second modular value, wherein the digit number of the digit included at the third preset position is the same as the digit number of the digit included in the incremental sequence.
The principle of performing modulo calculation on each digit of the incremental sequence by using each digit at the third preset position in the second password is consistent with the principle of performing modulo calculation on each digit of the user identification sequence by using each digit at the first preset position in the first password in the above step, and specific reference may be made to the contents in the above step one, which is not described herein again. The embodiment of the present invention is also not particularly limited with respect to the specific location information of the third preset location in the second password. It should be noted that, in order to successfully use each digit at the third preset position in the second password to perform modulo on each digit of the incremental sequence, it is necessary to ensure that the number of digits included in the third preset position is the same as the number of digits included in the incremental sequence.
For example, if the increment sequence is 0000001234, the second cipher is 01239875123456789054124503218859, and since the increment sequence contains ten bits, ten bits should be selected at a third preset position in the second cipher to modulo the increment sequence. For example, if the digits from the first digit to the tenth digit in the second cipher are selected to modulo the sequence of increments, 0000001234 and 0123987512 may be added bitwise to yield a second modulo value, and thus the second modulo value obtained in this example is 0123988746.
Step five: and positioning and defining the second modulus value according to the number at the fourth preset position in the second password to obtain a second positioning sequence.
The principle of this step is consistent with the principle of the step three in which the first modulus value is defined by positioning according to the number at the second preset position in the first password to obtain the first positioning sequence, which can be specifically referred to the content in the step three, and is not described herein again. The specific location of the fourth preset location in the second password is not specifically limited in the embodiments of the present invention. In specific implementation, any position in the second password can be selected as a fourth preset position. For example, the second bit to the fifth bit in the second password may be selected as the fourth preset position, so that the numbers on the second bit to the fifth bit are used as the second positioning sequence, in this case, the second positioning sequence is 1239, and so on.
Step six: and dispersing the second modulus value according to the second positioning sequence to obtain a first ticket code sequence, dispersing the first modulus value into the first ticket code sequence according to the first positioning sequence to obtain a second ticket code sequence, and taking the second ticket code sequence as a ticket code obtained by performing encryption operation on the electronic ticket.
The embodiment of the present invention is not particularly limited with respect to the manner of discretizing the second modulus value according to the second positioning sequence. In particular, the content determination of the positioning definition can be combined. For example, if the position definition is such that every two digits of the digits are swapped according to the second positioning sequence, then when the second modulus values are discretized, the digits at certain positions in the second modulus values may be swapped for positions. For example, in combination with the above example, if the second module value is 0123988746, the second positioning sequence is 1239, and the positioning definition is to swap the numbers of each two bits corresponding to the second positioning sequence in the second module value when the second module value is discretized, then the numbers of the first and second bits in the second module value are swapped and the numbers of the third and ninth bits are swapped when the second module value is discretized according to 1239, and then the resulting first ticket code sequence is 1043988726.
There may be many ways to discretize the first modulus value into the first ticket sequence according to the first sequence of orientations. For example, the digits on the bits of the first analog value may be inserted into the first coupon code sequence at positions corresponding to the digits in the first positioning sequence, the digits on the bits of the first analog value may be inserted into the first coupon code sequence at positions subsequent to the positions corresponding to the digits in the first positioning sequence, and so on.
When a digit on each bit of the first analog value is inserted into a position next to a position corresponding to a digit in the first positioning sequence in the first ticket code, the manner of discretizing the first analog value into the first ticket code sequence according to the first positioning sequence includes, but is not limited to, the following formula:
Str_new=Str.substr(0,loc[i])+decA+Str.substr(loc[i])
str _ new is a new sequence inserted into the digit at a certain position in the first modulus, Str. substr (0, loc [ i ]) indicates that the first loc [ i ] position of the first coupon sequence remains unchanged, loc [ i ] indicates the digit at a certain position in the first positioning sequence, decA indicates the digit at a certain position in the first modulus, and Str. substr (loc [ i ]) indicates the digit at a position other than the first loc [ i ] position in the first coupon sequence.
For example, in combination with the above example, if the first token sequence is 1043988726, the first modulus value is 683, the first positioning sequence is 325, and when the first modulus value is discretized into the first token sequence according to the first positioning sequence, the digit on each bit of the first modulus value is inserted one bit after the position corresponding to the digit in the first positioning sequence in the first token sequence, when the second token sequence is generated, the digit 6 on the first bit in the first modulus value is inserted after the digit on the third bit in the first token sequence according to the digit 3 on the first bit of the first positioning sequence 325, so as to obtain the sequence 10463988726; then, the number 8 in the second bit of the first modulus value is inserted 10463988726 after the 2 nd bit number according to the number 2 in the second bit of the first positioning sequence 325, resulting in a sequence 108463988726; finally, the number 3 in the third bit of the first modulus value is inserted 108463988726 after the fifth bit number according to the number 5 in the third bit of the first positioning sequence 325, resulting in the sequence 1084633988726. Thus, the second coupon sequence is 1084633988726.
It should be noted that, when the first modulus value is discretized into the first ticket sequence according to the first positioning sequence, the principle of inserting first and then taking second and then taking first should be followed, that is, when the inserted number is subsequently decrypted, the inserted number is then taken out from the sequence, and when the inserted number is subsequently decrypted, the inserted number is taken out from the sequence first. For example, with reference to the above example, when decrypting the second ticket sequence, the number 3 after the fifth digit of the last insertion is first extracted, the number 8 after the second digit of the current sequence is then extracted in the sequence after the extraction 3, and the number 6 after the third digit of the current sequence is finally extracted in the sequence after the extraction 8.
Optionally, because the database often has a certain version number, in order to avoid data loss after the database has a problem, when the coupon code is generated, the version of the database may be retained, and the version of the database may be inserted into a preset position in the second coupon code sequence, so that the second coupon code sequence inserted into the version number of the database is used as the coupon code of the generated electronic coupon. The specific position of the preset position is not specifically limited in the embodiments of the present invention. In a specific implementation, in order to make the ticket code more random, the preset position may be a position corresponding to the first random value or the second random value, for example, the position may be a position of the first random value or the second random value, or a position of a next bit or positions of the next bits of the first random value or the second random value, and so on.
205: and receiving a coupon code updating request sent by the terminal corresponding to the user identification sequence, returning to the step 203 according to the coupon code updating request until a new coupon code of the electronic coupon is regenerated, and taking the new coupon code as the coupon code of the electronic coupon.
This step is an optional step. In order to ensure the security of the generated ticket code of the electronic ticket identifier, the method provided by the embodiment of the invention supports the real-time update of the ticket code according to the request of the user. For example, the user may initiate a coupon code update request if the user feels his or her coupon code is revealed. In this case, the ticket code update request sent by the terminal corresponding to the user identification sequence may be received, and the process returns to step 203 according to the ticket code update request until a new ticket code of the electronic ticket is generated again, and the new ticket code is used as the ticket code of the electronic ticket. The embodiment of the present invention is not particularly limited with respect to the manner of receiving the ticket code update request sent by the terminal corresponding to the user identification sequence. It should be noted that, since the ascending sequence can uniquely identify the order and number of a ticket code and a service ticket code, the ascending sequence can be kept unchanged when updating the ticket code.
In addition, the ticket code of the electronic ticket generated by the embodiment of the invention is in a digital form, and the digital form ticket code occupies less space compared with the letter form ticket code. In addition, because the card swiping machine usually only supports the ticket code in the digital form, but not the ticket code in the letter form, compared with a scene using letters as the ticket code, the ticket code generated by the method provided by the embodiment of the invention is used as the identifier of the electronic ticket, so that the method is safer and has a wider application range.
Alternatively, after the ticket code of the electronic ticket is generated, the electronic ticket paired with the ticket code can be uniquely identified using the ticket code. At this time, if the user wants to use the electronic ticket, it needs to be realized by the ticket code. Therefore, if it is determined that the user is using the electronic ticket, it is also necessary to determine whether the user can use the electronic ticket. Regarding the manner of determining whether the user can use the electronic ticket, including but not limited to, the following manner:
the first step is as follows: and acquiring a coupon code input by a user when the user uses the electronic coupon, and decrypting the input coupon code to obtain an increasing sequence, a first random value and a user identification sequence corresponding to the input coupon code.
The embodiment of the present invention is not particularly limited as to the manner of obtaining the coupon code input by the user when using the electronic coupon. In specific implementation, a corresponding electronic ticket using page can be provided, and a ticket code input box is set in the page, so that when a ticket code input when a user uses an electronic ticket is obtained, the content input in the preset ticket code input box by the user can be obtained.
The manner in which the input ticket code is decrypted to obtain the incremented sequence, the first random value, and the user identification sequence corresponding to the input ticket code is related to the manner in which the ticket code is encrypted when the ticket code is generated. Specifically, the method of decrypting the input ticket code is an inverse operation of encrypting the ticket code when the ticket code is generated, which may specifically refer to the principle of the encryption method adopted when the ticket code is generated in the first step to the sixth step, and is not described herein again.
The second step is that: and querying a database corresponding to the user identification sequence according to the first random value and the incremental sequence to determine whether the electronic ticket is valid.
In the embodiment of the invention, when the coupon code is generated, the first random sequence and the incremental sequence for generating the coupon code are stored in the database corresponding to the user identification sequence, so that when determining whether the user can use the electronic coupon, the database corresponding to the user identification sequence needs to be inquired according to the first random value and the incremental sequence to determine whether the electronic coupon is effective. And if the first random value and the incremental sequence which are consistent with the first random value and the incremental sequence obtained by decryption are found in the database corresponding to the user identification sequence, determining that the electronic ticket is valid, otherwise, determining that the electronic ticket is invalid.
The third step: if the electronic ticket is determined to be valid, the user is allowed to use the electronic ticket.
Further, after allowing the user to use the electronic ticket, in order to ensure that the user using the electronic ticket is indeed the user himself, the following steps may be included, but not limited to: sending prompt information for using the electronic ticket to the mobile terminal corresponding to the user identification sequence, and determining whether a use confirmation message returned by the mobile terminal is received; and if the confirmation use message returned by the mobile terminal is received, consuming the electronic ticket.
The embodiment of the present invention is not particularly limited as to the manner of sending the prompt information for using the electronic ticket to the mobile terminal corresponding to the user identification sequence. In specific implementation, when the user registers the service account, the number of the mobile terminal corresponding to the user can be reserved, so that when the prompt information for using the electronic ticket is sent to the mobile terminal corresponding to the user identification sequence, the service account of the user can be determined according to the user identification sequence, and the number of the mobile terminal reserved by the user can be inquired according to the service account of the user, so that the prompt information for using the electronic ticket is sent to the mobile terminal corresponding to the user identification sequence. The specific content of the prompt message is not specifically limited in the embodiments of the present invention.
There may be many ways to determine whether an acknowledgment usage message returned by the mobile terminal is received. In specific implementation, the prompt message may carry option information indicating whether the user determines to use, and prompt the user to reply the message according to the option information. For example, the content of the prompt message may be "the electronic ticket with the ticket code of being used ×", and it is confirmed that the use request replies with 1, otherwise, it replies with 0 ". At this time, if the message carrying 1 returned by the mobile terminal is received, it is determined that the use confirmation message returned by the mobile terminal is received, otherwise, it is determined that the use confirmation message returned by the mobile terminal is not received.
In addition, in order to ensure the security of the electronic ticket, when determining whether the confirmation use message returned by the mobile terminal is received, a preset time can be set. And if the confirmation use message returned by the mobile terminal is received within the preset time, determining that the electronic ticket can be consumed. And if the confirmation use message returned by the mobile terminal is not received within the preset time, the user is not allowed to consume the electronic ticket.
There are many ways to consume the electronic ticket, including but not limited to marking the electronic ticket as used, and so on.
By this alternative, the security of the electronic ticket can be better guaranteed by requiring confirmation by the user before consuming the electronic ticket.
According to the method provided by the embodiment of the invention, the first password corresponding to the preset first random value is obtained, the increasing sequence, the first random value and the user identification sequence are encrypted through the first password to generate the ticket code, after the encryption operation is carried out through the first password corresponding to the first random value, the ticket codes of other users are not easy to calculate according to the existing ticket codes, and the generated ticket code has higher safety.
Fig. 3 is a schematic structural diagram of an electronic ticket code generating apparatus according to an exemplary embodiment, which is used for executing the electronic ticket code generating method provided in the embodiment shown in fig. 1 or fig. 2. Referring to fig. 3, the apparatus includes:
a first obtaining module 301, configured to obtain a globally unique increment sequence that is pre-assigned to an electronic ticket;
a second obtaining module 302, configured to obtain a user identifier sequence according to a service account of a user;
a third obtaining module 303, configured to obtain a first random value;
a fourth obtaining module 304, configured to obtain a preset first password corresponding to the first random value, where each preset password is composed of preset numeric digits;
and the encryption module 305 is configured to perform encryption operation on the first random value, the increment sequence and the user identification sequence through the first password to obtain a ticket code of the electronic ticket.
Optionally, referring to fig. 4, the apparatus further comprises:
a combining module 306 for combining the first random value and the incremental sequence into an identification of the electronic ticket;
the storage module 307 is configured to store the combined identifier of the electronic ticket to a database corresponding to the user identifier sequence, as a basis for subsequently verifying the validity of the electronic ticket.
Optionally, the encryption module 305 includes:
the first modulus calculating unit is used for calculating the modulus of each digit of the user identification sequence by using each digit at a first preset position in the first password to obtain a first modulus value, and the digit number of the digit contained in the first preset position is the same as the digit number of the digit contained in the user identification sequence;
the first positioning definition unit is used for positioning and defining the first modulus value according to the number at the second preset position in the first password to obtain a first positioning sequence;
a determining unit, configured to determine a second random value according to the user identifier sequence and the first modulus value;
the acquisition unit is used for acquiring a preset second password corresponding to the second random value;
the second modulus calculating unit is used for calculating the modulus of each digit of the incremental sequence by using each digit at a third preset position in the second password to obtain a second modulus value, and the digit number of the digit included at the third preset position is the same as the digit number of the digit included in the incremental sequence;
the second positioning definition unit is used for positioning and defining the second modulus value according to the number at the fourth preset position in the second password to obtain a second positioning sequence;
the first discrete unit is used for obtaining a first ticket code sequence by dispersing the second modulus value according to the second positioning sequence;
and the second discrete unit is used for dispersing the first modulus value into the first ticket code sequence according to the first positioning sequence to obtain a second ticket code sequence, and the second ticket code sequence is used as a ticket code obtained by performing encryption operation on the electronic ticket.
Optionally, referring to fig. 5, the apparatus further comprises:
a receiving module 308, configured to receive a coupon code update request sent by a terminal corresponding to the user identifier sequence;
the returning module 309 is configured to return the step of obtaining the first random value according to the ticket code updating request until a new ticket code of the electronic ticket is regenerated, and use the new ticket code as the ticket code of the electronic ticket.
Optionally, referring to fig. 6, the apparatus further comprises:
a fifth obtaining module 310, configured to obtain a coupon code input by a user when using the electronic coupon;
the decryption module 311 is configured to decrypt the input coupon code to obtain an increment sequence, a first random value, and a user identifier sequence corresponding to the input coupon code;
the query module 312 is configured to query the database corresponding to the user identifier sequence according to the first random value and the incremental sequence, and determine whether the electronic ticket is valid;
an allowing module 313 for allowing the user to use the electronic ticket when the electronic ticket is determined to be valid.
Optionally, referring to fig. 7, the apparatus further comprises:
a sending module 314, configured to send a prompt message for using the electronic ticket to the mobile terminal corresponding to the user identifier sequence;
a determining module 315, configured to determine whether a confirmation use message returned by the mobile terminal is received;
and a consumption module 316 for consuming the electronic ticket when receiving the confirmation use message returned by the mobile terminal.
According to the device provided by the embodiment of the invention, the first password corresponding to the preset first random value is obtained, the increasing sequence, the first random value and the user identification sequence are encrypted through the first password to generate the ticket code, after the encryption operation is carried out through the first password corresponding to the first random value, the ticket codes of other users are not easy to calculate according to the existing ticket codes, and the generated ticket code has higher safety.
Fig. 8 is a diagram illustrating a server for coupon code generation for an electronic coupon, according to an example embodiment. Referring to FIG. 8, server 800 includes a processing component 822, which further includes one or more processors and memory resources, represented by memory 832, for storing instructions, such as applications, that are executable by processing component 822. The application programs stored in memory 832 may include one or more modules that each correspond to a set of instructions. Further, the processing component 822 is configured to execute the instructions to execute the ticket code generating method of the electronic ticket provided by the embodiment shown in fig. 1 or fig. 2.
The server 800 may also include a power component 826 configured to perform power management of the server 800, a wired or wireless network interface 850 configured to connect the server 800 to a network, and an input/output (I/O) interface 858. The server 800 may operate based on an operating system stored in memory 832, such as Windows Server, MacOS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
Wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for:
acquiring a globally unique incremental sequence which is allocated to the electronic ticket in advance;
acquiring a user identification sequence according to a service account of a user;
acquiring a first random value and acquiring a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digits;
and carrying out encryption operation on the first random value, the incremental sequence and the user identification sequence through the first password to obtain the coupon code of the electronic coupon.
Assuming that the above is the first possible implementation manner, in a second possible implementation manner provided on the basis of the first possible implementation manner, the memory of the server further includes instructions for performing the following operations: after obtaining a first random value, the method further comprises:
and combining the first random value and the increasing sequence into an identifier of the electronic ticket, and storing the combined identifier of the electronic ticket into a database corresponding to the user identifier sequence to be used as a basis for verifying the validity of the electronic ticket subsequently.
In a third possible implementation manner provided as the basis for the first possible implementation manner, the memory of the server further includes instructions for performing the following operations: the encryption operation of the first random value, the increment sequence and the user identification sequence is carried out through the first password, and the encryption operation comprises the following steps:
carrying out modulus calculation on each digit of the user identification sequence by using each digit at a first preset position in the first password to obtain a first modulus value, wherein the digit number of the digit contained at the first preset position is the same as the digit number of the digit contained in the user identification sequence;
positioning and defining the first modulus value according to the number at the second preset position in the first password to obtain a first positioning sequence;
determining a second random value according to the user identification sequence and the first modulus value, and acquiring a preset second password corresponding to the second random value;
performing modulo operation on each digit of the incremental sequence by using each digit at a third preset position in the second password to obtain a second modular value, wherein the digit of the digit at the third preset position is the same as the digit of the digit contained in the incremental sequence;
positioning and defining the second modulus value according to the number at the fourth preset position in the second password to obtain a second positioning sequence;
and dispersing the second modulus value according to the second positioning sequence to obtain a first ticket code sequence, dispersing the first modulus value into the first ticket code sequence according to the first positioning sequence to obtain a second ticket code sequence, and taking the second ticket code sequence as a ticket code obtained by performing encryption operation on the electronic ticket.
In a fourth possible implementation manner provided as the basis of the first possible implementation manner, the memory of the server further includes instructions for performing the following operations: after generating the ticket code of the electronic ticket, the method further comprises the following steps:
receiving a coupon code updating request sent by a terminal corresponding to the user identification sequence;
and returning to the step of obtaining the first random value according to the ticket code updating request until a new ticket code of the electronic ticket is regenerated, and taking the new ticket code as the ticket code of the electronic ticket.
In a fifth possible implementation manner provided as the basis for the first possible implementation manner, the memory of the server further includes instructions for performing the following operations: after generating the ticket code of the electronic ticket, the method further comprises the following steps:
acquiring a coupon code input by a user when the user uses the electronic coupon;
decrypting the input coupon code to obtain an increasing sequence, a first random value and a user identification sequence corresponding to the input coupon code;
inquiring a database corresponding to the user identification sequence according to the first random value and the incremental sequence, and determining whether the electronic ticket is valid;
if the electronic ticket is determined to be valid, the user is allowed to use the electronic ticket.
In a sixth possible implementation manner provided as the basis for the fifth possible implementation manner, the memory of the server further includes instructions for performing the following operations: after allowing the user to use the electronic ticket, the method further comprises the following steps:
sending prompt information for using the electronic ticket to a mobile terminal corresponding to the user identification sequence;
determining whether a confirmation use message returned by the mobile terminal is received;
and if the confirmation use message returned by the mobile terminal is received, consuming the electronic ticket.
According to the server provided by the embodiment of the invention, the first password corresponding to the preset first random value is obtained, the increasing sequence, the first random value and the user identification sequence are encrypted through the first password to generate the ticket code, after the encryption operation is carried out through the first password corresponding to the first random value, the ticket codes of other users are not easy to calculate according to the existing ticket code, and the generated ticket code has higher safety.
It should be noted that: the ticket code generating device for the electronic ticket provided in the above embodiment is only illustrated by the division of the above functional modules when generating the ticket code of the electronic ticket, and in practical applications, the above functions may be distributed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions. In addition, the ticket code generation device and the ticket code generation server for the electronic ticket provided by the above embodiments belong to the same concept as the ticket code generation method embodiment for the electronic ticket, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (12)

1. A coupon code generation method for an electronic coupon, the method comprising:
acquiring a globally unique incremental sequence which is allocated to the electronic ticket in advance;
acquiring a user identification sequence according to a service account of a user;
acquiring a first random value and acquiring a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digits;
performing modulo calculation on each digit of the user identification sequence by using each digit at a first preset position in the first password to obtain a first modular value, wherein the digit of the digit contained at the first preset position is the same as the digit of the digit contained in the user identification sequence; positioning and defining the first modulus value according to a number at a second preset position in the first password to obtain a first positioning sequence;
determining a second random value according to the user identification sequence and the first modulus value, and acquiring a preset second password corresponding to the second random value; performing modulo operation on each digit of the incremental sequence by using each digit at a third preset position in the second password to obtain a second modular value, wherein the digit number of the digit at the third preset position is the same as the digit number of the digit included in the incremental sequence; positioning and defining the second modulus value according to a number at a fourth preset position in the second password to obtain a second positioning sequence;
and dispersing the second modulus value according to the second positioning sequence to obtain a first ticket code sequence, dispersing the first modulus value into the first ticket code sequence according to the first positioning sequence to obtain a second ticket code sequence, inserting the version number of a database into a preset position of the second ticket code sequence, and taking the second ticket code sequence inserted with the version number of the database as a ticket code obtained by performing encryption operation on the electronic ticket, wherein the database is used for storing the identifier of the electronic ticket.
2. The method of claim 1, wherein obtaining a first random value further comprises:
and combining the first random value and the increment sequence into the identifier of the electronic ticket, and storing the combined identifier of the electronic ticket into a database corresponding to the user identifier sequence as a basis for verifying the validity of the electronic ticket subsequently.
3. The method according to claim 1, wherein the step of, after the second ticket code sequence inserted into the version number of the database is used as the ticket code obtained by encrypting the electronic ticket, further comprises:
receiving a coupon code updating request sent by a terminal corresponding to the user identification sequence;
and returning to the step of obtaining a first random value according to the ticket code updating request until a new ticket code of the electronic ticket is regenerated, and taking the new ticket code as the ticket code of the electronic ticket.
4. The method according to claim 1, wherein the step of, after the second ticket code sequence inserted into the version number of the database is used as the ticket code obtained by encrypting the electronic ticket, further comprises:
acquiring a coupon code input by a user when the user uses the electronic coupon;
decrypting the input coupon code to obtain an increasing sequence, a first random value and a user identification sequence corresponding to the input coupon code;
inquiring a database corresponding to the user identification sequence according to the first random value and the increasing sequence, and determining whether the electronic ticket is valid;
and if the electronic ticket is determined to be valid, allowing the user to use the electronic ticket.
5. The method of claim 4, wherein after allowing the user to use the electronic coupon, further comprising:
sending prompt information for using the electronic ticket to a mobile terminal corresponding to the user identification sequence;
determining whether a confirmation use message returned by the mobile terminal is received;
and if the confirmation use message returned by the mobile terminal is received, consuming the electronic ticket.
6. An apparatus for generating a ticket code of an electronic ticket, the apparatus comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a globally unique incremental sequence which is allocated to an electronic ticket in advance;
the second acquisition module is used for acquiring a user identification sequence according to the service account of the user;
the third acquisition module is used for acquiring a first random value;
the fourth obtaining module is used for obtaining a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digit numbers;
the encryption module is used for carrying out encryption operation on the first random value, the increment sequence and the user identification sequence through the first password to obtain a coupon code of the electronic coupon;
the encryption module comprises:
the first modulus calculating unit is used for calculating the modulus of each digit of the user identification sequence by using each digit at a first preset position in the first password to obtain a first modulus value, and the digit number of the digit contained at the first preset position is the same as the digit number of the digit contained in the user identification sequence;
the first positioning definition unit is used for positioning and defining the first modulus value according to a number at a second preset position in the first password to obtain a first positioning sequence;
a determining unit, configured to determine a second random value according to the user identifier sequence and the first modulus value;
the acquisition unit is used for acquiring a preset second password corresponding to the second random value;
the second modulus calculating unit is used for calculating the modulus of each digit of the incremental sequence by using each digit at a third preset position in the second password to obtain a second modulus value, wherein the digit number of the digit at the third preset position is the same as the digit number of the digit contained in the incremental sequence;
the second positioning definition unit is used for positioning and defining the second modulus value according to the number at the fourth preset position in the second password to obtain a second positioning sequence;
a first discretization unit, configured to discretize the second modulus value according to the second positioning sequence to obtain a first ticket code sequence;
and the second discrete unit is used for dispersing the first modulus value into the first ticket code sequence according to the first positioning sequence to obtain a second ticket code sequence, inserting the version number of a database into a preset position of the second ticket code sequence, and taking the second ticket code sequence with the version number inserted into the database as a ticket code obtained by performing encryption operation on the electronic ticket, wherein the database is used for storing the identifier of the electronic ticket.
7. The apparatus of claim 6, further comprising:
a combining module for combining the first random value and the sequence of increments into an identification of the electronic ticket;
and the storage module is used for storing the combined identifier of the electronic ticket to a database corresponding to the user identifier sequence as a basis for verifying the validity of the electronic ticket subsequently.
8. The apparatus of claim 6, further comprising:
the receiving module is used for receiving a coupon code updating request sent by a terminal corresponding to the user identification sequence;
and the returning module is used for returning the step of obtaining the first random value according to the ticket code updating request until a new ticket code of the electronic ticket is regenerated, and taking the new ticket code as the ticket code of the electronic ticket.
9. The apparatus of claim 6, further comprising:
the fifth acquisition module is used for acquiring the coupon code input by the user when the electronic coupon is used;
the decryption module is used for decrypting the input coupon code to obtain an incremental sequence, a first random value and a user identification sequence corresponding to the input coupon code;
the query module is used for querying a database corresponding to the user identification sequence according to the first random value and the increment sequence and determining whether the electronic ticket is valid;
and the allowing module is used for allowing the user to use the electronic ticket when the electronic ticket is determined to be valid.
10. The apparatus of claim 9, further comprising:
the sending module is used for sending prompt information for using the electronic ticket to the mobile terminal corresponding to the user identification sequence;
the determining module is used for determining whether the confirmation use message returned by the mobile terminal is received or not;
and the consumption module is used for consuming the electronic ticket when receiving the use confirmation message returned by the mobile terminal.
11. A coupon code generation server for an electronic coupon, the server comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs including instructions for:
acquiring a globally unique incremental sequence which is allocated to the electronic ticket in advance;
acquiring a user identification sequence according to a service account of a user;
acquiring a first random value and acquiring a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digits;
performing modulo calculation on each digit of the user identification sequence by using each digit at a first preset position in the first password to obtain a first modular value, wherein the digit of the digit contained at the first preset position is the same as the digit of the digit contained in the user identification sequence;
positioning and defining the first modulus value according to a number at a second preset position in the first password to obtain a first positioning sequence;
determining a second random value according to the user identification sequence and the first modulus value, and acquiring a preset second password corresponding to the second random value;
performing modulo operation on each digit of the incremental sequence by using each digit at a third preset position in the second password to obtain a second modular value, wherein the digit number of the digit at the third preset position is the same as the digit number of the digit included in the incremental sequence;
positioning and defining the second modulus value according to a number at a fourth preset position in the second password to obtain a second positioning sequence;
and dispersing the second modulus value according to the second positioning sequence to obtain a first ticket code sequence, dispersing the first modulus value into the first ticket code sequence according to the first positioning sequence to obtain a second ticket code sequence, inserting the version number of a database into a preset position of the second ticket code sequence, and taking the second ticket code sequence inserted with the version number of the database as a ticket code obtained by performing encryption operation on the electronic ticket, wherein the database is used for storing the identifier of the electronic ticket.
12. A computer-readable storage medium storing one or more programs configured for execution by one or more processors, the one or more programs comprising instructions for:
acquiring a globally unique incremental sequence which is allocated to the electronic ticket in advance;
acquiring a user identification sequence according to a service account of a user;
acquiring a first random value and acquiring a preset first password corresponding to the first random value, wherein each preset password consists of preset numerical digits;
performing modulo calculation on each digit of the user identification sequence by using each digit at a first preset position in the first password to obtain a first modular value, wherein the digit of the digit contained at the first preset position is the same as the digit of the digit contained in the user identification sequence;
positioning and defining the first modulus value according to a number at a second preset position in the first password to obtain a first positioning sequence;
determining a second random value according to the user identification sequence and the first modulus value, and acquiring a preset second password corresponding to the second random value;
performing modulo operation on each digit of the incremental sequence by using each digit at a third preset position in the second password to obtain a second modular value, wherein the digit number of the digit at the third preset position is the same as the digit number of the digit included in the incremental sequence;
positioning and defining the second modulus value according to a number at a fourth preset position in the second password to obtain a second positioning sequence;
and dispersing the second modulus value according to the second positioning sequence to obtain a first ticket code sequence, dispersing the first modulus value into the first ticket code sequence according to the first positioning sequence to obtain a second ticket code sequence, inserting the version number of a database into a preset position of the second ticket code sequence, and taking the second ticket code sequence inserted with the version number of the database as a ticket code obtained by performing encryption operation on the electronic ticket, wherein the database is used for storing the identifier of the electronic ticket.
CN201410425690.5A 2014-08-26 2014-08-26 Ticket code generation method and device of electronic ticket and server Active CN105373927B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410425690.5A CN105373927B (en) 2014-08-26 2014-08-26 Ticket code generation method and device of electronic ticket and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410425690.5A CN105373927B (en) 2014-08-26 2014-08-26 Ticket code generation method and device of electronic ticket and server

Publications (2)

Publication Number Publication Date
CN105373927A CN105373927A (en) 2016-03-02
CN105373927B true CN105373927B (en) 2020-06-02

Family

ID=55376105

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410425690.5A Active CN105373927B (en) 2014-08-26 2014-08-26 Ticket code generation method and device of electronic ticket and server

Country Status (1)

Country Link
CN (1) CN105373927B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107707345B (en) * 2016-08-09 2021-08-13 百度在线网络技术(北京)有限公司 Method and device for encrypting and verifying bar code
CN106712934B (en) * 2016-12-01 2020-07-28 腾讯科技(深圳)有限公司 Identification information generation method and device
CN106972918B (en) * 2017-03-15 2020-10-13 中国工商银行股份有限公司 Electronic coding data generation method, device and verification method
CN107392640A (en) 2017-04-28 2017-11-24 阿里巴巴集团控股有限公司 A kind of method and device for handling electronic ticket link
CN109117116A (en) * 2017-06-26 2019-01-01 上海新飞凡电子商务有限公司 Based on the random delivery of cargo code generating method from increasing sequence
CN108280678B (en) * 2018-01-10 2022-07-19 北京思特奇信息技术股份有限公司 Method and system for dynamically generating card ticket
CN108256915A (en) * 2018-01-17 2018-07-06 北京网信云服信息科技有限公司 A kind of sharing method of electronic ticket, presented side's terminal, server and system
CN110046508B (en) * 2018-12-27 2024-06-18 创新先进技术有限公司 Service code value processing method, device and equipment
CN111723360B (en) * 2019-03-18 2023-11-03 北京京东尚科信息技术有限公司 Credential code processing method, device and storage medium
CN112016948B (en) * 2019-05-31 2024-01-23 口碑(上海)信息技术有限公司 Method and device for generating electronic coupon code, storage medium and electronic device
CN110543471A (en) * 2019-07-05 2019-12-06 威富通科技有限公司 Ticket code generation method and server
CN110738513B (en) * 2019-09-11 2022-08-02 完美世界(北京)软件科技发展有限公司 Method and device for generating and verifying redemption code
CN111026758B (en) * 2019-12-11 2022-09-16 易点生活数字科技有限公司 Electronic ticket issuing method and device
CN111401965A (en) * 2020-03-24 2020-07-10 贵阳块数据城市建设有限公司 Electronic coupon code classification management system
CN111914515A (en) * 2020-08-17 2020-11-10 江苏华泽微福科技发展有限公司 Ticket encryption system and verification method
CN112668017B (en) * 2020-12-24 2022-03-29 阡陌数字信息科技(南京)有限公司 Construction method, decryption method and device of self-explanatory encryption card

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101546333A (en) * 2009-04-14 2009-09-30 北京红旗贰仟软件技术有限公司 Method for determining uniqueness of electronic documents by using electronic barcode
CN101799879A (en) * 2009-12-29 2010-08-11 上海贝岭股份有限公司 Method for manufacturing real-name train ticket
CN102509141A (en) * 2011-10-31 2012-06-20 广东商学院 Electronic group-buying coupon and usage and system of electronic group-buying coupon
CN103093375A (en) * 2012-12-31 2013-05-08 邬国锐 Electronic coupon processing system and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8942373B2 (en) * 2010-11-29 2015-01-27 Beijing Z & W Technology Consulting Co., Ltd. Data encryption and decryption method and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101546333A (en) * 2009-04-14 2009-09-30 北京红旗贰仟软件技术有限公司 Method for determining uniqueness of electronic documents by using electronic barcode
CN101799879A (en) * 2009-12-29 2010-08-11 上海贝岭股份有限公司 Method for manufacturing real-name train ticket
CN102509141A (en) * 2011-10-31 2012-06-20 广东商学院 Electronic group-buying coupon and usage and system of electronic group-buying coupon
CN103093375A (en) * 2012-12-31 2013-05-08 邬国锐 Electronic coupon processing system and method

Also Published As

Publication number Publication date
CN105373927A (en) 2016-03-02

Similar Documents

Publication Publication Date Title
CN105373927B (en) Ticket code generation method and device of electronic ticket and server
AU2007294624B2 (en) A method and apparatus to provide authentication and privacy with low complexity devices
CN108023874B (en) Single sign-on verification device and method and computer readable storage medium
EP3779792B1 (en) Two-dimensional code generation method, data processing method, apparatus, and server
CN106790156B (en) Intelligent device binding method and device
CN112948784B (en) Internet of things terminal identity authentication method, computer storage medium and electronic equipment
CN114218592A (en) Sensitive data encryption and decryption method and device, computer equipment and storage medium
CN115186145B (en) Privacy keyword query method, device and system
CN112507365B (en) Data matching method, terminal and storage medium
CN109697188B (en) Engineering cost data management method and system
JP6740545B2 (en) Information processing device, verification device, information processing system, information processing method, and program
CN112165382A (en) Software authorization method and device, authorization server and terminal equipment
CN114389889B (en) File full life cycle management method and device based on block chain technology
CN102843232A (en) Generating secure device secret key
CN111598695A (en) Block chain data access method and device
CN115664655A (en) TEE credibility authentication method, device, equipment and medium
CN114218582A (en) Database data encryption method and terminal
CN105959099A (en) Method for realizing SSR password encryption
CN111934882B (en) Identity authentication method and device based on block chain, electronic equipment and storage medium
CN113221154A (en) Service password obtaining method and device, electronic equipment and storage medium
CN101192263A (en) Information processing system and method
CN115987512A (en) Data processing method, device, system and medium based on oblivious transmission protocol
CN116361833A (en) Verification method and device and terminal equipment
CN106973048B (en) Method for safely and quickly storing intelligent hardware equipment data on public cloud service platform
CN108512657B (en) Password generation method and device

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