A method for generating short links, a computer device, and a readable storage medium

By performing N-digit conversion and key perturbation on the long integer identifier, a safe and efficient short link is generated, which solves the performance problems of poor security and high concurrent requests in the prior art, and realizes a scalable solution suitable for large-scale information propagation.

CN119995884BActive Publication Date: 2025-06-20SHENZHEN HUOLI TIAN HUI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510458102.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-06-20
Estimated Expiration
2045-04-14

AI Technical Summary

Technical Problem

The existing short link generation methods have poor security, are prone to cracking and tampering, and are prone to duplication and slow response under high concurrent requests, which cannot meet the needs of large-scale information dissemination.

Method used

By obtaining the long integer identifier, it is converted into an N-digit initial string based on the preset N-digit initial character set, and an encrypted string is generated using key perturbation and multi-dimensional mapping, which is finally spliced ​​into a short link with the domain name, symbol and target key characters.

Benefits of technology

It realizes safe, efficient and scalable short link generation, reduces short link length, improves storage and transmission efficiency, enhances data security, and supports high and generation, suitable for large-scale business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119995884B_ABST
    Figure CN119995884B_ABST
Patent Text Reader

Abstract

The present application relates to a method for generating short links, a computer device, and a readable storage medium, and relates to the field of Internet information technology. The method includes: obtaining a long integer identifier; converting the long integer identifier into an N-base initial string based on an N-base initial character set; determining a target key character in the key string according to the long integer identifier and the key string; determining an offset value according to the target key character and the N-base initial character set; determining an N-base offset string according to the offset value, the N-base initial character set, and the N-base initial string; determining an encrypted string according to the N-base offset string, a random string, and the key string; and splicing a domain name, a short link symbol, the encrypted string, and the target key character into a short link. Compared with the traditional method of directly mapping short links with database IDs, the technical solution of the present application provides stronger security, scalability, and anti-collision capabilities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet information technology, and particularly to a method for generating short links, a computer device, and a readable storage medium. Background Art

[0002] With the development of the digital age, more and more problems have emerged with long links, such as being overly long in characters, occupying too much display space, being difficult to fully present on platforms with limited character length, and being prone to errors when manually input by users, which may lead to the inability to access the input long link properly, seriously affecting the information dissemination efficiency and user experience.

[0003] In practical applications, to improve the mapping efficiency and facilitate the generation and management of long links, the system usually assigns a unique long integer identifier to each long link. The current common method for generating short links is to perform a hash process on the long link to obtain a short link, and then establish a corresponding relationship between the short link and the long integer identifier. However, the short links generated in this way have poor security, are easily cracked and tampered with, which may lead to the leakage of user information or being redirected to malicious websites. At the same time, under high-concurrency requests, problems such as duplicate short links generated and slow response are likely to occur, unable to meet the needs of large-scale information dissemination.

[0004] Therefore, there is an urgent need for a secure and efficient method for generating short links. Summary of the Invention

[0005] Based on this, in view of the above technical problems, it is necessary to provide a method for generating short links, a computer device, and a readable storage medium.

[0006] In a first aspect, a method for generating short links is provided, and the method includes:

[0007] Obtain a long integer identifier;

[0008] Based on a preset N-base initial character set, convert the long integer identifier into an N-base initial string;

[0009] Determine a target key character in the key string according to the long integer identifier and a preset key string;

[0010] Determine an offset value according to the target key character and the N-base initial character set;

[0011] Determine an N-base offset string according to the offset value, the N-base initial character set, and the N-base initial string;

[0012] Determine an encrypted string according to the N-base offset string, a preset random string, and the key string;

[0013] Concatenate the preset domain name, short link symbol, the encrypted string, and the target key character into a short link.

[0014] As an optional implementation, the long integer identifier is an auto-incrementing primary key in the database or a user ID.

[0015] As an optional implementation, determining the target key character in the key string according to the long integer identifier and a preset key string includes:

[0016] Take the modulus of the long integer identifier with respect to the length of the key string to determine the first key index;

[0017] Extract the first target character corresponding to the first key index from the key string, and determine the first target character as the target key character.

[0018] As an optional implementation, determining the offset value according to the target key character and the N-ary initial character set includes:

[0019] Based on the N-ary initial character set, convert the target key character into a long integer value;

[0020] Determine the long integer value as the offset value.

