A short link generation method and device

By generating random codes and encrypting them, and combining them with checksums to generate target short links, the problem of predictable short links in existing technologies is solved, thus improving security and reliability.

CN123138530APending Publication Date: 2026-11-20BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510614877.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In existing methods for generating short links, those generated using auto-incrementing identifiers or timestamps are easily predictable by third parties, leading to reduced security.

Method used

By obtaining a unique identifier, generating a random code and encrypting it, a checksum is obtained. The random code and checksum are combined to generate the target short link. A hash function or symmetric encryption algorithm is used to improve the unpredictability of the random code.

Benefits of technology

It improves the randomness and security of short links, preventing malicious attackers from predicting short links through brute force or enumeration, and enhances the security and reliability of target short links.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123138530A_ABST
    Figure CN123138530A_ABST
Patent Text Reader

Abstract

The short link generation method and device are provided, and the method comprises the following steps: obtaining a unique identification code corresponding to a received original long link; determining a random code corresponding to the original long link based on the unique identification code; performing encryption processing on the random code to obtain a check code corresponding to the random code; and generating a target short link based on the random code, the check code and the original long link. The embodiment can improve the randomness of generating the short link, thereby improving the security of the target short link.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to a method and apparatus for generating short links. Background Technology

[0002] As e-commerce competition intensifies, traffic acquisition and conversion have become crucial. Promoting through short links can quickly help platforms acquire traffic and improve conversion rates. However, existing short link generation methods typically use auto-incrementing identifiers or timestamps. Since auto-incrementing numeric strings and timestamps are consecutive numbers, in practice, the specific content of the generated short links can be easily predicted by third parties, thus reducing the security of the target short links. Summary of the Invention

[0003] In view of this, the present disclosure provides at least one method, apparatus, electronic device, and storage medium for generating short links, which can improve the randomness of generating short links and thus improve the security of the target short links.

[0004] In a first aspect, embodiments of this disclosure provide a method for generating short links, including:

[0005] Obtain the unique identifier corresponding to the received original long link;

[0006] Based on the unique identifier, determine the random code corresponding to the original long link; encrypt the random code to obtain the check code corresponding to the random code;

[0007] The target short link is generated based on random encoding, checksum, and the original long link.

[0008] Optionally, based on the unique identifier, a random code corresponding to the original long link is determined, including:

[0009] The unique identifier is converted to a different number system to obtain the target number of digits in the number system corresponding to the unique identifier; where the target number of digits is preset; and the unique identifier is a decimal number string.

[0010] The target bit base representation corresponding to the unique identifier is used as the random code corresponding to the original long link.

[0011] Optionally, the random code is encrypted to obtain a checksum corresponding to the random code, including:

[0012] The random code is split according to the character dimension to obtain the character at each character position;

[0013] The characters at each position are mapped to decimal values. The decimal values ​​are added together, and the result is moduloed to obtain the check code corresponding to the random code. The check code is represented in the base of the target number.

[0014] Optionally, after generating the target short link, the following may also be included:

[0015] The short link information corresponding to the target short link is saved to the target storage location to verify the target short link based on the short link information; wherein, the short link information in the target storage location uses the concatenation result of random encoding and check code as the key, and the target short link and the original long link as the value.

[0016] Secondly, this disclosure also provides a short link triggering method, including:

[0017] In response to a user triggering the short link to be inspected, the short link to be inspected is verified based on the checksum in the short link to be inspected;

[0018] In response to the short link verification passing, the system queries the long link information corresponding to the check code of the short link in the target storage location and performs redirection based on the long link information.

[0019] Optionally, the short link to be inspected may be validated, including:

[0020] Based on the random code of the short link to be inspected, the check code corresponding to the random code of the short link to be inspected is calculated.

[0021] The checksum in the short link to be inspected is compared with the calculated checksum corresponding to the random code. If the checksum in the short link to be inspected and the calculated checksum corresponding to the random code are consistent, the short link to be inspected is determined to have passed the inspection.

[0022] Thirdly, embodiments of this disclosure provide a short link generation apparatus, including:

[0023] The acquisition module is used to obtain a unique identifier code corresponding to the received original long connection;

[0024] The determination module is used to determine the random code corresponding to the original long link based on the unique identifier; the random code is then encrypted to obtain the check code corresponding to the random code;

