A short link generation method, device, equipment and medium

By generating an offset of the identifier string and combining it with the short link using a mapping relationship, the problem of short links being easily cracked is solved, thus improving the security and uniqueness of the link.

CN115203600BActive Publication Date: 2026-03-27ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-25
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing methods for generating short links are easily reverse engineered, resulting in insufficient security for the original links.

Method used

By generating an offset for the identifier string and combining it with the identifier string, the system utilizes the first and second mapping relationships to convert the string into a short link, thus increasing the difficulty of cracking the code.

Benefits of technology

It improves the security of shortened links, enhances the protection of original links, and reduces the risk of reverse engineering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115203600B_ABST
    Figure CN115203600B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification disclose a short link generation method, device, equipment and medium. The scheme comprises: obtaining a to-be-processed link; generating an identification string corresponding to the to-be-processed link based on the to-be-processed link; determining an offset corresponding to the identification string according to a first mapping relationship; combining the identification string and the offset to obtain integrated data corresponding to the to-be-processed link based on the identification string and the offset; and converting the integrated data into a short link corresponding to the to-be-processed link according to a second mapping relationship.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and particularly relates to a short link generation method and device, equipment and medium. BACKGROUND

[0002] With the development of information technology, more and more users interact information through the Internet, and the situation that users share or obtain page information through page links is more and more common. However, the character length of the traditional page link is too long, which is not convenient for sharing and spreading. In view of this problem, a short link is usually used to solve the problem of long reference link occupying effective characters. At present, in the prior art, the original long link is converted into a shorter string through a conversion system, and then the characters in the shorter string are mapped to different letters according to a commonly used letter mapping table, and finally a short link code is generated. The short link obtained by this method is easy to be reverse cracked.

[0003] Therefore, how to effectively reduce the situation that the short link is reverse cracked is a technical problem to be solved. SUMMARY

[0004] The embodiments of the present specification provide a short link generation method, device, equipment and medium to solve the problem that the existing short link generation method is easy to be reverse cracked.

[0005] To solve the above technical problems, the embodiments of the present specification are implemented as follows:

[0006] The short link generation method provided by the embodiments of the present specification comprises:

[0007] obtaining a to-be-processed link;

[0008] generating an identification string corresponding to the to-be-processed link based on the to-be-processed link;

[0009] determining an offset corresponding to the identification string according to a first mapping relationship;

[0010] combining the identification string and the offset to obtain integrated data corresponding to the to-be-processed link based on the identification string and the offset; the integrated data at least contains the identification string and the offset;

[0011] converting the integrated data into a short link corresponding to the to-be-processed link according to a second mapping relationship.

[0012] The short link generation device provided by the embodiments of the present specification comprises:

[0013] a link obtaining module configured to obtain a to-be-processed link;

[0014] An identifier generation module is configured to generate an identifier string corresponding to the to-be-processed link based on the to-be-processed link.

[0015] An offset determination module is configured to determine an offset corresponding to the identifier string according to a first mapping relationship.

[0016] A data integration module is configured to combine the identifier string and the offset to obtain integrated data corresponding to the to-be-processed link based on the identifier string and the offset; the integrated data at least includes the identifier string and the offset.

[0017] A short link generation module is configured to convert the integrated data into a short link corresponding to the to-be-processed link according to a second mapping relationship.

[0018] An embodiment of the present specification provides a short link generation device, comprising:

[0019] at least one processor; and

[0020] a memory in communication connection with the at least one processor; wherein

[0021] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:

[0022] obtain a to-be-processed link;

[0023] generate an identifier string corresponding to the to-be-processed link based on the to-be-processed link;

[0024] determine an offset corresponding to the identifier string according to a first mapping relationship;

[0025] combine the identifier string and the offset to obtain integrated data corresponding to the to-be-processed link based on the identifier string and the offset; the integrated data at least includes the identifier string and the offset;

[0026] convert the integrated data into a short link corresponding to the to-be-processed link according to a second mapping relationship.

[0027] An embodiment of the present specification provides a computer readable medium having computer readable instructions stored thereon, and the computer readable instructions are executable by a processor to implement a short link generation method.

[0028] An embodiment of the present specification can achieve the following beneficial effects:

[0029] In the embodiments of the present specification, the offset of the identification string corresponding to the to-be-processed link can be determined according to the first mapping relationship, the offset obtained and the to-be-processed link are combined to obtain integrated data, and the integrated data is converted into the short link corresponding to the to-be-processed link according to the second mapping relationship. In this way, the offset is combined with the to-be-processed link, the integrated data obtained by the combination is converted to obtain the short link corresponding to the to-be-processed link, the difficulty of brute force reverse cracking of the short link can be improved, the security of the original to-be-processed link can be effectively ensured, and the security of the user accessing the short link can be improved. BRIEF DESCRIPTION OF DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments described in the present specification, and for those skilled in the art, other drawings can also be obtained without creative labor.