[0021] As an optional implementation, determining the N-ary offset string according to the offset value, the N-ary initial character set, and the N-ary initial string includes:

[0022] Perform dynamic circular shifting on the N-ary initial character set according to the offset value to generate an N-ary offset character set;

[0023] Replace the characters in the N-ary initial string according to the N-ary offset character set to determine the N-ary offset string.

[0024] As an optional implementation, the formula for performing dynamic circular shifting on the N-ary initial character set according to the offset value is:

[0025] ;

[0026] where i is the position serial number of the character a i in the N-ary initial character set, is the offset value, k is the length of the N-ary initial character set, and j is the position serial number of the character a i after shifting in the N-ary initial character set.

[0027] As an alternative implementation, determining the encrypted string according to the N - ary offset string, the preset random string, and the key string includes:

[0028] Convert the character at the first preset position in the N - ary offset string into an integer and take the modulus of the length of the random string to obtain a second key index;

[0029] Extract the second target character corresponding to the second key index from the key string and add the second target character to the second preset position in the N - ary offset string to obtain the encrypted string.

[0030] As an alternative implementation, both the key string and the random string are strings with non - repeating characters.

[0031] In a second aspect, a computer device is provided, including a memory and a processor. A computer program that can run on the processor is stored on the memory. When the processor executes the computer program, the method steps described in any item of the first aspect are implemented.

[0032] In a third aspect, a computer - readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method steps described in any item of the first aspect are implemented.

[0033] The present application provides a method for generating short links, and the method includes: obtaining a long integer identifier; converting the long integer identifier into an N - ary initial string based on a preset N - ary initial character set; determining a target key character in the key string according to the long integer identifier and a preset key string; determining an offset value according to the target key character and the N - ary initial character set; determining an N - ary offset string according to the offset value, the N - ary initial character set and the N - ary initial string; determining an encrypted string according to the N - ary offset string, a preset random string and the key string; and concatenating a preset domain name, a short link symbol, the encrypted string and the target key character into a short link. The technical solutions provided by the embodiments of the present application at least bring the following beneficial effects: By means of efficient base conversion, key perturbation, multi - dimensional mapping and short link optimization, a safe, efficient and scalable method for generating short links is provided, with the following beneficial effects: reducing the length of short links and improving storage and transmission efficiency; preventing the exposure of ID increment and enhancing data security; adopting key perturbation to improve the unpredictability of short links; supporting high - concurrent generation, preventing conflicts and being applicable to large - scale business scenarios; being compatible with different encryption modes and adapting to various scenarios such as short URLs, invitation codes, resource identifiers, etc.; having a standardized short link format and being compatible with multiple terminals and access methods. The technical solutions of the present application provide stronger security, scalability and anti - conflict ability compared with the traditional method of directly mapping database IDs to short links, and are applicable to various short link requirement scenarios with high security and high concurrency.

[0034] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings without creative efforts based on these drawings.

[0036] Figure 1 It is a flowchart of a method for generating short links provided by an embodiment of the present application;

[0037] Figure 2 It is a flowchart of a method for determining a target key character provided by an embodiment of the present application;

[0038] Figure 3 It is a flowchart of a method for determining an offset value provided by an embodiment of the present application;

[0039] Figure 4Flowchart of a method for determining an N - ary offset string provided by an embodiment of the present application;

[0040] Figure 5 Flowchart of a method for determining an encrypted string provided by an embodiment of the present application;

[0041] Figure 6 Flowchart of an example of a method for generating a short link provided by an embodiment of the present application;

[0042] Figure 7 Schematic structural diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners

[0043] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0044] Next, a method for generating a short link provided by an embodiment of the present application will be described in detail in combination with the specific implementation manners. Figure 1 Flowchart of a method for generating a short link provided by an embodiment of the present application, as Figure 1 shown, the specific steps are as follows:

[0045] Step S101, obtain a long - integer identifier.

[0046] In implementation, the long - integer identifier can be an auto - incrementing primary key of a database, or a unique identifier such as a user ID or an order number. For example, the long - integer identifier can be set to 123456789.

[0047] As an alternative implementation manner, the long - integer identifier is an auto - incrementing primary key in the database or a user ID.

[0048] Step S102, based on a preset N - ary initial character set, convert the long - integer identifier into an N - ary initial string.