[0025] The generation module is used to generate the target short link based on random encoding, checksum, and the original long link.

[0026] Fourthly, embodiments of this disclosure provide a short link triggering device, including:

[0027] The triggering module is used to respond to the user's triggering of the short link to be inspected, and to verify the short link to be inspected based on the check code in the short link to be inspected;

[0028] The redirection module is used to query the long link information corresponding to the target short link in the target storage location in response to the short link verification passing, and to redirect based on the long link information.

[0029] Fifthly, embodiments of this disclosure also provide an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the first aspect or any optional implementation of the first aspect are performed.

[0030] In a sixth aspect, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the first aspect or any optional implementation thereof.

[0031] In a seventh aspect, embodiments of this disclosure also provide a computer program product, including a computer program that, when executed by a processor, implements the methods of any of the above embodiments.

[0032] Any of the above aspects or any implementation of any aspect improves the randomness of short link generation through a multi-layered processing mechanism, thereby enhancing the security of the target short link. First, after receiving the original long link, a unique identifier corresponding to the original long link is randomly obtained, ensuring the uniqueness of the link and the randomness of the identifier. Based on this, a random code is further generated using the unique identifier. The generation process of the random code can incorporate complex algorithms or dynamic parameters to effectively avoid the possibility of duplication or prediction. Subsequently, the random code is encrypted to generate a checksum. The encryption process can employ highly secure encryption algorithms, such as hash functions or symmetric encryption algorithms, to further enhance the unpredictability and anti-cracking capabilities of the random code. Finally, by integrating the random code, checksum, and original long link, the target short link is generated, ensuring that each short link not only uniquely corresponds to the original link but also possesses characteristics that are difficult to predict and forge. This not only improves the randomness of target short link generation but also effectively prevents malicious attackers from predicting short links through brute-force or enumeration methods, thereby improving the security and reliability of the target short link.

[0033] The effects of the aforementioned short link generation device, electronic device, and storage medium are described in the description of the short link generation method above, and will not be repeated here. Attached Figure Description

[0034] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0035] Figure 1 A flowchart of the short link generation method provided in this disclosure embodiment is shown;

[0036] Figure 2 A schematic diagram of the process for obtaining a unique identifier code provided in an embodiment of this disclosure is shown;

[0037] Figure 3 A flowchart illustrating the short link generation method provided in this embodiment of the present disclosure is shown.

[0038] Figure 4 A flowchart illustrating the short link generation triggering provided in an embodiment of this disclosure is shown;

[0039] Figure 5 A flowchart illustrating the process of short link verification failing according to an embodiment of this disclosure is shown;

[0040] Figure 6 A schematic diagram of the process for verifying a short link under test, provided in an embodiment of this disclosure, is shown.

[0041] Figure 7 A schematic diagram of a short link generation apparatus provided in an embodiment of this disclosure is shown;

[0042] Figure 8 A schematic diagram of a short link triggering device provided in an embodiment of this disclosure is shown;

[0043] Figure 9 An exemplary system architecture in which embodiments of this disclosure can be applied is shown;

[0044] Figure 10 A schematic diagram of the structure of a computer system used to implement the embodiments of the present disclosure is shown. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0046] It should be noted that the collection, use, storage, sharing and transfer of user personal information involved in the technical solution of the present invention all comply with the provisions of relevant laws and regulations, and require notification to users and obtaining their consent or authorization. When applicable, user personal information is subjected to de-identification and / or anonymization and / or encryption technical processing.

[0047] The above problems and solutions are the result of the inventor's practice and careful research. The discovery process of the above problems and the solutions proposed for the above problems should be considered as the inventor's contribution to this disclosure.

[0048] The technical solutions of this disclosure will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely to illustrate selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0049] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0050] To facilitate understanding of this embodiment, a short link generation method disclosed in this disclosure will first be described in detail. The execution entity of the short link generation method provided in this disclosure is generally a computer device with certain computing capabilities. This computer device may include, for example, a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. In some possible implementations, this short link generation method can be implemented by a processor calling computer-readable instructions stored in memory.

[0051] See Figure 1 The diagram shows a flowchart of a short link generation method provided in this embodiment of the present disclosure. The method includes steps S101 to S103, wherein:

[0052] S101: Obtain the unique identifier corresponding to the received original long link.