[0031] Figure 1 An application scenario diagram of a short link generation method provided by the embodiments of the present specification is shown.

[0032] Figure 2 A flowchart of a short link generation method provided by the embodiments of the present specification is shown.

[0033] Figure 3 A swim lane diagram of a short link generation method provided by the embodiments of the present specification is shown.

[0034] Figure 4 A structural diagram of a short link generation device provided by the embodiments of the present specification is shown.

[0035] Figure 5 A structural diagram of a short link generation device provided by the embodiments of the present specification is shown. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of one or more embodiments of the present specification more clear, the technical solutions of one or more embodiments of the present specification will be described clearly and completely in the following with reference to the specific embodiments of the present specification and corresponding drawings. Obviously, the described embodiments are only some embodiments of the present specification, not all embodiments. Based on the embodiments in the present specification, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of one or more embodiments of the present specification.

[0037] The technical solutions provided by the embodiments of the present specification will be described in detail below with reference to the drawings.

[0038] Short link encoding, a common method for identifying internet resources in internet services, combines the advantages of uniqueness, readability, and small file size. Currently, short link encoding technology is typically used to convert long links into short links. Existing technologies usually generate a unique identifier ID for the long link, for example, using the Leaf algorithm, DB step size, or auto-incrementing primary key IDs. Then, this unique ID is converted from decimal to base-32, and finally, a short link is generated based on a commonly used character mapping table.

[0039] In existing technologies, if a malicious user reverse-engineers the short link using a commonly used character mapping table, the original long link can be easily restored.

[0040] To address the shortcomings of existing technologies, this solution provides the following embodiments:

[0041] Figure 1 This diagram illustrates an application scenario of a short link generation method provided in an embodiment of this specification. Figure 1 As shown, this scheme may include a server 1, a link to be processed 2, and a short link 3 corresponding to the link to be processed. The link to be processed 2 can be the original link address corresponding to network information shared by an end user. The server 1 can obtain this link to be processed and generate a unique identifier string corresponding to it. Then, based on a first mapping relationship, it determines the offset corresponding to the identifier string, combines the identifier string and the offset to obtain integrated data, and based on a second mapping relationship, converts the integrated data into the short link 3 corresponding to the link to be processed. The number of characters in the short link 3 is less than the number of characters in the link to be processed 2.

[0042] Next, a method for generating short links provided in the embodiments of the specification will be described in detail with reference to the accompanying drawings:

[0043] Figure 2 This is a flowchart illustrating a method for generating short links provided in an embodiment of this specification. From a programming perspective, the entity executing this process can be a program hosted on an application server or an application client. Specifically, the entity executing this process can be a server that performs short link encoding, possessing the function of converting long links into short links.

[0044] like Figure 2 As shown, the process may include the following steps:

[0045] Step 202: Obtain the link to be processed.

[0046] The to-be-processed link in the embodiments of the present specification can be a web address link of any page, or a link corresponding to the content of a web address. Specifically, it can be a web page address, a uniform resource locator (URL), etc., which can be an address from which a user can obtain network information, for example, a string used in an address bar when the user browses a web page using a browser.

[0047] The to-be-processed link in the embodiments of the present specification can be a web address link corresponding to network information to be shared by a user when sharing the network information. For example, when using a terminal application, the user wants to share the displayed content with other users, and the user can initiate a sharing event by clicking a share button or the like. The server can obtain a web address link corresponding to the content to be shared as the to-be-processed link based on the sharing event of the user.

[0048] Step 204: generating an identification string corresponding to the to-be-processed link based on the to-be-processed link.

[0049] The identification string can be understood as an ID (identity) of the to-be-processed link. One identification string can correspond to a unique to-be-processed link, and the identification string can be a string containing numbers and / or letters. In actual applications, the identification string corresponding to the to-be-processed link can be generated by a leaf algorithm, a DB step algorithm, a primary key id increment method, etc.

[0050] Step 206: determining an offset corresponding to the identification string according to a first mapping relationship.

[0051] The first mapping relationship can contain an identifier indicating the number of bits to be offset, and the offset corresponding to the identification string of the to-be-processed link can be determined according to the first mapping relationship, and then the offset corresponding to the identification string is determined. The offset can represent an offset value or offset character obtained according to a preset offset number of bits. In actual applications, the offset number of bits can be set according to actual needs, and the offset can be different according to different set offset numbers of bits. The specific value is not limited here.

[0052] Step 208: combining the identification string and the offset to obtain integrated data corresponding to the to-be-processed link; the integrated data at least contains the identification string and the offset.

[0053] In the embodiments of the present specification, the identification string corresponding to the to-be-processed link and the obtained offset can be combined to obtain integrated data, and the integrated data can at least contain the identification string and the offset.