[0049] In implementation, the computer can start iteration based on a preset N - ary initial character set. Each time, it calculates the remainder when the value corresponding to the long - integer identifier is modulo - divided by the N - ary radix. This remainder corresponds to the subscript of a character in the N - ary initial character set, that is, the serial number of the character, and the serial number can start from 0. After indexing to this character, it can be added to the front of the current string. Then, the value corresponding to the long - integer identifier is divided by the N - ary radix and rounded down to update the value corresponding to the long - integer identifier. Repeat this process until the value corresponding to the long - integer identifier becomes 0, and the finally obtained string is the converted N - ary initial string. The N - ary character set can adopt a 62 - ary character set, such as: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW

[0050] XYZ. The long - integer identifier can be continuously modulo - divided and divided, and the remainders are mapped to the 62 - ary character set and arranged in reverse order. For example: converting 123456789 to 62 - ary, we can calculate 123456789÷62 = 1991238, the remainder is 33, and the character corresponding to 33 in the N - ary character set (62 - ary character set) is x. Then calculate 1991238÷62 = 32116, the remainder is 6, and the character corresponding to 6 in the N - ary character set is 6. Continue to calculate 32116÷62 = 518, the remainder is 0, and the character corresponding to 0 in the N - ary character set is 0. Continue to calculate 518÷62 = 8, the remainder is 22, and the character corresponding to 22 in the N - ary character set is m. Finally, calculate 8÷62 = 0, the remainder is 8, and the character corresponding to 8 in the N - ary character set is 8. The characters indexed during the overall calculation process can be arranged in reverse order to obtain the N - ary initial string as 8m0x6.

[0051] Step S103: Determine the target key character in the key string according to the long - integer identifier and the preset key string.

[0052] In implementation, the computer can determine the target key character in the key string according to the long - integer identifier and the preset key string.

[0053] As an alternative implementation Figure 2 is a flowchart of a method for determining a target key character provided by an embodiment of the present application. As Figure 2 shown, the specific steps for determining the target key character in the key string according to the long - integer identifier and the preset key string in step S103 are as follows:

[0054] Step S201: Modulo - divide the long - integer identifier by the length of the key string to determine the first key index.

[0055] In implementation, since the length of the key string is limited (e.g., 62 characters), while the long integer identifier can be a very large number, possibly far exceeding the index range of the key string. By taking the modulus of the length of the key string, the long integer identifier can be mapped within the index range of the key string. For example, the long integer identifier is 123456789, and the preset key string can be x1y2z3a4b5c6d7e8

[0056] f9g0hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ, the key length is 62, the first key index = 123456789 mod 62 = 39.

[0057] Step S202, extract the first target character corresponding to the first key index from the key string, and determine the first target character as the target key character.

[0058] In implementation, the first key index is an index position in the key string. Extract the character corresponding to this index from the key string as the target key character. This character will be used for encryption mapping and short link splicing in subsequent steps. Taking the first key index as 39 as an example, the character at index 39 in the key string is the target key character. For example, in the embodiment of step S202, the character at index 39 in the key string is n.

[0059] Step S104, determine the offset value according to the target key character and the N - ary initial character set.

[0060] In implementation, the offset value can be used for encryption processing. The computer can determine the offset value according to the target key character and the N - ary initial character set.

[0061] As an alternative implementation manner, Figure 3 is a flowchart of a method for determining the offset value provided by the embodiment of the present application. As Figure 3 shown, the specific steps for determining the offset value according to the target key character and the N - ary initial character set in step S104 are as follows:

[0062] Step S301, convert the target key character into a long integer value based on the N - ary initial character set.

[0063] In implementation, the computer can find the index of the target key character in the N - ary initial character set, and multiply this index by the base N of the N - ary initial character set. If it is the target key string, then for the i - th character S i , find its index index(S i ) in the N - ary initial character set, and calculate index(Si ) The product with N i is calculated and added to the result. After traversing the entire target key string, the accumulated result obtained is the converted long integer value. If a character in the target key string is not found in the N - ary initial character set, it is determined as an illegal character, and the computer can throw a corresponding exception. For example: If the target key character is n and its index in the 62 - ary character set 012345

[0064] 6789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ is 23, then the long integer value after conversion of the target key character n = 23×62 0 = 23.

[0065] Step S302: Determine the offset value as the long integer value.

[0066] In implementation, the computer can determine the long integer value after conversion of the target key character as the offset value.