[0053] In this embodiment of the disclosure, the original long link refers to the complete URL (Uniform Resource Locator) address provided by the requester, which typically includes information such as domain name, path, and parameters; for example, https: / / www.example.com / yyy / zzz / aaa / bbb.html. The target short link is a shortened URL generated by transforming the original long link, which typically has a fixed domain name and a shorter path portion; for example, https: / / short / abc123.

[0054] Existing methods for generating short links typically use an auto-incrementing ID (identifier) ​​or timestamp to convert a random code according to preset rules. This random code is then appended to the domain name to obtain the final short link address. When a user requests a short link address, the server uses the random code to retrieve the original long link and redirects the user to that long link address to complete the user's request. However, because both the auto-incrementing ID and the timestamp are consecutive numbers, the generated random code is easily predictable, and malicious attackers can easily predict the next short link address based on the current one, thus reducing the security of the short link address.

[0055] Figure 2 This is a flowchart illustrating the identification code acquisition method provided in an embodiment of this disclosure. Figure 2As shown in this embodiment, n identifiers to be used can be obtained and stored locally at a time, according to the server dimension. Here, n can be a pre-set number. For example, server A can pre-store the 1st to 1000th identifiers, and server B can pre-store the 1001st to 2000th identifiers. Therefore, when a requester initiates a short link generation request, it is not necessary to query the cache or database for the next unique identifier; it is only necessary to randomly obtain one from the locally stored identifiers to be used. This ensures the randomness and unpredictability of the unique identifiers, thereby improving the randomness and reliability of the random code generated based on the unique identifiers, and thus improving the security of the target short link. Furthermore, since several identifiers to be used are pre-stored in the local cache, when multiple short link generation requests are initiated simultaneously by the requester, the corresponding unique identifier for the original long link in each short link generation request can be quickly obtained, improving the concurrency of obtaining unique identifiers and further improving the generation efficiency of the target short link. It should be noted that this disclosure does not specifically limit the generation method and rules for the identifier codes to be used. In practical applications, identifier codes adapted to the current scenario can be generated according to the actual situation, as long as they can achieve their functions. Furthermore, besides storing the first to the 1000th identifier codes locally on server A as described above, a random storage method can also be used. For example, if 10,000 identifier codes to be used have been generated, 1,000 can be randomly selected and stored on server A, instead of storing the first to the 1000th identifier codes locally on server A according to their generation order. The method of storing pre-generated identifier codes locally on the server is only an example of possible implementation methods in this disclosure and does not constitute an improper limitation of the present invention. In practical applications, the corresponding storage method can also be selected according to actual needs and circumstances. This disclosure does not specifically limit this method, as long as its functions can be achieved.

[0056] In specific implementation, such as Figure 2As shown, when the requester initiates a short link generation request, it can retrieve the unique identifier corresponding to the original long link in the short link generation request from the local cache. The success of the retrieval can be determined by whether the unique identifier returned by the local cache is received. If the retrieval is unsuccessful, it means that the local cache does not currently have any identifiers to be used pre-stored. In this case, n identifiers to be used can be retrieved from the database and stored in the local cache, and then the unique identifier corresponding to the original long link can be retrieved again from the local cache. If the retrieval is successful, it can be further determined whether the number of identifiers to be used in the local cache is less than a pre-set threshold m. If it is less than the threshold m, it means that the local cache does not have enough space to store n identifiers to be used. To ensure the efficiency of the target short link generation, an expansion request can be made, and then the unique identifier corresponding to the original long link can be obtained again. If it is greater than or equal to the threshold m, it means that the current storage capacity of the local cache can ensure the efficiency of the target short link generation, so the unique identifier corresponding to the original long link can be directly obtained. It should be noted that the identifier code to be used stored in the local cache can be random. When retrieving the unique identifier code corresponding to the original long link from the local cache, it can be obtained randomly or in the order of storage in the local cache. This embodiment does not make specific limitations on this, as long as the randomness of the unique identifier code can be ensured.

[0057] S102: Based on the unique identifier, determine the random code corresponding to the original long link; encrypt the random code to obtain the check code corresponding to the random code.

[0058] In this embodiment of the disclosure, a unique identifier can be converted into a random code using a number system conversion method. Specifically, determining the random code corresponding to the original long link based on the unique identifier includes: performing a number system conversion on the unique identifier to obtain a target number of digits in the number system corresponding to the unique identifier; wherein the target number of digits is preset; the unique identifier is a decimal number string; and using the target number of digits in the number system corresponding to the unique identifier as the random code corresponding to the original long link.