[0054] In actual application, the combination rule can be set according to actual needs, and the identification string and the offset are combined according to the preset combination rule. For example, the offset can be spliced at the back of the identification string, or the offset can be spliced at the front of the identification string, or the offset can be spliced at a preset position in the identification string, such as splicing the offset after the third character of the identification string; or the identification string can be spliced at a preset position in the offset, such as splicing the identification string after the second character of the offset. The specific combination mode is not limited here.

[0055] Step 210: converting the integrated data into a short link corresponding to the to-be-processed link according to the second mapping relationship.

[0056] In the method, the integrated data can be converted by a base conversion or the like, the number of characters contained in the short link corresponding to the to-be-processed link obtained by conversion is less than the number of characters contained in the to-be-processed link, and the to-be-processed link can be simplified. In actual application, the user can also obtain the original network information corresponding to the to-be-processed link through the to-be-processed link.

[0057] It should be understood that the order of some or all of the steps of the method described in one or more embodiments of the present specification can be exchanged according to actual needs, or some or all of the steps can be omitted or deleted.

[0058] Figure 2 In the method, the integrated data obtained by combining the offset and the to-be-processed link is converted to obtain a short link corresponding to the to-be-processed link, which can improve the difficulty of brute force cracking of the short link, effectively ensure the security of the original to-be-processed link, and improve the security of the user accessing the short link.

[0059] In addition, the first mapping relationship can be updated according to needs in the embodiments of the present specification, the short link generation method can be upgraded in the case that the second mapping relationship is unchanged, the difficulty of cracking the short link can be improved, and the link security can be improved.

[0060] Based on the method, Figure 2 The embodiments of the present specification also provide some specific implementation schemes of the method, which are described below.

[0061] Optionally, in the embodiments of the present specification, the offset corresponding to the identification string is determined according to the first mapping relationship, and specifically can include:

[0062] determining an offset factor;

[0063] calculating the quotient and the remainder of the identification string and the offset factor;

[0064] According to the first mapping relationship, the offset corresponding to the remainder is determined; different remainders in the first mapping relationship correspond to different offsets.

[0065] The offset factor can be a preset offset factor set according to actual needs, and can represent the offset number of bits. For example, the offset factor can be 16, which can represent that the binary string corresponding to the identification string is shifted right by 4 characters, wherein the remainder obtained after one offset is 4 characters shifted right, and the quotient is the remaining characters after the offset. For another example, the offset factor can be 32, which can represent that the binary string corresponding to the identification string is shifted right by 5 characters, wherein the remainder obtained after one offset is 5 characters shifted right, and the quotient is the remaining characters after the offset. The specific value of the offset factor is not limited here.

[0066] The first mapping relationship can be set according to the offset factor, and the remainder obtained according to the offset factor can correspond to different offsets according to the first mapping relationship, thereby ensuring the uniqueness of the generated short link. For example, the offset in the first mapping relationship can be in a one-to-one correspondence with the remainder. The first mapping relationship includes a preset number of different mapping characters, wherein the preset number can be greater than or equal to the value represented by the offset factor, so as to ensure that different remainders can correspond to different offsets.

[0067] For example, the offset factor is 16, one offset is performed, and the remainder obtained can be any value from 0 to 15. The first mapping relationship can include 16 different mapping characters representing offsets, to respectively correspond to any value from 0 to 15. For example, the mapping character in the first mapping relationship can be the value corresponding to each remainder. Assuming that the mapping character set corresponding to the first mapping relationship is {0, 1, 2, 3, 4, …, 15}, the obtained remainder is a binary string 0010, and the mapping character corresponding to the remainder can be obtained according to the first mapping relationship 2, and the corresponding offset can be obtained 2.

[0068] It can be understood that the specific representation form of the offset can be set according to actual needs, and the first mapping relationship can include mapping characters representing offsets in the above numerical form, or can include mapping characters representing offsets in the form of letters a, b, c, d, e, and the form of mapping characters representing offsets is not limited here, as long as different remainders correspond to different offsets.

[0069] The offset factor in the embodiments of the present specification can also represent the bit weight of the base conversion, and the remainder can represent the string obtained by converting the identification string according to the offset factor. For example, the offset factor is 16, and the remainder can represent the string obtained by converting the identification string in hexadecimal; the offset factor is 32, and the remainder can represent the string obtained by converting the identification string in base 32.

[0070] The offset amount corresponding to the identification string is determined according to the first mapping relationship, and specifically can include:

[0071] The identification string is converted in the first base to obtain a first string in the first base; the bit weight of the first base is greater than the bit weight corresponding to the identification string;

[0072] The second string corresponding to the first string is determined according to the first mapping relationship; different characters in the first string in the first mapping relationship can correspond to different mapping characters;

[0073] The second string is determined as the offset amount.