[0067] Step S105: Determine the N - ary offset string according to the offset value, the N - ary initial character set, and the N - ary initial string.

[0068] In implementation, the computer can determine the N - ary offset string according to the offset value, the N - ary initial character set, and the N - ary initial string.

[0069] As an alternative implementation manner, Figure 4 is a flowchart of a method for determining an N - ary offset string provided by an embodiment of the present application. As Figure 4 shown, the specific steps for determining the N - ary offset string according to the offset value, the N - ary initial character set, and the N - ary initial string in step S105 are as follows:

[0070] Step S401: Dynamically cyclically shift the N - ary initial character set according to the offset value to generate an N - ary offset character set.

[0071] In implementation, a dynamic cyclic shift method can be used to shift the N - ary initial character set to ensure that the character mapping changes and improve the encryption strength. The shift method can be a left shift or a right shift. For example: The N - ary initial character set 0123456789abcdefghijklmnopqrstuvwxyzABCDEFG

[0072] HIJKLMNOPQRSTUVWXYZ, shifted 23 positions to the right, that is, moving the first 23 characters to the end, to obtain the N - base offset character set FGHIJKLMNOPQRSTUVWXYZ0123456789abcde

[0073] fghijklmnopqrstuvwxyzABCDE. The N - base offset character set can be used for character replacement to ensure the unpredictability of short links.

[0074] Step S402: Replace the characters in the N - base initial string according to the N - base offset character set to determine the N - base offset string.

[0075] In implementation, the computer can replace each character in the N - base initial string (generated in step S102) with a new character according to the character mapping rule. The index of each character in the N - base initial string in the N - base initial character set can be found. Replace it with the character at the same index position in the N - base offset string. For example: The N - base initial string (calculated in step S102) is 8m0x6. Replace character by character. Table 1 is a character offset comparison table provided by an embodiment of the present application, as shown in Table 1:

[0076] Table 1

[0077] Characters before replacement Index in the initial character set Index in the offset character set Characters after replacement 8 8 8 Q m 22 22 1 0 0 0 F x 33 33 n 6 6 6 M

[0078] That is, the N - base offset string is Q1FnM. The N - base offset string, as the basis of the encrypted string, can enhance security.

[0079] As an optional implementation manner, the formula for dynamically circularly shifting the N - base initial character set according to the offset value in step S401 is:

[0080] .

[0081] Where i is the position serial number of the character S in the N - base initial character set i of, is the offset value, k is the length of the N - base initial character set, and j is the position serial number of the character S i in the N - base initial character set after shifting.

[0082] Step S106: Determine the encrypted string according to the N - base offset string, the preset random string, and the key string.

[0083] In implementation, the computer can determine the encrypted string according to the N - base offset string, the preset random string, and the key string.

[0084] As an alternative implementation, Figure 5 is a flowchart of a method for determining an encrypted string provided by an embodiment of the present application. As Figure 5 shown, the specific steps for determining the encrypted string according to the N - ary offset string, the preset random string, and the key string in step S106 are as follows:

[0085] Step S501, convert the character at the first preset position in the N - ary offset string into an integer and take the modulus of the length of the random string to obtain a second key index.

[0086] In implementation, the first preset position (such as the first position of the string) can be preset in advance. Convert the character at the first preset position in the N - ary offset string into an integer, and then perform a modulo calculation, calculating the integer value mod the length of the preset random string to ensure that the index does not exceed the range of the random string. For example: The N - ary offset string can be Q1FnM generated in step S105. Set the first preset position as the first character Q. The N - ary character set is 0123456789abcdefghijklmnopqrstuvwxyzABCDE

[0087] FGHIJKLMNOPQRSTUVWXYZ, Q belongs to the uppercase letter part (A~Z). The index of A = 36 (counting from 0). Q is the 17th letter in the uppercase letters, and the index of Q = 36+(17 - 1)=42. For the preset random string, such as abc123XYZ, with a length of 9, calculate the second key index = 42 mod 9 = 6.

[0088] Step S502, take out the second target character corresponding to the second key index from the key string, and add the second target character to the second preset position in the N - ary offset string to obtain the encrypted string.

[0089] In implementation, the computer can use the second key index to find the second target character in the key string, and then insert the character at a specific position in the N - ary offset string. For example, set the second preset position (such as the front, middle, or end of the string) to increase the complexity of the short link and make it more difficult to be speculated. For example: The key string is x1y2z3a4b5c6d7e8f9g0hijklmnopqrstuvwxyzABCD