[0059] Figure 3 This is a flowchart illustrating a short link generation method provided in an embodiment of this disclosure. Figure 3As shown, in a specific implementation, after obtaining the unique identifier code corresponding to the original long link, the unique identifier code can be converted to a different number system. The target number of bits for the conversion can be set according to actual needs, such as hexadecimal, hexadecimal-four, or hexadecimal-eight, etc. This embodiment does not specifically limit this. For example, assuming the unique identifier code corresponding to the original long link is 10000000000, and the preset target number of bits is hexadecimal, then the result of the conversion is 15FTGg. In this case, the conversion result 15FTGg can be used as the random code corresponding to the original long link. It should be noted that the base conversion rules for the same target number of bits can be different. For example, when converting the decimal number 10000000000 to a hexadecimal number, if the conversion rule is to use 0-9 to represent decimal 0 to 9, az to represent decimal 10 to 35, and AZ to represent decimal 36 to 61, the result of the hexadecimal conversion is 15FTGg; while if 0-9 is used to represent decimal 0 to 9, AZ to represent decimal 10 to 35, and az to represent decimal 36 to 61, the result of the hexadecimal conversion is Aukyoa. The above base conversion methods and rules are only illustrative examples of feasible implementation methods in this disclosure and do not constitute an improper limitation of the present invention. In practical applications, corresponding base conversion methods and rules can be set according to actual needs and circumstances. This disclosure does not specifically limit these methods and rules, but aims to achieve the desired functionality.

[0060] In another possible implementation, besides converting the unique identifier to a random code using a number base conversion method, a hash algorithm can be used to encrypt or hash the unique identifier, mapping it to a fixed-length random code. Alternatively, the unique identifier can be rearranged, specific characters inserted, or some characters replaced according to pre-defined rules to generate a corresponding random code. A pseudo-random number generator can also be used to generate a random seed value, which can then be bitwise operated on, encrypted, or concatenated with the unique identifier to generate a corresponding random code. It should be noted that this disclosure does not specifically limit the method for generating random codes based on unique identifiers; in practical applications, the method can be set according to actual needs and circumstances to achieve its function.

[0061] In this embodiment of the disclosure, after obtaining the random code corresponding to the original long link, a corresponding checksum can be obtained based on the random code, so that the target short link can be generated and verified. Specifically, the random code is encrypted to obtain the checksum corresponding to the random code, including: splitting the random code according to the character dimension to obtain the characters at each character position; mapping the characters at each character position to decimal values; adding the decimal values ​​together; and performing a modulo operation on the sum to obtain the checksum corresponding to the random code; wherein the checksum is represented in the target bit base.

[0062] In practice, the random code can be encrypted using a modulo operation. For example, let's take the random code 15FTGg. First, it can be split according to character dimensions to obtain the characters 1, 5, F, T, G, and g at each position. Following the base conversion rules of using 0-9 to represent decimal numbers 0 to 9, az to represent decimal numbers 10 to 35, and AZ to represent decimal numbers 36 to 61, the decimal values ​​corresponding to each character position are added together to obtain 1 + 5 + 41 + 55 + 42 + 16 = 160. Then, a modulo operation can be performed on 160, i.e., the remainder of 160 divided by 62 is 36. According to the previous conversion rules, 36 corresponds to the hexadecimal number A. Therefore, the checksum corresponding to the original long link is A.

[0063] In another possible implementation, besides using the above method to obtain the corresponding check code based on the random code, a hash algorithm can also be used to perform a hash operation on the random code, and a portion of the hash result can be used as the check code. For example, the first 4 bits of the hash result or a specific bit of the hash result can be used as the check code corresponding to the random code. Alternatively, a weight value can be assigned to each character of the random code. For example, for the random code 15FTGg, a weight value of 1-6 can be assigned to each character in sequence, resulting in 1×1+5×2+41×3+55×4+42×5+16×6=844. Then, a hexadecimal modulo operation is performed on 844 to obtain the corresponding check code. It should be noted that the above method for obtaining the check code based on the random code is only used as an example of a feasible implementation in this disclosure and does not constitute an improper limitation of the present invention. In practical applications, the corresponding check code determination method can be set according to actual needs and circumstances. This disclosure does not specifically limit this, but only aims to achieve its function.