[0074] Similarly, the first mapping relationship can correspond to the first base conversion, and different base conversions can correspond to different mapping relationships. The first mapping relationship includes a preset number of mapping characters, wherein the preset number can be greater than or equal to the base bit weight corresponding to the first base conversion, so as to ensure that different characters in the first string can correspond to different mapping characters. The second string can be a set of characters obtained by mapping each character in the first string according to the first mapping relationship, wherein each character in the first string can be mapped according to the first mapping relationship, and each character obtained by mapping can be sorted according to a preset sorting rule to obtain the second string. The preset sorting order can be set according to actual needs, for example, each character obtained by mapping can be arranged according to the arrangement order of each character in the first string in the first string to obtain the second string. Each character in the first string can also be sorted according to the reverse order corresponding to the arrangement order in the first string, and so on.

[0075] To improve the difficulty of cracking the short link, the integrated data corresponding to the to-be-processed link can be obtained by combining the identification string and the offset amount based on the identification string and the offset amount in the embodiments of the present specification, and specifically can include:

[0076] The identification string and the offset amount are spliced according to a preset splicing rule to obtain the integrated data.

[0077] The preset splicing rule can represent a rule of splicing the offset at a position after the end of the identification string, a rule of splicing the offset at a position before the beginning of the identification string, a rule of splicing the offset at a preset position in the identification string, or a rule of splicing the identification string at a preset position in the offset. For example, the identification string is 12345, and the offset is abc. The offset can be spliced after the identification string to obtain integrated data 12345abc. The offset can also be spliced before the identification string to obtain integrated data abc12345. The offset can also be spliced at a preset position in the identification string, such as after the third character, to obtain integrated data 123abc45. The identification string can also be spliced at a preset position in the offset, such as after the first character, to obtain integrated data a12345bc. It can be understood that the splicing rule can be set according to actual needs in actual application, and the specific rule is not limited here as long as it meets the actual needs.

[0078] In the embodiments of the present specification, the integrated data can be simplified by means of conversion of a certain number system to obtain a short link corresponding to the link to be processed. The second mapping relationship can represent the mapping relationship of conversion of a certain number system. Optionally, in the embodiments of the present specification, the integrated data is converted into a short link corresponding to the link to be processed according to the second mapping relationship, which can specifically include:

[0079] The integrated data is converted by a preset number system to obtain a string of the preset number system. The number system of the string of the preset number system corresponds to a bit weight greater than the number system of the integrated data.

[0080] According to the first character table, a target string corresponding to the string of the preset number system is determined.

[0081] Based on the target string, a short link corresponding to the link to be processed is obtained. The short link corresponding to the link to be processed includes the target string.

[0082] The preset number system conversion can be set according to actual needs. For example, it can be a commonly used 8-bit, 10-bit, 16-bit, 32-bit, 64-bit, etc. It can also be a self-defined 17-bit, 18-bit, 19-bit, 20-bit, 30-bit, etc. The specific number of bits is not limited here. In order to effectively reduce the length of the original link, the number system of the string of the preset number system can correspond to a bit weight greater than the number system of the integrated data. For example, the integrated data corresponds to 10-bit or 16-bit, which can be converted into 32-bit to obtain a string quantity less than the character quantity of the integrated data.

[0083] The first character table can correspond to a preset base, so that the number of different characters contained in the first character table is greater than or equal to the number represented by the preset base. For example, when the preset base is base 32, the first character table can contain 32 different characters, which can be a combination of numbers and letters, such as 0123456789abcdefghjkmnprstuvwxyz. The obtained short link can contain at least part of the 10 numbers and 22 lowercase letters.

[0084] According to the first character table, the corresponding character of each character in the string of the preset base in the first character table can be determined, and the corresponding characters can be sorted in a preset order to obtain a target string. The preset order can be set according to actual needs. For example, the preset order can represent the order of each character in the string of the preset base in the string of the preset base, or it can be in reverse order, or it can be a custom order, and the like, which is not limited here.

[0085] In actual application, the to-be-processed link can be a URL link, which can include a pattern or protocol, a server name or IP address, a path, and a file name, etc. In the embodiments of the present specification, the entire URL link can be processed, or part of the content in the URL link can be processed. For example, the path and file name part is usually long, and the short chain encoding processing can be performed on this part.

[0086] The short link corresponding to the to-be-processed link can be used to access the network content corresponding to the to-be-processed link. When user A shares a certain network content to other users, the sharing link obtained by the other users can be the short link. The short link corresponding to the to-be-processed link can be generated based on the sharing operation of the user, or can be generated based on the copy, paste, save, etc. operation of the user, which can be provided to other users by the user through a communication application, or can be provided to other users by the user through an email, a short message, a social media platform, etc.

[0087] In the embodiments of the present specification, the introduction of the offset can correspond to an indefinite offset of the original to-be-processed link, which can increase the difficulty of brute force cracking of the original to-be-processed link. Moreover, the offset can upgrade and roll back the algorithm of the short encoding, and will not affect the uniqueness of the generated short link.