[0090] EFGHIJKLMNOPQRSTUVWXYZ, the second key index = 6, the character corresponding to index 6 in the key string is a (index starting from 0). Set the second preset position to before the N - ary offset string. The N - ary offset string is Q1FnM, and the encrypted string after inserting the second target character a is aQ1FnM.

[0091] As an alternative implementation, both the key string and the random string are strings with non-repeating characters.

[0092] Step S107: Concatenate the preset domain name, short link symbol, encrypted string, and target key character into a short link.

[0093] In implementation, the computer can concatenate the preset domain name, short link symbol, encrypted string, and target key character into a short link. The preset short link format can be domain name + " / " + encrypted string + target key character. For example: if the preset domain name is WebsiteA, the encrypted string is aQ1FnM, and the target key character is n, then the short link generated by the computer is WebsiteA / aQ1FnMn.

[0094] As an alternative implementation, Figure 6 is a flowchart of an example of a short link generation method provided by an embodiment of the present application. As Figure 6 shown, the specific steps are as follows:

[0095] Step S601: Obtain a long integer identifier ID, where the long integer identifier is a natural self-incrementing digital sequence without repeating characters.

[0096] Step S602: Based on the preset N-ary initial character set S, convert the long integer identifier ID into an N-ary initial string SN.

[0097] Step S603: Take the modulus of the long integer identifier ID with the length of the preset key string K to determine the first key index Y.

[0098] Step S604: Extract the first target character corresponding to the first key index Y from the key string K, and determine the first target character as the target key character X.

[0099] Step S605: Based on the N-ary initial character set S, convert the target key character X into a long integer value C.

[0100] Step S606: Determine the long integer value C as the offset value .

[0101] Step S607: Dynamically circularly shift the N-ary initial character set S according to the offset value to generate an N-ary offset character set S'.

[0102] Step S608: Replace the characters in the N-ary initial string SN according to the N-ary offset character set S' to determine an N-ary offset string SN'.

[0103] Step S609: Convert the character at the first preset position in the N - ary offset string SN' into an integer, and then take the modulus of the length of the preset random string R to obtain the second key index Ω.

[0104] Step S610: Extract the second target character K corresponding to the second key index Ω from the key string K Ω and add the second target character K Ω to the second preset position in the N - ary offset string SN' to obtain the encrypted string SN''.

[0105] Step S611: Concatenate the preset domain name, short - link symbol, encrypted string SN'', and target key character X to form a short link.

[0106] The embodiments of the present application provide a method for generating a short link. The method includes: obtaining a long - integer identifier; converting the long - integer identifier into an N - ary initial string based on a preset N - ary initial character set; determining a target key character in the key string according to the long - integer identifier and the preset key string; determining an offset value according to the target key character and the N - ary initial character set; determining an N - ary offset string according to the offset value, the N - ary initial character set, and the N - ary initial string; determining an encrypted string according to the N - ary offset string, the preset random string, and the key string; and concatenating the preset domain name, short - link symbol, encrypted string, and target key character to form a short link. The embodiments of the present application provide an efficient, secure, and controllable method for generating short links through long - integer identifier conversion, encryption processing, and short - link generation. Through high - radix character set mapping, the length of the long - integer identifier can be shortened, improving storage and transmission efficiency. In addition, since directly using the database ID as the short link is easy to be guessed and traversed, and this solution makes the generated short link irregular through radix conversion and key perturbation. Even if an attacker obtains some short links, they cannot reverse - deduce the original long - integer identifier, protecting the database structure. The modulo operation based on the long - integer identifier and the key string makes each short link have the characteristic of dynamic change. Calculating the offset number according to the target key character ensures that the short links of the same long - integer identifier are different under different key conditions. Dynamically circularly shifting the N - ary initial character set makes the mapping relationship change with the key string. Technical personnel can replace the key to ensure that the short - link encryption method is flexible and controllable to meet different security requirements. Embedding the random string and the target key character into the final short link can adjust the random perturbation level to meet different encryption requirements. The technical solution provided by the embodiments of the present application can be applied to short - URL services, invitation code generation, resource unique identification, transaction orders, and logistics order number mapping. The radix, key, and perturbation parameters can be adjusted according to different business requirements, making the solution have good versatility.