[0064] S103: Generate the target short link based on random encoding, checksum, and the original long link.

[0065] In this step, after obtaining the checksum corresponding to the random code, the target short link can be generated based on the random code, the checksum, and the original long link. Specifically, the checksum can be appended to the random code, and the appended result can be appended to the short domain name to obtain the corresponding target short link.

[0066] In this embodiment of the disclosure, after generating the target short link, the method further includes: saving the short link information corresponding to the target short link to the target storage location, so as to verify the target short link based on the short link information; wherein, the short link information in the target storage location uses the concatenation result of random encoding and check code as the key, and the target short link and the original long link as the value.

[0067] In practice, after generating the target short link, the short link information corresponding to the target short link can be saved in the target storage location. Therefore, when a user triggers the target short link, the original long link corresponding to the target short link can be determined from the target storage location, and redirection can be performed based on the original long link. Furthermore, the short link data stored in the target storage location can be used to verify whether the short link triggered by the user is the target short link. For example, suppose the original long link is https: / / www.example.com / yyy / zzz / aaa / bbb.html; and the generated target short link is https: / / www.x.cn / 15FTGgA. When saving the short link information corresponding to the target short link, 15FTGgA can be used as the key, and (https: / / www.x.cn / 15FTGgA, https: / / www.example.com / yyy / zzz / aaa / bbb.html) as the value. It should be noted that the above-mentioned short link information storage format is only used as an example of a feasible implementation method in this disclosure and does not constitute an improper limitation of the present invention. In practical applications, the corresponding storage method can be selected according to actual needs. This disclosure does not make specific limitations in this regard, and the functionality shall prevail.

[0068] See Figure 4 The diagram shows a flowchart of a short link triggering method provided in an embodiment of this disclosure. The method includes steps S401 to S402, wherein:

[0069] S401: In response to a user triggering the short link to be inspected, the short link to be inspected is verified based on the checksum in the short link to be inspected.

[0070] S402: In response to the short link verification passing, query the long link information corresponding to the check code of the short link to be checked in the target storage location, and redirect based on the long link information.

[0071] In this embodiment, when a user triggers a short link to be inspected, the short link can be verified first. In a specific implementation, after generating the short link to be inspected and storing the corresponding short link information in the target storage location, the generated short link address can be returned to the requester who initiated the short link generation request. The requester can then use the generated short link to perform subsequent operations. Since the short link to be inspected includes a random code and a checksum, and the checksum is generated based on the random code, the checksum can be used to verify the short link triggered by the user. In practical applications, even if an attacker predicts the unique identifier and random code corresponding to the original long link, they can still verify it using the checksum corresponding to the random code, further ensuring the link's security. If the verification based on the checksum passes, the corresponding long link information can be queried in the target storage location, and redirection can be performed based on the long link information; if the verification fails, an invalid request warning or other fallback pages can be returned.

[0072] In this embodiment of the disclosure, the verification of the short link to be inspected includes: calculating a check code corresponding to the random code of the short link to be inspected based on the random code of the short link to be inspected; comparing the check code in the short link to be inspected with the calculated check code corresponding to the random code; and determining that the short link to be inspected has passed the verification if the check code in the short link to be inspected and the calculated check code corresponding to the random code are consistent.

[0073] For example, such as Figure 5 As shown, assuming a user triggers the short link to be checked (https: / / www.x.cn / 15FTGgA), the execution entity in this embodiment can obtain the random code and checksum from the short link. Then, according to the rules for generating target short links in the current system, the random code and checksum are separated, and the same operation as when obtaining the checksum based on the random code is performed on the random code, resulting in the checksum A corresponding to the short link. Next, the actual checksum A corresponding to the random code can be retrieved from the target storage location based on the random code. After comparing the checksum A and the actual checksum, they are found to be consistent, and the check passes.

[0074] In another case, exemplarily, such as Figure 6As shown, suppose a user initiates a short link to be checked: https: / / www.x.cn / 15FTGgg. The execution entity in this embodiment obtains the corresponding random code 15FTGg and checksum g; it performs the same operation on the random code as when obtaining the checksum based on the random code, obtaining the checksum A corresponding to the short link to be checked. This checksum A is compared with the checksum g of the current short link to be checked, and they are found to be inconsistent. This indicates that the current short link to be checked has failed the check, and an invalid request or other fallback information can be returned.