[0088] To further improve the security of the link, the short link corresponding to the to-be-processed link in the embodiments of the present specification can also contain an offset character corresponding to the offset. Optionally, the method in the embodiments of the present specification can further include:

[0089] According to the second character table, the offset character corresponding to the offset amount is determined;

[0090] The short link corresponding to the to-be-processed link is obtained based on the target string, and specifically can include:

[0091] The target string and the offset character are spliced to obtain the short link corresponding to the to-be-processed link.

[0092] The second character table can include a preset number of different characters, and the preset number can be greater than or equal to the selectable number of offset amounts corresponding to the identification string, so as to ensure that different offset amounts can correspond to different characters in the second character table.

[0093] In the embodiments of the present specification, the offset amount can be an offset amount obtained after one offset, or an offset amount combination obtained after multiple offsets. When the offset amount is an offset amount combination, the offset character corresponding to each offset amount can be obtained according to the second character table, and an offset string composed of multiple offset characters is obtained. The offset character included in the short link can be a character or a string.

[0094] In the embodiments of the present specification, the target string and the offset character can be spliced according to a preset splicing rule, so that the short link corresponding to the to-be-processed link includes the target string and the offset character. The preset splicing rule can represent a rule of splicing the offset character after the last character of the target string, or a rule of splicing the target string after the last character of the offset character, or a rule of splicing the offset character to a preset position in the target string, or a rule of splicing the target string to a preset position in the offset character, and the like. In actual application, the splicing rule can be determined according to actual needs, which is not limited here as long as the short link corresponding to the to-be-processed link can include the target string and the offset character.

[0095] The short link corresponding to the to-be-processed link can also include an additional character corresponding to the identification string. The additional character can be a character corresponding to a result obtained by performing a preset operation on the identification string. Optionally, the method in the embodiments of the present specification can further include:

[0096] The remainder of the identification string and the offset factor is obtained.

[0097] According to the third character table, the additional character corresponding to the remainder is determined.

[0098] The short link corresponding to the to-be-processed link is obtained based on the target string, and specifically can include:

[0099] Splice the target string and the additional character to obtain the short link corresponding to the to-be-processed link.

[0100] The offset factor is set according to actual requirements, such as 8, 16, 32, etc. The third character table can contain a preset number of different characters, and the preset number can be greater than or equal to the value represented by the offset factor, to ensure that different remainders can correspond to different characters in the third character table. Here, the character corresponding to the remainder in the third character table can be referred to as an additional character.

[0101] In actual applications, the remainder can be the result of one division operation of the identification string by the offset factor, or the result of a conversion of the identification string into a different base based on the offset factor. The result can be a character, a string containing multiple characters, or it can be understood as performing multiple division operations until the quotient is 0. The remainder obtained each time can correspond to a character, and the additional character obtained can be a character or a string containing multiple characters.

[0102] The short link corresponding to the to-be-processed link in the examples of the present specification can contain the target string and the additional character. The introduction of the additional character can also increase the difficulty of brute force cracking of the link.

[0103] In the embodiments of the present specification, the target string and the additional character can be spliced according to a preset splicing rule, so that the short link corresponding to the to-be-processed link contains the target string and the additional character. The preset splicing rule can represent a rule of splicing the additional character after the last character of the target string, a rule of splicing the target string after the last character of the additional character, a rule of splicing the additional character to a preset position in the target string, or a rule of splicing the target string to a preset position in the additional character, etc. In actual applications, the splicing rule can be determined according to actual requirements, which is not limited here as long as the generated short link can contain the target string and the additional character.

[0104] In the embodiments of the present specification, the short link corresponding to the to-be-processed link can contain the offset character corresponding to the offset amount and the additional character corresponding to the identification string in addition to the target string, to help prevent brute force cracking. Optionally, the method in the embodiments of the present specification can further include:

[0105] According to the second character table, determining the offset character corresponding to the offset amount;

[0106] Obtaining the remainder of the identification string and the offset factor;

[0107] According to the third character table, determining the additional character corresponding to the remainder;

[0108] The target string is based on the target string, and the short link corresponding to the to-be-processed link is obtained, and specifically includes:

[0109] The target string, the offset character and the additional character are spliced to obtain the short link corresponding to the to-be-processed link.

[0110] Wherein, the introduction of offset character, offset factor and additional character can refer to the foregoing introduction, which will not be repeated here.

[0111] In the embodiments of the present specification, the target string, the offset character and the additional character can be spliced according to the preset splicing rule to obtain the short link corresponding to the to-be-processed link containing the target string, the offset character and the additional character. Wherein, the preset splicing rule can include a rule representing the splicing order of the target string, the offset character and the additional character, for example, the offset character can be placed after the last character of the target string, and the additional character can be placed after the last character of the offset character according to the order of the target string, the offset character and the additional character; the target string can be placed after the last character of the offset character, and the additional character can be placed after the last character of the target string according to the order of the offset character, the target string and the additional character; the splicing can be performed according to the order of the target string, the additional character and the offset character, and the like, which will not be listed one by one.