[0107] It should be understood that althoughFigures 1 to 6 The steps in the flowchart are shown in sequence according to the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figures 1 to 6 at least some of the steps in Figures 1 to 6 may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least some of the steps or stages in other steps or other steps.

[0108] It can be understood that the same / similar parts among the various embodiments of the above methods in this specification can be referred to each other. Each embodiment focuses on the differences from other embodiments. For the related parts, refer to the descriptions of other method embodiments.

[0109] In one embodiment, a computer device is provided, including a memory and a processor. A computer program that can run on the processor is stored on the memory. When the processor executes the computer program, the method steps of the above dynamic recognition of flight changes are implemented. Figure 7 FIG. is a schematic structural diagram of a computer device provided by an embodiment of the present application. As Figure 7 shown, the computer device may include a processor 701, a system bus 702, a non-volatile storage medium 703, an internal memory 704, a network interface 705, a display screen 706, and an input device 707. Among them, the non-volatile storage medium 703 stores an operating system 7031 and a computer program 7032. The processor 701 is used to execute the computer program 7032 to implement the method steps of the above short link generation. The system bus 702 is used to connect the processor 701, the non-volatile storage medium 703, the internal memory 704, the network interface 705, the display screen 706, and the input device 707 to ensure efficient communication between the components. The internal memory 704 is used to temporarily store the programs and data being run, helping the processor 701 quickly access the required information, thereby improving the overall system performance. The network interface 705 (such as a network card) enables the computer device to connect to a local area network or the Internet to achieve data transmission and remote communication. The display screen 706 is used to present the short link generated by the computer device to the user. The input device 707 (such as a keyboard, mouse, touch screen, etc.) is used to allow the user to input a long integer identifier and a short link generation instruction to the computer device to implement the interactive operation with the computer device.

[0110] In one embodiment, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method for generating a short link are implemented.

[0111] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0112] It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.

[0113] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties.

[0114] Each embodiment in this specification is described in a related manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For the related parts, reference can be made to the partial description of the method embodiment.

[0115] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0116] The above-described embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.

Claims

1. A short link generation method, characterized in that: The method comprises: Get the long integer identifier; Based on a preset N-ary initial character set, convert the long integer identifier into an N-ary initial character string; Determine the target key character in the key string according to the long integer identifier and the preset key string; Determine the offset bit value according to the target key character and the N-ary initial character set; Determine an N-ary offset character string according to the offset bit value, the N-ary initial character set and the N-ary initial character string; Determine an encryption string according to the N-ary offset string, a preset random string and the key string; Concatenate the preset domain name, the short link symbol, the encrypted string and the target key characters into a short link; The step of determining the target key character in the key string according to the long integer identifier and the preset key string includes: Taking the long integer identifier modulo the length of the key character string to determine a first key index; Taking out a first target character corresponding to the first key index from the key character string, and determining the first target character as the target key character; The step of determining the offset bit value according to the target key character and the N-ary initial character set includes: Based on the N-ary initial character set, converting the target key character into a long integer value; Determine the long integer value as the offset bit value; The step of determining the N-ary offset character string according to the offset bit value, the N-ary initial character set, and the N-ary initial character string includes: Dynamically cyclically shifting the N-ary initial character set according to the offset bit value to generate an N-ary offset character set; Replacing characters in the N-ary initial character string according to the N-ary offset character set to determine an N-ary offset character string; The step of determining an encryption string according to the N-ary offset string, a preset random string, and the key string includes: Convert the character located at the first preset position in the N-ary offset string to an integer and then perform modulo operation on the length of the random string to obtain a second key index; A second target character corresponding to the second key index is taken out from the key character string, and the second target character is added to a second preset position in the N-ary offset character string to obtain the encrypted character string.

2. The method according to claim 1, characterized in that The long integer identifier is a self-incrementing primary key or a user ID in the database.

3. The method according to claim 1, characterized in that The formula for dynamically cyclically shifting the N-ary initial character set according to the offset bit value is: ; Among them, i is the character a in the N-base initial character set i ∆ is the position number, k is the length of the N-ary initial character set, and j is the character a in the N-ary initial character set. i The position number after shifting.

4. The method according to claim 1, characterized in that: The key character string and the random character string are both character strings with no repeated characters.

5. A computer device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Short link generation method and system, short link analysis method and system, equipment and storage medium

    CN114039801A

  • Short link generation method and device, equipment and medium

    CN115203600A