[0075] According to a third aspect of the embodiments of this disclosure, such as Figure 7 As shown, a short link generation apparatus 700 is provided, comprising:

[0076] The acquisition module 701 is used to acquire a unique identifier code corresponding to the received original long link;

[0077] The determination module 702 is used to determine the random code corresponding to the original long link based on the unique identifier code; and to encrypt the random code to obtain the check code corresponding to the random code.

[0078] The generation module 703 is used to generate a target short link based on random encoding, checksum, and the original long link.

[0079] Optionally, the determination module 702 is specifically used for:

[0080] The unique identifier is converted to a different number system to obtain the target number of digits in the number system corresponding to the unique identifier; where the target number of digits is preset; and the unique identifier is a decimal number string.

[0081] The target bit base representation corresponding to the unique identifier is used as the random code corresponding to the original long link.

[0082] Optionally, the determination module 702 is specifically used for:

[0083] The random code is split according to the character dimension to obtain the character at each character position;

[0084] The characters at each position are mapped to decimal values. The decimal values ​​are added together, and the result is moduloed to obtain the check code corresponding to the random code. The check code is represented in the base of the target number.

[0085] Optionally, the generation module 703 is also used for:

[0086] The short link information corresponding to the target short link is saved to the target storage location to verify the target short link based on the short link information; wherein, the short link information in the target storage location uses the concatenation result of random encoding and check code as the key, and the target short link and the original long link as the value.

[0087] Optionally, the device further includes a verification module 704; the verification module 704 is specifically used for:

[0088] In response to a user triggering the short link to be checked, the short link to be checked is checked based on the checksum in the short link to be checked; the short link to be checked has the same random code as the target short link.

[0089] In response to the short link verification passing, the short link to be checked is identified as the target short link. The original long link corresponding to the target short link is queried in the target storage location, and redirection is performed based on the original long link.

[0090] Optionally, the verification module 704 is specifically used for:

[0091] Parse the short link to be checked and obtain the random code and check code corresponding to the short link to be checked;

[0092] Based on the random code of the short link to be inspected, the check code corresponding to the random code is calculated;

[0093] The obtained check code corresponding to the short link to be inspected is compared with the calculated check code corresponding to the random code.

[0094] If the obtained checksum corresponding to the short link to be inspected matches the calculated checksum corresponding to the random code, the target short link is determined to have passed the verification.

[0095] According to a fourth aspect of the embodiments of this disclosure, such as Figure 8 As shown, a short link generation device 800 is provided, comprising:

[0096] Trigger module 801 is used to respond to the user triggering the short link to be inspected, and to verify the short link to be inspected based on the check code in the short link to be inspected;

[0097] The redirection module 802 is used to query the long link information corresponding to the target short link in the target storage location in response to the short link verification passing, and to redirect based on the long link information.

[0098] Optionally, the trigger module 801 is specifically used for:

[0099] Based on the random code of the short link to be inspected, the check code corresponding to the random code of the short link to be inspected is calculated.

[0100] The checksum in the short link to be inspected is compared with the calculated checksum corresponding to the random code. If the checksum in the short link to be inspected and the calculated checksum corresponding to the random code are consistent, the short link to be inspected is determined to have passed the inspection.

[0101] According to a fifth aspect of the present disclosure, an electronic device for generating short links is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the present invention.

[0102] According to a sixth aspect of the present disclosure, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect of the present invention.

[0103] According to a seventh aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method of any of the above embodiments.

[0104] Figure 9 An exemplary system architecture 900 is shown that can be applied to the short link generation method or short link generation apparatus implemented in this disclosure.

[0105] like Figure 9 As shown, system architecture 900 may include terminal devices 901, 902, and 903, network 904, and server 905. Network 904 is used as a medium to provide a communication link between terminal devices 901, 902, and 903 and server 905. Network 904 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0106] Users can use terminal devices 901, 902, and 903 to interact with server 905 via network 904 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 901, 902, and 903, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0107] Terminal devices 901, 902, and 903 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0108] Server 905 can be a server providing various services, such as a backend management server supporting shopping websites browsed by users using terminal devices 901, 902, and 903 (for example only). The backend management server can process received short link generation requests and return the processing results (for example only) to the terminal devices.

