A method for preventing anti-decompilation of a scenic spot ticket number
By encrypting the scenic area's ticket numbers using various randomization methods and encryption algorithms, the problem of QR code encoding rules being easily decompiled was solved, achieving both randomness and security of the ticket numbers, thus ensuring the stability of the scenic area's operation and protecting the legitimate rights and interests of tourists.
Patent Information
- Application Number
- CN202311778068.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-21
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-12-21
AI Technical Summary
The existing QR code encoding rules for scenic spot tickets are easily decompiled, which increases the risk of ticket counterfeiting and affects the operation of scenic spots and the legitimate rights and interests of tourists.
Multiple randomization methods and encryption algorithms are used to encrypt the ticket number, including initializing the base number and string sequence with a random function to generate a random encrypted string. The encryption rules are optimized by combining performance evaluation to ensure the randomness and security of the ticket number.
This improves the security and reliability of tickets, prevents counterfeit tickets, and safeguards the normal operation of the scenic area and the legitimate rights and interests of tourists.
Smart Images

Figure CN117932566B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of encryption technology, in particular to a method for preventing anti-decompilation of a scenic spot ticket number. BACKGROUND
[0002] Scenic tourism occupies a dominant position in tourism consumption, and various tourism products such as tickets, tickets, cable tickets, boat tickets and performance tickets are the main forms of consumption. The core of these products usually includes an internal ticket number ID generated by a ticketing system, which generates a two-dimensional code string after encryption. The ticket with the two-dimensional code held by the tourist is read on the ticket checking equipment, and the equipment compares the two-dimensional code string with the internal ticket number ID in the ticketing system through the network. If the comparison is successful, the ticket is considered legal; otherwise, it will be considered illegal. To ensure the normal operation of the scenic spot ticketing system, it is necessary to ensure the uniqueness, readability and traceability of the ticket number. To meet these requirements, on the one hand, special coding rules need to be developed to ensure the properties of the ticket number, and encryption means are used to prevent counterfeiting and anti-counterfeiting, so that the internal ticket number rule is easy to understand based on internal management, but external personnel cannot generate a ticket number that can be recognized by the system to meet the demand for seeking benefits. On the other hand, the ticket checking equipment needs to be able to directly display the ticket purchase date, play date, channel number and other information by decoding the ticket number, so that ticket checking can be performed in case of network interruption or server downtime.
[0003] In the past, the two-dimensional code encryption rule of the ticket was relatively regular, for example: through the unit name, date, serial number and check code, etc. as the main coding rule. This rule is simple to manage and easy to implement, but it is easy to be decompiled. In recent years, the tourism industry has developed unprecedentedly, and tickets as a commodity with economic value have also become the target of ticket evasion and reselling. Some technical illegal personnel generate the internal ticket ID of the ticketing system by inversely calculating the encoding rule of the ticket two-dimensional code string from the publicly circulated ticket two-dimensional code, thereby counterfeiting the verifiable ticket.
[0004] To solve these problems, the present application proposes a method for preventing anti-decompilation of a scenic spot ticket number. This method aims to solve the above problems, improve the security and reliability of the ticket, and protect the normal operation of the scenic spot and the legitimate rights and interests of tourists. SUMMARY
[0005] The purpose of the present application is to provide a method for preventing anti-decompilation of a scenic spot ticket number, which solves the problem of counterfeiting tickets by decompilation in the prior art.
[0006] The present application is achieved by the following technical solutions:
[0007] In a first aspect, the present application provides a method for preventing anti-decompilation of a scenic spot ticket number, comprising:
[0008] Obtaining N computer string sequences, and arranging the N computer string sequences as columns in random order to obtain N columns of computer string sequences after sorting when each random period arrives;
[0009] Initializing a first target number of a certain base by using a random function, and obtaining a first encrypted string according to the first target number and the N columns of computer string sequences after sorting;
[0010] Receiving an original ticket number generation instruction, and generating a target original ticket number according to the original ticket number generation instruction and a preset ticket number generation rule;
[0011] Encrypting the target original ticket number by using the first encrypted string to obtain a target encrypted code, and generating a target code corresponding to the target original ticket number based on the target encrypted code, so as to prevent anti-decompilation of the scenic spot ticket number;
[0012] The target code comprises a two-dimensional code and / or a bar code.
[0013] In a possible implementation, the first encrypted string is obtained by initializing the first target number of a certain base by using a random function and according to the first target number and the N columns of computer string sequences after sorting, and the method comprises the following steps:
[0014] Initializing the first target number of a certain base by using a random function to obtain the first target number JZn;
[0015] Based on the N columns of computer string sequences after sorting, a character is selected from the first column one by one, and when the number of characters in the first column is less than the first target number JZn, a character is selected from the subsequent columns one by one, until the selected character meets the first target number JZn, and the first encrypted string is obtained.
[0016] In a possible implementation, the preset ticket number generation rule comprises: original ticket number = date code + random number + serial number.
[0017] In a possible implementation, the date code is 4-digit year + 2-digit month + 2-digit day, the random number is a number selected from 0-n 9s, and when the dimension does not meet n, 0 is added in front to n dimensions; the serial number is sequentially generated from 1, and 0 is added in front to a preset dimension.
[0018] In a possible implementation, the target encrypted code is obtained by encrypting the target original ticket number by using the first encrypted string to prevent anti-decompilation, and the method comprises the following steps:
[0019] If yes, the target original lottery ticket number is encrypted by using a long string encryption algorithm according to the first encrypted string to obtain a target encrypted code; otherwise, the target original lottery ticket number is encrypted by using a short string encryption algorithm according to the first encrypted string to obtain the target encrypted code.
[0020] In a possible implementation, the target original lottery ticket number is encrypted by using a short string encryption algorithm according to the first encrypted string to obtain the target encrypted code, including:
[0021] A1, the characters in the first encrypted string are randomly arranged by using a random function to obtain a first encrypted string after random arrangement;
[0022] A2, a counter t is set to 1;
[0023] A3, the target original lottery ticket number is divided by a first target base number to obtain a first target quotient s corresponding to the tth cycle and a first target remainder i;
[0024] A4, the i th character in the first encrypted string after random arrangement is taken as the t th character of an intermediate encrypted code;
[0025] A5, it is judged whether the first target quotient s is 0, if yes, the intermediate encrypted code is output, otherwise the count value of the counter t is increased by 1, and the step A3 is returned;
[0026] A6, the intermediate encrypted code output in the step A5 is arranged in reverse order to obtain the target encrypted code.
[0027] In a possible implementation, the target original lottery ticket number is encrypted by using a long string encryption algorithm according to the first encrypted string to obtain the target encrypted code, including:
[0028] A preset encrypted string limited width corresponding to the target encrypted code is obtained;
[0029] A corresponding number of characters are randomly selected from the first encrypted string based on the preset encrypted string limited width to obtain the target encrypted code.
[0030] In a second aspect, the present application provides a method for preventing anti-decompilation of a scenic spot ticket number, including:
[0031] N computer string sequences are obtained, and when each random period comes, the N computer string sequences are arranged as columns to obtain N columns of computer string sequences after sorting;
[0032] The second target radix number is initialized by a random function, and a second encrypted string is obtained according to the second target radix number and the N-column computer string sequence after sorting;
[0033] The sample ticket number is accepted, and the sample ticket number is anti-decompiled and encrypted by using the second encrypted string to obtain a sample encrypted code, and the encryption speed of the sample ticket number is recorded.
[0034] The sample code corresponding to the sample ticket number is generated based on the sample encrypted code, and a decompilation attack is performed on the sample code corresponding to the sample ticket number to obtain a decompilation attack effect.
[0035] The encryption effect corresponding to the second target radix number is obtained based on the encryption speed corresponding to the sample encrypted code and the decompilation attack effect.
[0036] All different second target radix numbers are traversed, and the final target radix number is determined according to the encryption effects of all second target radix numbers.
[0037] A third encrypted string is obtained according to the final target radix number and the N-column computer string sequence after sorting.
[0038] The original ticket number generation instruction is accepted, and the target original ticket number is generated according to the original ticket number generation instruction and the preset ticket number generation rule.
[0039] The target original ticket number is anti-decompiled and encrypted by using the third encrypted string to obtain a target encrypted code, and the target code corresponding to the target original ticket number is generated based on the target encrypted code, so as to realize anti-decompilation of the scenic spot ticket number.
[0040] The target code includes a two-dimensional code and / or a bar code.
[0041] In a possible implementation, the final target radix number is determined according to the encryption effects of all second target radix numbers, including:
[0042] The multiple second target radix numbers with the best anti-decompilation effect are determined based on the decompilation attack effect.
[0043] The second target radix number corresponding to the fastest encryption speed of the sample encrypted code is determined from the determined multiple second target radix numbers, and the final target radix number is obtained.
[0044] In a third aspect, the present application provides a method for anti-decompilation of a scenic spot ticket number, including:
[0045] N computer string sequences are obtained, and the N computer string sequences are randomly arranged as columns when each random period comes to obtain the N-column computer string sequence after sorting.
[0046] The third target numeral is initialized by a random function, and a fourth encrypted string is obtained according to the third target numeral and the sequence of the N-column computer string after sorting;
[0047] The original ticket number generation instruction is accepted, and a target original ticket number is generated according to the original ticket number generation instruction and a preset ticket number generation rule;
[0048] The target original ticket number is anti-decompiled and encrypted by using the fourth encrypted string to obtain a target encrypted code, and the encryption speed of the anti-decompiled and encrypted target original ticket number is recorded;
[0049] The target code corresponding to the target original ticket number is generated based on the target encrypted code, so as to realize anti-decompilation of the scenic spot ticket number, and the target code corresponding to the target original ticket number is attacked to obtain a decompilation attack effect;
[0050] The encryption effect corresponding to the third target numeral is obtained based on the encryption speed corresponding to the target encrypted code and the decompilation attack effect;
[0051] The third target numeral is changed every preset transformation period, and the changed third target numeral is not repeated with the previous third target numeral, and the encryption effect corresponding to each third target numeral is obtained;
[0052] Until the execution number of the preset transformation period reaches a specified number, the final target numeral is obtained according to the encryption effect corresponding to each third target numeral, and the final target numeral is used for encryption in the subsequent anti-decompiled encryption process, so as to realize anti-decompilation of the scenic spot ticket number.
[0053] The target code includes a two-dimensional code and / or a bar code.
[0054] The anti-decompilation method for the scenic spot ticket number provided by the application can effectively increase the randomness of the ticket number corresponding to the target code, so as to increase the security of the ticket system, and finally optimize the entire encryption algorithm through the encryption effect, so as to effectively balance the security performance and the encryption efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor. In the drawings:
[0056] Figure 1 A flowchart of a ticket number anti-decompilation method for a scenic spot ticket provided in Embodiment 1 of the present application.
[0057] Figure 2 A schematic diagram of N computer-recognizable string sequences provided in Embodiment 2 of the present application.
[0058] Figure 3 A flowchart of a ticket number anti-decompilation method for a scenic spot ticket provided in Embodiment 3 of the present application.
[0059] Figure 4 A flowchart of a ticket number anti-decompilation method for a scenic spot ticket provided in Embodiment 4 of the present application. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solutions and advantages of the present application more clear and obvious, the following will further describe the present application in combination with embodiments and drawings. The exemplary embodiments of the present application and their descriptions are only used to explain the present application, and should not be considered as limiting the present application.
[0061] Embodiment 1
[0062] In a scenic spot ticket system, the uniqueness, readability and traceability of the ticket number are crucial. On the one hand, special coding rules need to be developed to ensure the properties of the ticket number to help the scenic spot management, and on the other hand, anti-fake means need to be used to make the ticket number converted into a ticket inspection two-dimensional code to be difficult to be easily interpreted in the external flow process. At the same time, in order to improve the ticket inspection efficiency and avoid the ticket number being too long to affect the reading efficiency of the scanning code equipment, the ticket number needs to be compressed, while ensuring that the scanning code equipment can normally read and ensuring good inspection speed. After scanning by the scenic spot ticket inspection equipment, the ticket number can be decoded to directly display the ticket purchase date, play date, number of days, channel number and other information, which provides convenience for temporarily using the equipment offline ticket inspection in the case of network interruption or server downtime.
[0063] However, with the improvement of computer operation speed and the continuous development of big data technology (such as AI large model), some unscrupulous people are more likely to use public data (such as ticket surface two-dimensional code) to perform reverse calculation and forge tickets. Therefore, it is necessary to randomly and deeply encrypt the ticket number generated string, increase the difficulty of reverse rule calculation, and at the same time, through algorithm optimization, avoid affecting the "decoding" speed due to the increase of encryption difficulty, so as to protect the ticket checking experience of tourists.
[0064] As shown in Figure 1 The embodiment of the application provides a method for preventing anti-decompilation of a scenic spot ticket number, which comprises the following steps:
[0065] In S101, N computer string sequences are obtained, and when each random period comes, the N computer string sequences are arranged as columns in random, and N column computer string sequences after sorting are obtained.
[0066] In S102, a first target radix number is initialized by a random function, and a first encrypted string is obtained according to the first target radix number and the N column computer string sequences after sorting.
[0067] In S103, an original ticket number generation instruction is accepted, and a target original ticket number is generated according to the original ticket number generation instruction and a preset ticket number generation rule.
[0068] In S104, the first encrypted string is used to prevent anti-decompilation encryption of the target original ticket number, and a target encrypted code is obtained. Based on the target encrypted code, a target code corresponding to the target original ticket number is generated, and the anti-decompilation of the scenic spot ticket number is realized.
[0069] The target code comprises a two-dimensional code and / or a bar code.
[0070] In a possible implementation, the first target radix number is initialized by a random function, and the first encrypted string is obtained according to the first target radix number and the N column computer string sequences after sorting, which comprises the following steps:
[0071] The first target radix number JZn is obtained by initializing the first target radix number by a random function.
[0072] Based on the N column computer string sequences after sorting, the characters are selected one by one from the first character of the first column. When the number of characters in the first column is less than the first target radix number JZn, the characters are selected one by one from the subsequent columns at a time, until the selected characters meet the first target radix number JZn, and the first encrypted string is obtained.
[0073] In a possible implementation, the preset ticket number generation rule comprises: original ticket number = date code + random number + serial number.
[0074] In a possible implementation, the date is coded as 4-digit year + 2-digit month + 2-digit day. The random number is a number selected from 0-n 9s, and when the dimension does not satisfy n, 0s are added in front to n dimensions. The serial number is sequentially generated starting from 1, and 0s are added in front to the preset dimension.
[0075] In a possible implementation, the target original ticket number is anti-decompiled encrypted by using the first encryption string to obtain a target encryption code, including:
[0076] It is judged whether the character width corresponding to the first encryption string is greater than or equal to a preset long-short boundary threshold. If yes, the target original ticket number is anti-decompiled encrypted by using a long string encryption algorithm according to the first encryption string to obtain a target encryption code. Otherwise, the target original ticket number is anti-decompiled encrypted by using a short string encryption algorithm according to the first encryption string to obtain a target encryption code.
[0077] In a possible implementation, the target original ticket number is anti-decompiled encrypted by using a short string encryption algorithm according to the first encryption string to obtain a target encryption code, including:
[0078] A1, the characters in the first encryption string are sequentially randomly arranged by using a random function to obtain a first encryption string after randomization.
[0079] A2, a counter t is set to 1.
[0080] A3, the target original ticket number is divided by the first target radix number to obtain a first target quotient s and a first target remainder i corresponding to the tth cycle.
[0081] A4, the i th character in the first encryption string after randomization is taken as the t th character of an intermediate encryption code.
[0082] A5, it is judged whether the first target quotient s is 0. If yes, the intermediate encryption code is output. Otherwise, the count value of the counter t is increased by 1, and step A3 is returned.
[0083] A6, the intermediate encryption code output in step A5 is arranged in reverse order to obtain a target encryption code.
[0084] In a possible implementation, the target original ticket number is anti-decompiled encrypted by using a long string encryption algorithm according to the first encryption string to obtain a target encryption code, including:
[0085] A preset encryption string limited width corresponding to the target encryption code is obtained.
[0086] A corresponding number of characters are randomly selected from the first encryption string based on the preset encryption string limited width to obtain a target encryption code.
[0087] This invention provides a method for preventing reverse engineering of scenic spot ticket numbers. It uses N random methods and algorithms to make the ticket number encryption rules random, and continuously optimizes them by combining performance evaluation. Furthermore, the character order in the base string is randomized, making the further encryption mechanism unpredictable and lacking regularity. This effectively increases the randomness of the target code corresponding to the ticket number, thereby increasing the security of the ticketing system.
[0088] Example 2
[0089] This embodiment is a further example based on Embodiment 1, and the specific principle is as follows.
[0090] In this embodiment, characters such as ticket purchase date, visit date, number of days, channel number, and serial number, which are more related to the understanding of service business, are retained as is. The core focus is on the description of encryption algorithms and further performance solutions for non-business side.
[0091] according to Figure 2 As shown, multiple character sequences are introduced, where N represents N types of string sequences that computers can recognize.
[0092] N-ary number generation: Generate an N-ary number sequence along the X and Y axes, such as: 4-ary "0, 1, 2, 3"; octal "0, 1, 2, 3, 4, 5, 6, 7"; 11-ary "0-9, A"; 13-ary "0-9, A, B, C"; and so on. The X-axis of the generated N-ary number sequence can be randomly adjusted periodically and regenerated in conjunction with subsequent evaluation methods for use in subsequent rules.
[0093] The initial string rule GZn is defined using a random function (this initial definition includes the base and the acquisition of SDN and FBYn), where the base of this rule is JZn. All business ticket numbers generated throughout the entire business process, including encryption and decryption, need to be associated with GZn.
[0094] Generating a business-friendly original ticket number YSPHn can include: generating a unique original number for a specified date, where the number = date + random number + serial number + check digit.
[0095] The date is formatted as: 4-digit year + 2-digit month + 2-digit day (e.g., December 02, 2023 is recorded as 20231202).
[0096] Random number: 2 digits, randomly selected from 0 to 99. If the number is less than 10, the tens digit is padded with 0. This means that there are 100 possible numbers for a date, but the system will only randomly save one of the results.
[0097] Optionally, according to the special requirements of some businesses (such as internal encryption prevention), the random number can also be increased to n bits, and the random number will be taken from (0~n 9), and the method is as described above. But this will cause the random number to be very long and not convenient to manage, and in this case, a progress conversion calculator can be used to convert the progress to a value that can be easily used according to the business management requirements, such as 10 to 16, 32 to 10, etc.
[0098] Random numbers can also be obtained by the progress conversion calculator method: for example, the conversion between octal and hexadecimal: octal: composed of 0-7 digits, without 8 and 9. Hexadecimal: composed of 0-9 and A-F. A-F corresponds to 10-15. N progress is arranged according to the table above. Decimal to octal: divide by 8 until the quotient is 0, and then take the remainder in reverse. Octal to decimal: the last digit is 8^0, and then the index is increased in the order of addition.
[0099] Serial number: in sequence, starting from 1 (such as: 1, 2, 3....n).
[0100] Check digit: 1 bit, sum of all digits taken 10.
[0101] Ticket number encryption is divided into long string encryption and short string encryption. The character width of the JZn progress is KDn, and the long and short boundary variable CDjd is set. When KDn >= CDjd, use long string encryption, and when KDn < CDjd, use long string encryption.
[0102] A. Short string encryption: original ticket number YSPH1, define encryption code KEY1.
[0103] 1) Use JZn progress (assuming the current system selected progress is 36 progress) to select string sequence ZFC36 (according to the progress string ZFC36 set in the previous table: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ, the string width KDn is 36).
[0104] 2) Use a random function (such as the shuffle() function provided in Python's random module) to rearrange the order of ZFC36, and update the rearranged sequence to ZFC36 (such as: 6ABEF34CDIXGHJKLU9VWYPZM80712NOTQ5RS.
[0105] 3) Divide YSPH1 by 36, and get a quotient s and a remainder i (0 to 35), the remainder i is the subscript of the KEY1 character list, that is, the i-th character of ZFC36 as the first character of KEY1. Continue to divide s by 36 again to get a new s and a remainder i, and get the second character of KEY1 according to the above method, and so on, until the quotient is 0.
[0106] 4) The string generated in 3) is encoded in reverse order, and the final value is updated as KEY1, which is the final encrypted two-dimensional code generation code of YSPH1. The method is the same as the previous radix conversion algorithm.
[0107] B. Encryption of long string: original ticket number YSPH2, define encryption code KEY2.
[0108] 1) Use JZn radix (assuming the current system selected radix JZn is 101 radix) to select string sequence ZFC101 (according to the above, the 101 radix string is: 0123456789ABCDEFGHI…I II III IV V VI VII VIII IX XXI XII, and the string width KDn is 101).
[0109] 2) Set the encryption string limit width equal to CDjd;
[0110] 3) Use a random selection function (such as the randint() function in the random module in Python) to select a new string of CDjd bit width in ZFC101 and assign it to KEY2 as the encrypted two-dimensional code generation code of YSPH2.
[0111] 4) If necessary, the random selection function can be used multiple times to determine the code in 3), and if necessary, a random sorting function (see short string encryption method 2) can be used to further arrange the last selected code sequence and update it.
[0112] Performance and security evaluation: in the case of equal computing power, too low radix is easy to find the rule and reverse crack. In the case of too high radix and frequent change of radix mechanism, the encryption process occupies too much computing resources and takes too long to calculate, affecting the normal operation of the ticketing system. The faster the speed means the less the occupation of computing resources, and the smaller the impact on the production system. Therefore, an evaluation index is needed to find a performance evaluation method that takes into account these aspects, to maintain the normal operation of the system while making the encryption more secure.
[0113] 1) GZn includes JZn (N radix) and SDn (encryption speed) and FBYn (number of times of reverse compilation events).
[0114] 2) Take (four) A as an example, SD1 is the time-consuming of compiling YSPH1 ticket number to KEY1 in steps (four) A 1) ~ 4), and SDn is the average time of compiling YSPHn ticket number to KEYn using GZn.
[0115] 3) FBYn refers to the number of events occurring during the compilation of ticket number YSPHn to KEYn using GZn, and FBYn is accumulated once for each occurrence:
[0116] a) The same ticket code is repeatedly checked, and once it passes normally, the interval time JGSJn is more than 10 minutes, and the other time it shows that the ticket has been checked. Among them: record the interval time JGSJn of each event occurrence, and the average value of multiple events in a month (less than a month, according to the actual total number of days) during the use of GZn is taken as the interval time value. For example, the average value of multiple events in a single month is 3.5 minutes, and JGSJn is 3.5 minutes.
[0117] b) FBYCSn appears more than 3 times, and the ticket has been checked at the ticket checking port. Among them: the average value of multiple events in a week (less than a week, according to the actual total number of days) during the use of GZn is taken as the interval time value FBYCSn. For example, 5 times a day on average for 7 days, and FBYCSn is 5.
[0118] 4) When the situation in 3) b) occurs, the system should timely alarm the management side. When the FBYn value of long character encryption is greater than that of short character encryption in a unit of time (such as: 3) b) condition), the string width CDjd needs to be accumulated by 1, and vice versa, and the encryption character width is gradually increased to improve the encryption standard.
[0119] 5) Establish evaluation rules. In the case of using GZn, FBYn from low to high, SDn from high to low. According to the "safety first" principle, first select GZn with high FBYn value, then select SDn of corresponding GZn with high value under the condition of meeting this condition; and so on.
[0120] 6) According to the business needs, the number of tickets in a week, month, quarter and year can be associated, and combined with 5) to predict which kind of encoding encryption is safer and faster, to assist business management.
[0121] The beneficial effects produced by the embodiment are: the ticket number encryption rule is randomized by N random ways and algorithms, and the performance evaluation is combined for continuous optimization. N computer-recognizable sequence symbols are randomly arranged on the X axis to form N-base character sequence arrangements. The character order in the base string is randomly arranged to further encrypt the mechanism and lack regularity. Selecting which base is combined with the subsequent performance evaluation index to determine the encryption and performance combination. The super-long character encryption is performed by setting the width limit, and the long string is randomly selected and encrypted. The limit width of the limit string is selected by continuous optimization to avoid the pressure on the machine caused by super-long string compilation while maintaining high encryption.
[0122] Embodiment 3
[0123] This embodiment is a further improvement based on embodiment 1, and the specific principle is as follows.
[0124] As Figure 3 shown, the present application provides a method for preventing anti-decompilation of scenic spot ticket numbers, comprising:
[0125] S301, obtain N computer string sequences, and arrange N computer string sequences as columns when each random period comes, to obtain N column computer string sequences after sorting.
[0126] S302, initialize the second target base number by a random function, and obtain a second encrypted string according to the second target base number and the N column computer string sequences after sorting.
[0127] S303, accept a sample ticket number, and use the second encrypted string to prevent anti-decompilation encryption of the sample ticket number, to obtain a sample encrypted code, and record the encryption speed of the sample ticket number.
[0128] S304, based on the sample encrypted code, generate a sample code corresponding to the sample ticket number, and perform decompilation attack on the sample code corresponding to the sample ticket number, to obtain the decompilation attack effect.
[0129] S305, based on the encryption speed corresponding to the sample encrypted code and the decompilation attack effect, obtain the encryption effect corresponding to the second target base number.
[0130] S306, traverse all different second target base numbers, and determine the final target base number according to the encryption effect of all second target base numbers.
[0131] S307, obtain a third encrypted string according to the final target base number and the N column computer string sequences after sorting.
[0132] S308, accept the original ticket number generation instruction, and generate a target original ticket number according to the original ticket number generation instruction and a preset ticket number generation rule.
[0133] S309, anti-decompilation encryption is performed on the target original ticket number by using a third encryption string to obtain a target encryption code, and a target code corresponding to the target original ticket number is generated based on the target encryption code, so that anti-decompilation of the scenic spot ticket ticket number is realized.
[0134] The target code includes a two-dimensional code and / or a bar code.
[0135] In a possible implementation, the final target numeral system is determined according to encryption effects of all the second target numeral systems, and the final target numeral system includes:
[0136] The multiple second target numeral systems with the best anti-decompilation effects are determined based on the decompilation attack effects.
[0137] The second target numeral system with the fastest encryption speed corresponding to the sample encryption code is determined from the multiple determined second target numeral systems, and the final target numeral system is obtained.
[0138] The implementation has the beneficial effect that the encryption algorithm is optimized by the encryption effect, which can guarantee the encryption effect and the encryption efficiency.
[0139] Embodiment 4
[0140] This embodiment is a further improvement based on Embodiment 1, and the specific principle is as follows.
[0141] As shown in Figure 4 The present application provides an anti-decompilation method for a scenic spot ticket ticket number, which includes:
[0142] S401, obtain N computer string sequences, and arrange the N computer string sequences as columns in random order to obtain N columns of computer string sequences after sorting when each random period comes.
[0143] S402, initialize a third target numeral system by using a random function, and obtain a fourth encryption string according to the third target numeral system and the N columns of computer string sequences after sorting.
[0144] S403, accept the original ticket number generation instruction, and generate a target original ticket number according to the original ticket number generation instruction and a preset ticket number generation rule.
[0145] S404, anti-decompilation encryption is performed on the target original ticket number by using the fourth encryption string to obtain a target encryption code, and the encryption speed of the anti-decompilation encryption on the target original ticket number is recorded.
[0146] S405, on the basis of the target encryption code, a target code corresponding to the target original ticket number is generated to realize the anti-decompilation of the scenic spot ticket number. And the target code corresponding to the target original ticket number is attacked by decompilation to obtain the decompilation attack effect.
[0147] S406, on the basis of the encryption speed corresponding to the target encryption code and the decompilation attack effect, the encryption effect corresponding to the third target number of the third target number is obtained.
[0148] S407, every time a preset conversion period is passed, the third target number is changed once, and the changed third target number is not repeated with the previous third target number, and the encryption effect corresponding to each third target number is obtained.
[0149] S408, until the execution number of the preset conversion period reaches the specified number, the final target number is obtained according to the encryption effect corresponding to each third target number, and the final target number is used for encryption in the subsequent anti-decompilation encryption process to realize the anti-decompilation of the scenic spot ticket number.
[0150] Among them, the target code includes a two-dimensional code and / or a bar code.
[0151] The beneficial effects of the embodiment are: the encryption effect is used to optimize the entire encryption algorithm, which can ensure the encryption effect and the encryption efficiency.
[0152] The above specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for anti-decompilation of a scenic spot ticket number, characterized in that, include: Obtain N computer string sequences, and at the arrival of each random period, randomly arrange the N computer string sequences as columns to obtain N sorted computer string sequences; The first target base number is initialized using a random function, and the first encrypted string is obtained based on the first target base number and the sorted N columns of computer string sequences. The process of obtaining the first encrypted string includes: initializing a first target base number using a random function to obtain the first target base number; and, based on the sorted N columns of computer string sequences, selecting characters one by one starting from the first character of the first column. When the number of characters in the first column is less than the first target base number, characters are selected one by one from the subsequent columns until the selected characters satisfy the first target base number, thus obtaining the first encrypted string. Accept the instruction to generate the original ticket number, and generate the target original ticket number according to the instruction and the preset ticket number generation rules; The target original ticket number is encrypted using the first encrypted string to prevent reverse engineering, resulting in the target encrypted code. Based on the target encrypted code, the target code corresponding to the target original ticket number is generated, thus achieving anti-reverse engineering of the scenic spot ticket number. The target code includes QR codes and / or barcodes.
2. The anti-decompilation method for scenic spot ticket ticket number according to claim 1, characterized in that, The preset ticket number generation rules include: original ticket number = date code + random number + serial number.
3. The anti-decompilation method for scenic spot ticket ticket number according to claim 2, characterized in that, The date encoding is 4-digit year + 2-digit month + 2-digit day; the random number is a number taken from 0 to n nines, and if the dimension does not meet n, it is padded with 0s to n dimensions; the serial number is generated sequentially starting from 1 and padded with 0s to the preset dimension.
4. The anti-decompilation method for scenic spot ticket ticket number according to claim 1, characterized in that, The original ticket number is encrypted using the first encrypted string to prevent reverse engineering, resulting in the target encrypted code, including: Determine whether the character width corresponding to the first encrypted string is greater than or equal to the preset length threshold. If so, use the long string encryption algorithm to encrypt the target original ticket number to prevent decompilation, and obtain the target encrypted code. Otherwise, use the short string encryption algorithm to encrypt the target original ticket number to prevent decompilation, and obtain the target encrypted code.
5. The anti-decompilation method for scenic spot ticket ticket number according to claim 4, characterized in that, Based on the first encrypted string, a short string encryption algorithm is used to encrypt the original ticket number to prevent reverse engineering, resulting in the target encrypted code, including: A1. Use a random function to randomly arrange the characters in the first encrypted string to obtain the randomized first encrypted string; A2. Set the counter t=1; A3. Divide the original target ticket number by the first target base number to obtain the first target quotient s and the first target remainder i corresponding to the t-th cycle; A4. Take the i-th character in the first encrypted string after randomization as the t-th character of the intermediate encryption code; A5. Determine if the first target quotient s is 0. If it is, output the intermediate encryption code; otherwise, increment the counter t by one and return to step A3. A6. Reverse the order of the intermediate encryption codes output in step A5 to obtain the target encryption code.
6. The anti-decompilation method for scenic spot ticket ticket number according to claim 4, characterized in that, Based on the first encrypted string, a long string encryption algorithm is used to encrypt the original ticket number to prevent reverse engineering, resulting in the target encrypted code, including: Obtaining a preset encrypted character string corresponding to the target encrypted code, and limiting a width of the preset encrypted character string; Randomly selecting a corresponding number of characters from the first encrypted character string based on the limited width of the preset encrypted character string, and obtaining the target encrypted code.
7. A method for anti-decompilation of a scenic spot ticket number, characterized in that, It comprises: Obtaining N computer string sequences, and randomly arranging the N computer string sequences as columns at the arrival of each random period to obtain N columns of computer string sequences after sorting; Initializing a second target radix number through a random function, and obtaining a second encrypted character string according to the second target radix number and the N columns of computer string sequences after sorting; The second encrypted character string is obtained by: Initializing the second target radix number through the random function to obtain the second target radix number; based on the N columns of computer string sequences after sorting, the characters are selected one by one from the first character of the first column, and when the number of characters in the first column is less than the second target radix number, the characters are selected one by one from the subsequent columns in turn, until the selected characters meet the second target radix number, and the second encrypted character string is obtained; Receiving a sample ticket number, and using the second encrypted character string to prevent anti-decompilation encryption of the sample ticket number to obtain a sample encrypted code, and recording the encryption speed of the sample ticket number; Based on the sample encrypted code, a sample code corresponding to the sample ticket number is generated, and an anti-decompilation attack is performed on the sample code to obtain an anti-decompilation attack effect; Based on the encryption speed corresponding to the sample encrypted code and the anti-decompilation attack effect, an encryption effect corresponding to the second target radix number is obtained; Different second target radix numbers are initialized through the random function multiple times, and the final target radix number is determined according to the encryption effects of all the second target radix numbers; According to the final target radix number and the N columns of computer string sequences after sorting, a third encrypted character string is obtained; the way of obtaining the third encrypted character string is the same as that of obtaining the second encrypted character string; Receiving an original ticket number generation instruction, and generating a target original ticket number according to the original ticket number generation instruction and a preset ticket number generation rule; Using the third encrypted character string to prevent anti-decompilation encryption of the target original ticket number to obtain a target encrypted code, generating a target code corresponding to the target original ticket number based on the target encrypted code, and realizing anti-decompilation of the scenic spot ticket number; The target code includes a two-dimensional code and / or a bar code.
8. The anti-decompilation method for scenic spot ticket ticket number according to claim 7, characterized in that, Determining the final target radix number according to the encryption effects of all the second target radix numbers comprises: Based on the anti-decompilation attack effect, a plurality of second target radix numbers with the best anti-decompilation effect are determined; From the plurality of determined second target radix numbers, a second target radix number with the fastest encryption speed corresponding to the sample encrypted code is determined to obtain the final target radix number.
9. A method for anti-decompilation of a scenic spot ticket number, characterized in that, It comprises: Obtaining N computer string sequences, and randomly arranging the N computer string sequences as columns at the arrival of each random period to obtain N columns of computer string sequences after sorting; Initializing a third target radix number through a random function, and obtaining a fourth encrypted character string according to the third target radix number and the N columns of computer string sequences after sorting; The fourth encrypted string includes: The fourth target number of the target base is initialized by a random function, and the fourth target number of the target base is obtained; based on the sequence of the N columns of the computer string after sorting, the characters are selected one by one from the first character in the first column, and when the number of characters in the first column is less than the fourth target number of the target base, the characters are selected one by one from the subsequent columns in turn, until the selected characters meet the fourth target number of the target base, and the fourth encrypted string is obtained; The original ticket number generation instruction is accepted, and the target original ticket number is generated according to the original ticket number generation instruction and the preset ticket number generation rule; The fourth encrypted string is used for anti-decompilation encryption of the target original ticket number, and the target encrypted code is obtained, and the encryption speed of the anti-decompilation encryption of the target original ticket number is recorded; The target code corresponding to the target original ticket number is generated based on the target encrypted code, and the anti-decompilation of the scenic spot ticket number is realized; and the anti-decompilation attack effect is obtained by anti-decompiling the target code corresponding to the target original ticket number; The encryption effect corresponding to the third target base is obtained based on the encryption speed corresponding to the target encrypted code and the anti-decompilation attack effect; The third target base is changed every preset transformation period, and the changed third target base is not repeated with the previous third target base, and the encryption effect corresponding to each third target base is obtained; Until the execution number of the preset transformation period reaches a specified number, the final target base is obtained according to the encryption effect corresponding to each third target base, and the final target base is used for encryption in the subsequent anti-decompilation encryption process, so as to realize the anti-decompilation of the scenic spot ticket number; The target code includes a two-dimensional code and / or a bar code.
Citation Information
Patent Citations
Product key generation method and device, electronic equipment and storage medium
CN113448542A
Selective Data Encryption and Decryption Method and Apparatus
US20120134490A1