[0112] Of course, at least one of the target string, the offset character and the additional character can be placed at a preset position in other characters, for example, the offset character can be placed after the mth character of the target string, and the additional character can be placed after the offset character, and the additional character can also be placed after the nth character of the target string. The specific splicing rule can be set according to actual needs, which will not be specifically limited here.

[0113] It should be noted that the first character table, the second character table and the third character table can be the same character table, or different character tables, which will not be specifically limited here.

[0114] In the short link generation method in the embodiments of the present specification, at least one layer of mapping is added on the basis of the existing one layer of mapping operation, which can increase the difficulty of link brute force cracking. In order to better protect the link security, the offset in the embodiments of the present specification can also be an offset obtained through two layers of mapping relationship or more layers of mapping relationship. Optionally, the first mapping relationship in the embodiments of the present specification can include a first binary conversion rule and a second binary conversion rule.

[0115] The offset corresponding to the identification string is determined according to the first mapping relationship, and specifically can include:

[0116] According to the first base conversion rule, the identification string is converted by the first base conversion rule to obtain a first offset string;

[0117] According to the second base conversion rule, the identification string is converted by the second base conversion rule to obtain a second offset string;

[0118] The first offset string and the second offset string are spliced to obtain the offset.

[0119] The first base conversion rule and the second base conversion rule can represent different base conversion rules, such as the first base being octal and the second base being hexadecimal; or the same base, which is not limited here.

[0120] The first offset string can be a first base conversion result obtained by converting the identification string by the first base, and then finding the corresponding character in the first offset mapping table to obtain the string; the second offset string can be a second base conversion result obtained by converting the identification string by the second base, and then finding the corresponding character in the second offset mapping table to obtain the string.

[0121] The first offset mapping table and the second offset mapping table can contain multiple different characters, ensuring that each different character in the conversion result can correspond to a different character in the offset mapping table, ensuring the uniqueness of the corresponding relationship, and also ensuring the uniqueness of the short link corresponding to the link to be processed.

[0122] In actual application, in order to more effectively reduce the number of characters contained in the link, the bit weight of the base represented by the offset factor used when calculating the offset can be smaller than the bit weight of the base used when converting the integrated data to the base, for example, the identification string can be converted to hexadecimal to obtain the offset, and the integrated data can be converted to 32-bit to obtain the target string. It can also be 16-bit, 64-bit, etc. It can be understood that the specific base can be set according to actual needs, which is not limited here.

[0123] In actual application, for convenience of calculation, the identification string can be converted to a preset base such as binary or decimal before calculation. The remainder, offset, and preset base string can also be converted to a preset base before searching for the corresponding character and splicing. The server's operation requirements can be set, which is not limited here.

[0124] To more clearly illustrate the short link generation method provided in the embodiments of the present specification, Figure 3 A swim lane diagram of a short link generation method provided by the embodiments of the present specification is shown in FIG. 1.Figure 3 The scheme can include a link acquisition stage, a link processing stage, and a short link generation stage. Specifically, the scheme can include:

[0125] Step 302: The terminal sends a to-be-processed link to the server.

[0126] The terminal can be a mobile phone, a computer, a smart watch, a car machine, or the like. A user can share network information to other users through the terminal. The to-be-processed link can be a link address corresponding to the network information to be shared. In actual applications, a user can share information through a terminal application, and the to-be-processed link can be a link determined by the terminal application or a terminal application server based on the sharing operation of the user, or can be sent to the server by the terminal application server. The specific manner is not specifically limited here, as long as the to-be-processed link can be obtained by the server.

[0127] Step 304: The server obtains the to-be-processed link.

[0128] Step 306: Based on the to-be-processed link, an identification string corresponding to the to-be-processed link is generated. The generated identification string can correspond to a unique to-be-processed link.

[0129] Step 308: Based on a preset offset factor, an offset corresponding to the identification string is determined.

[0130] The quotient and the remainder of the identification string and the offset factor can be calculated, and the corresponding offset can be determined according to a preset offset mapping table.

[0131] Step 310: The identification string and the offset are combined to obtain integrated data corresponding to the to-be-processed link; the integrated data at least includes the identification string and the offset.

[0132] The offset helps to offset and confuse the unique id data and the original numerical link data, so that in the case where the offset value cannot be determined, brute force cracking cannot be performed, and the security of the link can be improved. In actual applications, before splicing, the identification string and the offset can be converted into a string of the same base, and then spliced for subsequent calculation.

[0133] Step 312: The integrated data is converted into a string of a preset base.