[0109] It should be noted that the short link generation method provided in this embodiment of the invention is generally executed by server 905, and correspondingly, the short link generation device is generally located in server 905. The short link generation method provided in this embodiment of the invention can also be executed by terminal devices 901, 902, and 903, and correspondingly, the short link generation device can be located in terminal devices 901, 902, and 903.

[0110] It should be understood that Figure 9 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0111] The following is for reference. Figure 10 It shows a schematic diagram of the structure of a computer system 1000 suitable for implementing a terminal device of the present invention. Figure 10 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0112] like Figure 10 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from the storage portion 1000 into a random access memory (RAM) 1003. The RAM 1003 also stores various programs and data required for the operation of the system 1000. The CPU 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0113] The following components are connected to I / O interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to I / O interface 1005 as needed. A removable medium 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 1010 as needed so that computer programs read from it can be installed into storage section 1008 as needed.

[0114] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by central processing unit (CPU) 1001, it performs the functions defined above in the system of this invention.

[0115] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0116] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0117] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor. For example, a processor may include an acquisition module, a determination module, and a generation module. The names of these modules do not necessarily limit the module itself; for example, the acquisition module may be described as "a module for acquiring the unique identifier code corresponding to the received original long link."

[0118] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device implements the following method: obtaining a unique identifier code corresponding to the received original long link; determining a random code corresponding to the original long link based on the unique identifier code; encrypting the random code to obtain a checksum corresponding to the random code; and generating a target short link based on the random code, the checksum, and the original long link.

[0119] Finally, it should be noted that the above embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A method for generating short links, characterized in that, include: Obtain the unique identifier corresponding to the received original long link; Based on the unique identifier, a random code corresponding to the original long link is determined; The random code is encrypted to obtain a check code corresponding to the random code; Based on the random encoding, checksum, and original long link, a target short link is generated.

2. The method according to claim 1, characterized in that, Based on the unique identifier, a random code corresponding to the original long link is determined, including: The unique identifier is converted to a different number system to obtain the target number of digits in the number system corresponding to the unique identifier; wherein the target number of digits is predetermined; and the unique identifier is a decimal number string. The target bit base representation corresponding to the unique identifier is used as the random code corresponding to the original long link.

3. The method according to claim 1, characterized in that, The random code is encrypted to obtain a checksum corresponding to the random code, including: The random code is split according to the character dimension to obtain the character at each character position; The characters at each position are mapped to decimal values, the decimal values ​​are added together, and the result is modulo-calculated to obtain the check code corresponding to the random code; wherein the check code is represented in the target bit base.

4. The method according to claim 1, characterized in that, After generating the target short link, the following is also included: The short link information corresponding to the target short link is saved to the target storage location to verify the target short link based on the short link information; wherein, the short link information in the target storage location uses the concatenation result of the random code and the check code as the key, and the target short link and the original long link as the value.

5. A method for triggering short links, characterized in that, include: In response to a user triggering a short link to be inspected, the short link to be inspected is verified based on the verification code in the short link to be inspected; The short link to be inspected is obtained based on any one of the methods in claims 1-4; In response to the short link under test passing the verification, the long link information corresponding to the verification code of the short link under test is queried in the target storage location, and redirection is performed based on the long link information.

6. The method according to claim 5, characterized in that, The verification of the short link to be inspected includes: Based on the random code of the short link to be inspected, a check code corresponding to the random code of the short link to be inspected is calculated. The checksum in the short link to be inspected is compared with the calculated checksum corresponding to the random code. If the checksum in the short link to be inspected and the calculated checksum corresponding to the random code are consistent, the short link to be inspected is determined to have passed the inspection.

7. A short link generation device, characterized in that, include: The acquisition module is used to obtain a unique identifier code corresponding to the received original long connection; The determination module is used to determine a random code corresponding to the original long link based on the unique identifier. The random code is encrypted to obtain a check code corresponding to the random code; The generation module is used to generate the target short link based on the random encoding, checksum, and original long link.

8. A short-link triggering device, characterized in that, include: The triggering module is used to respond to the user triggering the short link to be inspected, and to verify the short link to be inspected based on the check code in the short link to be inspected; The short link to be inspected is obtained based on any one of the methods in claims 1-4; The redirection module is used to respond to the short link under test passing the verification, query the long link information corresponding to the target short link in the target storage location, and redirect based on the long link information.

9. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.

10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.

11. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.