[0134] Step 314: According to a first character table, a target string corresponding to the string of the preset base is determined.

[0135] Step 316: Based on the target string, a short link corresponding to the to-be-processed link is obtained; the short link corresponding to the to-be-processed link includes the target string.

[0136] The remainder and the offset corresponding characters in the first character table can also be found, and the two corresponding characters are spliced with the target string to obtain the short link corresponding to the to-be-processed link, so that the short link corresponding to the to-be-processed link can contain the target string and the characters corresponding to the remainder and the offset.

[0137] In actual application, when the identification string, the offset and the remainder are combined, each to-be-combined string can be converted into characters of the same base, and then combined.

[0138] Based on the same idea, the present specification also provides a device corresponding to the above method. Figure 4 A structure diagram of a short link generation device provided by an embodiment of the present specification is shown in FIG. 5. Figure 4 As shown in FIG. 5, the device can include:

[0139] A link acquisition module 402 is configured to acquire a to-be-processed link.

[0140] An identification generation module 404 is configured to generate an identification string corresponding to the to-be-processed link based on the to-be-processed link.

[0141] An offset determination module 406 is configured to determine an offset corresponding to the identification string according to a first mapping relationship.

[0142] A data integration module 408 is configured to combine the identification string and the offset to obtain integrated data corresponding to the to-be-processed link; the integrated data at least contains the identification string and the offset.

[0143] A short link generation module 410 is configured to convert the integrated data into a short link corresponding to the to-be-processed link according to a second mapping relationship.

[0144] Based on the same idea, the present specification also provides a device corresponding to the above method.

[0145] Figure 5 A structure diagram of a short link generation device provided by an embodiment of the present specification is shown in FIG. 5. Figure 5 As shown in FIG. 5, the device can include:

[0146] at least one processor 510; and

[0147] a memory 530 in communication with the at least one processor; wherein

[0148] The memory 530 stores instructions 520 executable by the at least one processor 510, and the instructions are executed by the at least one processor 510 to enable the at least one processor 510 to:

[0149] obtain a to-be-processed link;

[0150] generate an identification string corresponding to the to-be-processed link based on the to-be-processed link;

[0151] determine an offset corresponding to the identification string according to a first mapping relationship;

[0152] combine the identification string and the offset to obtain integrated data corresponding to the to-be-processed link based on the identification string and the offset; the integrated data at least contains the identification string and the offset;

[0153] convert the integrated data into a short link corresponding to the to-be-processed link according to a second mapping relationship.

[0154] Based on the same idea, the embodiments of the present specification also provide a computer readable medium corresponding to the above method. The computer readable medium stores computer readable instructions, and the computer readable instructions can be executed by a processor to implement the above short link generation method:

[0155] Each of the embodiments in the present specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, for the device shown in the embodiments, since it is basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments. Figure 5 The device shown in the embodiments is basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.

[0156] In the 1990s, it was relatively easy to distinguish whether an improvement in a technology was a hardware improvement (e.g., an improvement in the circuit structure of a diode, transistor, switch, etc.) or a software improvement (an improvement in a method flow). However, as technology has evolved, many improvements in method flows today can be considered as direct improvements in hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structures by programming the improved method flows into hardware circuits. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using hardware entity modules. For example, a programmable logic device (PLD) (e.g., a field programmable gate array (FPGA)) is an integrated circuit whose logic function is determined by user programming of the device. A designer programs a digital system "integrated" on a PLD by himself, without having to ask a chip manufacturer to design and manufacture a special integrated circuit chip. Moreover, instead of manually manufacturing integrated circuit chips, this programming is now mostly implemented using "logic compiler" software, which is similar to the software compiler used when developing programs, and the original code before compilation must also be written in a specific programming language, which is called a hardware description language (HDL), and there are many types of HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., and the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be aware that it is easy to obtain a hardware circuit that implements a logical method flow by simply logically programming the method flow in one of the above-mentioned hardware description languages and programming it into an integrated circuit.

[0157] The controller can be implemented in any suitable way, e.g. the controller can take the form of a microprocessor or processor and a computer readable medium storing computer readable program code, e.g. software or firmware, executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller and an embedded microcontroller, examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91 SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to being implemented in pure computer readable program code form, the controller can perfectly well be implemented by means of logic programmed into logic gates, switches, application specific integrated circuits, programmable logic controllers and embedded microcontrollers, etc. to perform the same functions. The controller can thus be considered as a hardware component, and the means comprised therein for performing various functions can be considered as structures within the hardware component. Alternatively, or even additionally, the means for performing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0158] The systems, apparatuses, modules or units illustrated by the above embodiments can be implemented by computer chips or entities, or products with certain functions. A typical implementation device is a computer. Specifically, the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0159] For the sake of description, the above apparatuses are described in various units by functions respectively. Of course, the functions of each unit can be implemented in the same or multiple software and / or hardware in the implementation of the present application.

[0160] Those skilled in the art will understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.

[0161] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks

[0162] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks

[0163] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks

[0164] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0165] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, for storing, in general, data and / or program instructions. The memory can also include non-volatile memory, such as read only memory (ROM) and / or flash memory, for storing, in general, static data and / or instructions that are not very likely to ever change. The memory can store software

[0166] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.

[0167] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but also other elements not explicitly listed or inherent to such a process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

[0168] Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system or computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) containing computer usable program code.

[0169] The present application can be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types. The present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communication network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including memory storage devices.

[0170] The above merely provides an example of the present application, but is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application should be included in the scope of claims of the present application.

Claims

1. A method for generating short links, comprising: Get the links to be processed; Based on the link to be processed, generate an identifier string corresponding to the link to be processed; Based on the first mapping relationship, determine the offset corresponding to the identifier string; According to the preset concatenation rules, the identifier string and the offset are concatenated to obtain the integrated data corresponding to the link to be processed; the integrated data includes at least the identifier string and the offset; Based on the second mapping relationship, the integrated data is converted into short links corresponding to the links to be processed.

2. The method according to claim 1, wherein determining the offset corresponding to the identifier string based on the first mapping relationship specifically includes: Determine the offset factor; Calculate the quotient and remainder of the identifier string and the offset factor; Based on the first mapping relationship, determine the offset corresponding to the remainder; In the first mapping relationship, different remainders correspond to different offsets.

3. The method according to claim 1, wherein converting the integrated data into short links corresponding to the links to be processed according to the second mapping relationship specifically includes: The integrated data is converted to a preset base to obtain a string in the preset base; The positional weight of the preset base string is greater than the positional weight of the integrated data. Based on the first character table, determine the target string corresponding to the string in the preset base; Based on the target string, the short link corresponding to the link to be processed is obtained; The short link corresponding to the link to be processed contains the target string.

4. The method according to claim 3, wherein the short link corresponding to the link to be processed contains the offset character corresponding to the offset. The method further includes: According to the second character table, determine the offset character corresponding to the offset; The process of obtaining the short link corresponding to the link to be processed based on the target string specifically includes: The target string and the offset character are concatenated to obtain the short link corresponding to the link to be processed.

5. The method according to claim 3, wherein the short link corresponding to the link to be processed contains additional characters corresponding to the identifier string; The method further includes: Obtain the remainder between the identifier string and the offset factor; Based on the third character table, determine the additional character corresponding to the remainder; The process of obtaining the short link corresponding to the link to be processed based on the target string specifically includes: The target string and the additional characters are concatenated to obtain the short link corresponding to the link to be processed.

6. The method according to claim 3, wherein the short link corresponding to the link to be processed includes the offset character corresponding to the offset and the additional character corresponding to the identifier string; The method further includes: According to the second character table, determine the offset character corresponding to the offset; Obtain the remainder between the identifier string and the offset factor; Based on the third character table, determine the additional character corresponding to the remainder; The process of obtaining the short link corresponding to the link to be processed based on the target string specifically includes: The target string, the offset character, and the additional character are concatenated to obtain the short link corresponding to the link to be processed.

7. The method according to claim 1, wherein the first mapping relationship includes a first base conversion rule and a second binary conversion rule; The step of determining the offset corresponding to the identifier string based on the first mapping relationship specifically includes: According to the first base conversion rule, the identifier string is converted to the first base to obtain the first offset string; According to the aforementioned binary conversion rule, the identifier string is converted to binary to obtain the second offset string; The first offset string and the second offset string are concatenated to obtain the offset amount.

8. A short link generation apparatus, comprising: The link acquisition module is used to acquire links to be processed. The identifier generation module is used to generate an identifier string corresponding to the link to be processed based on the link to be processed; The offset determination module is used to determine the offset corresponding to the identifier string based on the first mapping relationship; The data integration module is used to concatenate the identifier string and the offset according to a preset concatenation rule to obtain the integrated data corresponding to the link to be processed; the integrated data includes at least the identifier string and the offset; The short link generation module is used to convert the integrated data into short links corresponding to the links to be processed according to the second mapping relationship.

9. A device for generating short links, comprising: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Get the links to be processed; Based on the link to be processed, generate an identifier string corresponding to the link to be processed; Based on the first mapping relationship, determine the offset corresponding to the identifier string; According to the preset concatenation rules, the identifier string and the offset are concatenated to obtain the integrated data corresponding to the link to be processed; the integrated data includes at least the identifier string and the offset; Based on the second mapping relationship, the integrated data is converted into short links corresponding to the links to be processed.

10. A computer-readable medium having stored thereon computer-readable instructions that can be executed by a processor to implement the method for generating short links according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Short link generation method and related equipment

    CN112380464A