Short website generation method and related equipment
By converting short URL serial numbers into N-base numbers using a multi-row character alphabet, the method generates secure and collision-free short URLs that are resistant to cracking, addressing the vulnerabilities of existing short URL systems.
Patent Information
- Application Number
- CN202411037456.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-17
AI Technical Summary
Existing short URLs generated by prior art are easily cracked, leading to information leakage or illegal access due to their regularity and susceptibility to inference.
A method and system that convert an M-base short URL serial number into an N-base number using an alphabet with multiple rows of characters, querying characters corresponding to each bit in the number's row characters to generate a short URL, thereby increasing the difficulty of cracking.
Enhances the security of short URLs by increasing their randomness and irregularity, preventing collisions, and reducing the likelihood of information leakage or illegal access.
Smart Images

Figure CN119149837A_ABST
Abstract
Description
Background Art
[0002] With the development of the Internet, in order to facilitate the sharing and dissemination of URLs, it is usually necessary to convert long URLs into short URLs. A short URL refers to a URL that is shorter in form, relative to the original long URL. When a user visits this short URL, they can be redirected to the original long URL (restored). Short URLs can reduce the number of words in text, hide link parameters, etc., which is conducive to SMS promotion. They are often used in scenarios such as SMS, Weibo, and QR codes with word count restrictions.
[0003] However, the short URL generated by the prior art for redirecting to the long URL is easy to be cracked, thereby causing information leakage or illegal access problems.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The present disclosure provides a method, device, system, electronic device, computer-readable storage medium and computer program product for generating a short URL, which solve the problem that the generated short URL is easily cracked, leading to information leakage or illegal access.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0007] According to one aspect of the present disclosure, a method for generating a short URL is provided, comprising: obtaining an M-base short URL serial number, where M is a positive integer; converting the short URL serial number into an N-base number, where N is a positive integer greater than M; obtaining an alphabet, where the alphabet includes a plurality of row characters; querying the characters corresponding to the values of each bit in the number in the row characters of the alphabet to obtain a plurality of short URL characters, where the plurality of short URL characters come from different row characters of the alphabet; and combining the plurality of URL characters together to obtain a short URL.
[0008] According to another aspect of the present disclosure, a short URL generating device is provided, including: an acquisition module, used to obtain an M-base short URL serial number, where M is a positive integer; a conversion module, used to convert the short URL serial number into an N-base number, where N is a positive integer greater than M; the acquisition module is also used to obtain an alphabet, where the alphabet includes multiple row characters; a query module, used to query the characters corresponding to the values of each bit in the number in the row characters of the alphabet, to obtain multiple short URL characters, where the multiple short URL characters come from different row characters of the alphabet; and a combination module, used to combine the multiple short URL characters together to obtain a short URL.
[0009] According to another aspect of the present disclosure, a short URL generation system is provided, including: an alphabet generator, used to obtain an initial character array, the initial character array includes N different characters; generating P rows of characters according to the initial character array, each row of characters in the P rows of characters includes N different characters in the initial character array, and the arrangement order of the N characters in each row of characters is different; combining the P rows of characters together to obtain the alphabet, P is a positive integer greater than 1; a short URL sequence number generator, used to obtain a self-increment identifier; reorganizing the self-increment identifier to obtain an M-based short URL sequence number, M is a positive integer; a short URL generator, used to receive the alphabet and the short URL sequence number, convert the M-based URL sequence number into a number in N-based, N is a positive integer greater than M; querying the character corresponding to the value of each bit in the number in the row of characters in the alphabet to obtain multiple short URL characters; combining the multiple short URL characters together to obtain a short URL.
[0010] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any of the above-mentioned short URL generation methods by executing the executable instructions.
[0011] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, any of the above-mentioned methods for generating a short URL is implemented.
[0012] According to another aspect of the present disclosure, a computer program product is provided, the computer program product comprising a computer program or computer instructions, the computer program or the computer instructions being loaded and executed by a processor so that a computer implements any of the above-mentioned methods for generating a short URL.
[0013] In the embodiment of the present disclosure, by obtaining an M-base short URL serial number, M is a positive integer; and converting the short URL serial number into an N-base number, N is a positive integer greater than M; by obtaining an alphabet, the alphabet includes multiple row characters; and querying the characters corresponding to the values of each bit in the number in the row characters of the alphabet, multiple short URL characters are obtained, and the multiple short URL characters come from different row characters of the alphabet; multiple URL characters are combined together to obtain a short URL. The present disclosure converts an M-base short URL serial number into an N-base number, and queries the characters corresponding to the values of each bit in the number in the row characters of the alphabet, and multiple short URL characters are obtained, and the multiple short URL characters come from different row characters of the alphabet, thereby increasing the difficulty of cracking the short URL, solving the problem of information leakage or illegal access, and improving the security of the short URL.
[0014] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0016] Figure 1 A schematic diagram showing the structure of a short URL generation system in an embodiment of the present disclosure.
[0017] Figure 2 A flow chart of a method for generating a short URL in an embodiment of the present disclosure is shown.
[0018] Figure 3 A flow chart of generating a short URL serial number in an embodiment of the present disclosure is shown.
[0019] Figure 4 A flowchart of generating a short URL serial number in another embodiment of the present disclosure is shown.
[0020] Figure 5 A flowchart of generating an alphabet table in an embodiment of the present disclosure is shown.
[0021] Figure 6 A flowchart of generating an alphabet table in another embodiment of the present disclosure is shown.
[0022] Figure 7 A flowchart of generating an alphabet table in yet another embodiment of the present disclosure is shown.
[0023] Figure 8 A schematic diagram showing the structure of a short URL generation system in an embodiment of the present disclosure.
[0024] Fig. 9 A schematic diagram showing the structure of a short URL generation system in another embodiment of the present disclosure.
[0025] Fig.10 A schematic diagram showing the structure of a short URL generation system in yet another embodiment of the present disclosure.
[0026] Fig.11 A schematic diagram of a device for generating a short URL in an embodiment of the present disclosure is shown.
[0027] Fig.12 A structural block diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0028] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0029] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0030] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0031] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0032] For ease of understanding, several terms involved in the present disclosure are explained below:
[0033] ID (identifier) can be used to represent a symbol or code that uniquely identifies an entity or object. Auto-increment ID is a mechanism for automatically generating a unique identifier for each row in a table. Auto-increment ID can be used as the primary key of a table to ensure that each record has a unique identifier.
[0034] Collision refers to two different long URLs (such as actual addresses) that are converted to the same short URL. Collision may cause confusion and uncertainty, making it impossible to correctly identify the originally different long URLs after they are converted to short URLs.
[0035] In order to facilitate the sharing and dissemination of URLs, long URLs can be converted into short URLs. Short URLs can reduce the number of words in text, hide link parameters, etc., which is conducive to SMS promotion. Related technologies generate short URLs through self-incrementing sequences or digest algorithms.
[0036] The inventors have found that the short URLs generated by the self-incrementing sequence for redirecting to the long URLs have regularity and are easy to be cracked. It is also easy to infer other short URLs based on the regularity of the short URLs, which has poor security. The short URLs generated by the digest algorithm have collisions, which requires that the collision needs to be detected and processed after each short URL is generated, which wastes performance and is also difficult to process.
[0037] Based on this, the embodiments of the present disclosure provide a method, device, system, electronic device, storage medium and program product for generating a short URL, which can be applied to the Internet. For example, it can be applied to scenarios such as text messages, microblogs, and QR codes with word count restrictions, and no specific limitation is made to this. The present disclosure obtains an M-based short URL serial number, where M is a positive integer; and converts the short URL serial number into an N-based number, where N is a positive integer greater than M; obtains an alphabet, where the alphabet includes multiple row characters; and queries the characters corresponding to the values of each bit in the number in the row characters of the alphabet, to obtain multiple short URL characters, where the multiple short URL characters come from different row characters of the alphabet; and combines multiple URL characters together to obtain a short URL. The present disclosure converts an M-based short URL serial number into an N-based number, and queries the characters corresponding to the values of each bit in the number in the row characters of the alphabet, to obtain multiple short URL characters, where the multiple short URL characters come from different row characters of the alphabet, thereby increasing the difficulty of cracking the short URL, solving the problem of information leakage or illegal access, and improving the security of the short URL. In addition, the short URLs generated by the short URL sequence will not be repeated, so there will be no short URL collision. In other words, the short URLs generated by different short URL sequences are also different, which will not cause confusion and uncertainty.
[0038] It should be pointed out that, in the absence of conflict, the embodiments of the present disclosure and the technical features therein may be combined with each other.
[0039] The specific implementation of the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.
[0040] Figure 1 A schematic diagram showing the structure of a short URL generation system in one embodiment of the present disclosure is provided. The system can apply the short URL generation method or short URL generation device in various embodiments of the present disclosure.
[0041] like Figure 1 As shown, the system architecture may include a device 101 and a server 102. The device 101 and the server 102 are connected to each other through a network, which may be a wired network or a wireless network.
[0042] Optionally, the wireless network or wired network described above uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged through the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies.
[0043] Device 101 is used to send a short URL generation request, and can also receive the short URL sent by server 102, and send the short URL to other users' devices via text messages, emails, etc. Device 101 can be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, wearable devices, augmented reality devices, virtual reality devices, etc.
[0044] Optionally, the client of the application installed in different devices 101 is the same, or the client of the same type of application based on different operating systems. Based on the different terminal platforms, the specific form of the client of the application can also be different, for example, the application client can be a mobile client, a PC (Personal Computer) client, etc.
[0045] The server 102 is used to generate a short URL according to the short URL generation request sent by the device 101, and send the generated short URL to the device 101. The server 102 can be a server that provides various services, such as a background management server that provides support for the device operated by the user or the server using the device 101. The background management server can analyze and process the received request and other data, and feed back the processing results to the device.
[0046] Optionally, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0047] Those skilled in the art will know that Figure 1 The number of devices and servers in the embodiment is only for illustration, and any number of devices and servers may be provided according to actual needs. The embodiments of the present disclosure do not limit this.
[0048] The present exemplary implementation is described in detail below with reference to the accompanying drawings and embodiments.
[0049] The present disclosure provides a method for generating a short URL, which can be executed by any electronic device with computing and processing capabilities. It should be noted that the URL generated by the present disclosure embodiment can be a short URL, and the present disclosure is not limited thereto.
[0050] Figure 2 A flow chart of a method for generating a short URL in an embodiment of the present disclosure is shown as follows: Figure 2 As shown, the URL generation method provided in the embodiment of the present disclosure includes the following S201 to S205.
[0051] S201, obtain an M-base short URL serial number, where M is a positive integer.
[0052] In the embodiments of the present disclosure, the short URL serial number is a numerical value used to generate a short URL. The present disclosure does not limit how the short URL serial number is obtained. For example, the short URL serial number can be a self-incrementing ID with sequentiality, non-repetition and high performance (such as the global self-incrementing ID of a MySQL (a popular relational database management system) database), which can be obtained by storing number segments through a Redis (an open source in-memory database) list. For another example, the short URL serial number can be a pre-set numerical value, and each time a short URL is generated, the value of the short URL serial number increases by a fixed value (such as 1).
[0053] In one embodiment, before obtaining the M-ary short URL serial number, the method provided by the embodiment of the present disclosure may further include: receiving a short URL generation request sent by the first device, where the short URL generation request includes an actual address.
[0054] In the embodiment of the present disclosure, the actual address (also called the long URL) is used to indicate the original URL, that is, the actual address is the original URL to be converted. The short URL generated by the present disclosure is the converted URL. The shortness of the short URL is based on the length of the original URL before conversion, that is, the length of the converted URL is less than the length of the original URL before conversion.
[0055] It should be noted that the electronic device (such as a server) may execute S201 after receiving the short URL generation request sent by the first device. S201 may also be executed according to the instruction of the staff. This embodiment of the disclosure does not limit this.
[0056] S202, converting the short URL serial number into a number in base N, where N is a positive integer greater than M.
[0057] In the embodiment of the present disclosure, there is no limitation on the values of N and M, as long as N is greater than M. For example, the value of M is 10, and the value of N is 62. For another example, the value of M is 10, and the value of N is 72.
[0058] For example, the short URL serial number is a decimal self-incrementing ID. Convert the self-incrementing ID into a 62-digit number (6 digits have 62 6 = 56.8 billion combinations). For example, every time a short URL is generated, 1 is added to the auto-increment ID of the last short URL, and then the decimal ID value is converted into a 62-decimal number. For example, the decimal number 10000000000 converted to 62-decimal is aUKYOA.
[0059] In the disclosed embodiment, the base of the number is larger than the base of the short URL serial number, which is beneficial for shortening the number of digits without causing collision, thereby preparing for generating a short URL.
[0060] S203, obtaining an alphabet, which may include multiple rows of characters, that is, the alphabet in the present disclosure is a two-dimensional alphabet.
[0061] In the disclosed embodiment, the alphabet is used to indicate the correspondence between the value of each digit in the number and the character. The alphabet includes multiple character rows, each row contains a fixed number of characters (for example, 62), and each character in the same row is not repeated, so as to avoid different values being mapped to the same character and avoid the generated short URL being non-unique.
[0062] For example, the alphabet is shown in Table 1 below.
[0063] Table 1 Alphabet
[0064] 6dt4hbyqaMiGWBNCnZ9Q3wrOzsAegljkPvcRVpSLHXx8IuDEfFom5JTU012KY7 TSJRiy27VrnlcA6fFB5DI0KOE8UwejYHtWN9qPz3XmbMdpLgQZosGvkah1C4xu I1EBnSwpbRor6uFWLlYiqUke9T3jDaMPJt80fzhXc24HvOC75VGgAxQNsmKydZ ewndPJ4FfqstIu0HYSM9RikNl3TOKWEX25ma8gzALroh7j6ZvGcxUDbyVC1BpQ dsjfmx6yzBnIWaeP2X7w0CO4HVrGtpuKAYcQkiUZESTLFD8bJog5vN3q9hRMl1 Q2VbJBPKZcoyMR4vp3tHDO7lrXnd89fILuYNekwjWE6Cax1FqshiUTz0g5mGSA
[0065] S204, querying the characters corresponding to the values of each bit in the number in the alphabetical row characters, and obtaining a plurality of short URL characters, wherein the plurality of short URL characters are from different alphabetical rows.
[0066] In the disclosed embodiment, each row of characters in the alphabet may correspond to one numerical digit of a number, or may correspond to multiple numerical digits of a number. Each character on the row of characters corresponds to a different value. Two embodiments are described below.
[0067] In one embodiment, each row of characters in the alphabet corresponds to a numerical digit of the number. Exemplarily, the number of digits of the number is P, the alphabet includes P rows of characters, and P is an integer greater than 1; wherein, querying the characters corresponding to the values of each digit in the alphabet row of characters to obtain multiple short URL characters may include: querying the characters corresponding to the values of the i-th digit in the number in the i-th row of characters in the alphabet to obtain the i-th short URL character, wherein i is an integer greater than 0 and less than or equal to P.
[0068] In the disclosed embodiment, the value of each digit of the number is queried in different rows of the alphabet, which can prevent other short URLs from being inferred. Exemplarily, the value of M is 10, the value of N is 62, and the value of P is 6. The number is 123456 in base 62, and the number has 6 digits, which correspond to the 6 row characters in Table 1 respectively. The value of each digit in the number is queried for the corresponding characters in the corresponding rows of the alphabet, and the 6 short URL characters obtained are d, J, B, P, x and P respectively. Among them, the numerical digits of 123456 correspond to the 1st to 6th rows of the alphabet from high to low, wherein 1 corresponds to the 2nd character d in the first row of the alphabet, 2 corresponds to the 3rd character J in the second row of the alphabet, 1 corresponds to the 4th character B in the third row of the alphabet, 1 corresponds to the 5th character P in the fourth row of the alphabet, 1 corresponds to the 6th character x in the fifth row of the alphabet, and 1 corresponds to the 7th character P in the sixth row of the alphabet.
[0069] It should be noted that the characters from left to right in each character row correspond to values 0-61 respectively. For example, the 62-base number is 111011, and the corresponding short URL characters are d, S, 1, e, s and 2.
[0070] The disclosed embodiment can increase the randomness and irregularity of the characters generated in the short URL by querying the characters corresponding to the values of the numbers in different rows of the alphabet, increase the difficulty of cracking the short URL, solve the problem of information leakage or illegal access, and improve the security of the short URL.
[0071] In another embodiment, each row of characters in the alphabet corresponds to multiple numerical digits of a number. Exemplarily, some rows of numbers are queried in the same row of characters in the alphabet. For example, there are 4 digits in a number, and the alphabet has 2 rows. The values of the 1st and 3rd digits of the number are queried in the first row of characters in the alphabet, and the values of the 2nd and 4th digits of the number are queried in the second row of characters in the alphabet. For example, the numbers are 1234, where 1 and 3 correspond to the first row of characters in the alphabet, and the characters corresponding to 1 and 3 are queried in the first row of characters, and the characters obtained by the query are short URL characters; 2 and 4 correspond to the second row of characters in the alphabet, and the characters corresponding to 2 and 4 are queried in the second row of characters, and the characters obtained by the query are short URL characters. In the disclosed embodiment, at least some values of the number are queried in different rows of the alphabet, which can increase the randomness and irregularity of generating short URL characters, increase the difficulty of cracking short URLs, solve the problem of information leakage or illegal access, and improve the security of short URLs.
[0072] S205, combining multiple short URL characters together to obtain a short URL.
[0073] In the disclosed embodiment, a short URL can be obtained by connecting multiple short URL characters. For example, the six short URL characters are 7, x, y, 1, h and g, and the short URL obtained by combining 7, x, y, 1, h and g is 7xy1hg.
[0074] In one embodiment, after combining multiple short URL characters to obtain a short URL, the method provided by the embodiment of the present disclosure may further include: associating the short URL with the actual address to obtain association information; and sending the short URL to the first device.
[0075] In the embodiment of the present disclosure, the association information is used to indicate the corresponding relationship between the short URL and the actual address. As long as one of the URL and the actual address is obtained, the other information can be obtained through the association information. The embodiment of the present disclosure does not limit the form of the association information. For example, the association information can be represented in the form of a table, or in the form of a line graph.
[0076] In the present embodiment, the first device may be a user's terminal device or a server's device, which may be selected according to the actual application scenario and specific application experience.
[0077] The present invention converts an M-base short URL serial number into an N-base number, and queries the characters corresponding to the values of each bit in the number in the alphabetical row, to obtain multiple short URL characters, wherein the multiple short URL characters come from different alphabetical rows, thereby increasing the difficulty of cracking the short URL, solving the problem of information leakage or illegal access, and improving the security of the short URL.
[0078] It should be noted that by converting the short URL serial number into a high-base number, the number of different short URLs generated can be increased to accommodate the conversion of a large number of actual addresses into short URLs.
[0079] How to generate a short URL serial number is described below through two exemplary embodiments.
[0080] In an exemplary embodiment, before obtaining the M-ary short URL serial number, the method provided by the embodiment of the present disclosure may further include: obtaining a self-incrementing identifier; and using the self-incrementing identifier as the short URL serial number.
[0081] In the embodiment of the present disclosure, the self-incrementing identifier is sequential and non-repetitive. The embodiment of the present disclosure does not limit what kind of identifier the self-incrementing identifier is. For example, the self-incrementing identifier can be a global self-incrementing identifier, which is a method for uniquely identifying data records. How to obtain the global self-incrementing identifier (ID) has been explained in S201 and will not be repeated here.
[0082] It should be noted that the short URLs generated by the digest algorithm in the related art have collisions. After each short URL is generated, it is necessary to detect and process the collision, which wastes performance and is difficult to process. The embodiment of the present disclosure obtains the short URL serial number by obtaining a self-incrementing identifier. The self-incrementing identifier is non-repetitive, and the converted high-radix numbers are also non-repetitive, thereby ensuring that the generated short URL will not cause collisions. The short URL generated by the present disclosure does not need to detect and process collisions, thereby improving work performance.
[0083] In another exemplary embodiment, Figure 3 As shown, before obtaining the M-ary URL serial number, the method provided by the embodiment of the present disclosure may further include S301 and S302.
[0084] S301, obtaining a self-incrementing identifier.
[0085] In the embodiment of the present disclosure, how to obtain the self-increment identifier has been described in S201 and will not be repeated here.
[0086] S302, reorganize the self-increment identifier to obtain a short URL serial number.
[0087] In one embodiment, reorganizing the self-incrementing identifier to obtain the short URL serial number may include: reversing or scrambling the self-incrementing identifier to obtain the short URL serial number.
[0088] For example, the self-increment identifier is 123456789, and the self-increment identifier 123456789 is reversed to obtain 987654321, and the obtained short URL serial number is 987654321. For another example, 123456789 is exchanged and scrambled (for example, the value of the first digit is exchanged with the value of the last digit, and the remaining digits remain unchanged), and the URL serial number after scrambling is 923456781. In the embodiments of the present disclosure, there are many methods for scrambling, and the embodiments of the present disclosure are not limited. The embodiments of the present disclosure can disrupt the order of the self-increment identifier by reversing or scrambling, thereby ensuring that the self-increment identifier will cause a huge change when it is incremented by 1, so that different actual addresses can be converted into different short URLs, avoiding collisions in the generated short URLs. In the embodiments of the present disclosure, in order to ensure that different self-increment identifiers are different after scrambling, different self-increment identifiers are scrambled in the same way.
[0089] The disclosed embodiment increases the randomness and irregularity of characters in generating short URLs by reorganizing the self-incrementing identifiers, increases the difficulty of cracking short URLs, solves the problem of information leakage or illegal access, and improves the security of short URLs.
[0090] In another embodiment, the self-incrementing identifier is reorganized to obtain a short URL serial number, which may include the following S401 to S403.
[0091] S401, reverse or scramble the self-increment identifier to obtain a reorganized sequence number.
[0092] In the disclosed embodiment, the reorganized sequence number is a value obtained by reversing or scrambling the self-incrementing identifier. How to perform the reversal or scrambling process has been described in the above embodiment and will not be repeated here.
[0093] S402, obtaining a random initial value.
[0094] In the disclosed embodiment, the random initial value may be a preset value, and the specific value of the preset value may be set according to the actual application scenario and specific application experience. For example, the random initial value is 3. It should be noted that the random initial value may be calculated in advance and stored in the configuration or database, and its purpose is to further improve the randomness and irregularity of the short URL sequence number generated by S403.
[0095] S403, obtaining a short URL sequence number according to the reorganized sequence number and the random initial value.
[0096] In the disclosed embodiment, the disclosed embodiment does not limit how to obtain the short URL sequence number based on the reorganized sequence number and the random initial value. For example, the short URL sequence number is obtained by splicing the random initial value to the reorganized sequence number. Exemplarily, the random initial value is spliced to the front of the reorganized sequence number to obtain the short URL sequence number.
[0097] For another example, a mathematical operation is performed on the reorganization sequence number and the random initial value to obtain a short URL sequence number. In the disclosed embodiment, the mathematical operation includes one or a combination of addition, subtraction, multiplication and division operations. Exemplarily, the reorganization sequence number and the random initial value are added to obtain the short URL sequence number. For example, the self-incrementing identifier is 123456789, and the reorganization sequence number obtained by reversing the self-incrementing identifier 123456789 is 987654321, and the random initial value is 2. The reorganization sequence number and the random initial value are added to obtain the URL sequence number 987654323.
[0098] The disclosed embodiment further increases the randomness and irregularity of the short URL sequence number by adding a random initial value and processing the self-incrementing identifier (reorganized serial number) after the inversion or scrambling processing, increases the difficulty of cracking the short URL, solves the problem of information leakage or illegal access, and improves the security of the short URL.
[0099] It should be noted that the short URLs generated by the self-increment sequence in the related art for redirecting to the long URLs have regularity, and it is easy to infer other short URLs based on the regularity of the short URLs, resulting in information leakage or illegal access. The present disclosure increases the randomness and irregularity of the short URL sequence number by reorganizing the self-increment identifier, increases the difficulty of cracking the short URL, solves the problem of information leakage or illegal access, and improves the security of the short URL.
[0100] In the above, two exemplary embodiments are used to illustrate how to generate a short URL serial number. The following is a description of how to generate a two-dimensional alphabet table through several exemplary embodiments.
[0101] In an exemplary embodiment, if Figure 5 As shown, the alphabet may include P rows of characters, where P is an integer greater than 1. Before acquiring the alphabet, the method provided by the embodiment of the present disclosure may further include the following S501 to S503.
[0102] S501, obtaining an initial character array, where the initial character array includes N different characters.
[0103] In the embodiment of the present disclosure, the initial character array is an initial character set including different characters, and the short URL sequence number can be converted into a number in base N according to the initial character array. For example, if the number is a base 62 number, its corresponding base 62 initial character array is shown in Table 2 below.
[0104] Table 2 Initial character array
[0105]
[0106] S502, generating P lines of characters according to the initial character array, wherein each line of characters in the P lines of characters includes N different characters in the initial character array, and the arrangement order of the N characters in each line of characters is different.
[0107] In the disclosed embodiment, multiple lines of character arrays with different orders can be generated based on the initial character array. For example, based on the initial character array of Table 2, an alphabet as shown in Table 1 can be generated, and each line of characters in the alphabet is a character array with different orders. In the disclosed embodiment, the order of the characters in each line of P lines of characters generated based on the initial character array is different, which further increases the difficulty of cracking the short URL, solves the problem of information leakage or illegal access, and improves the security of the short URL.
[0108] In the present embodiment, there is no limitation on the method of generating P rows of characters. For example, the initial character array is shuffled by random permutation to obtain a row of characters. Multiple rows of characters can be obtained by performing random permutations multiple times, and the same row characters are removed from the multiple rows of characters, and then P rows of characters are selected from the row characters without the same row characters as the row characters of the alphabet.
[0109] S503, combining the characters in row P to obtain an alphabet.
[0110] In the disclosed embodiment, the specific values of N and P are not limited and can be set according to the actual application scenario and specific application experience. For example, when a large number of short URLs are needed, the query number can be set to a higher base number (such as base 72), and each row of characters in the alphabet has 72 bits.
[0111] It should be noted that the purpose of using the alphabet is equivalent to increasing the number of bits of the secret key, that is, increasing the complexity of the correspondence between numbers and short address characters. For example, when there are 62 characters in the alphabet, the corresponding 62-decimal numbers query the corresponding short URL characters in the 62 characters. The alphabet is expanded by the method of the embodiment of the present disclosure. For example, the alphabet is expanded to 6 rows of characters, each row of characters has 62 different characters, that is, there are 372 characters in the alphabet, and the corresponding 62-decimal numbers query the corresponding short URL characters in the 372 characters. Numbers in different positions in the numbers can query the corresponding short URL characters in different rows of the alphabet, thereby increasing the difficulty of cracking the short URL, solving the problem of information leakage or illegal access, and improving the security of the short URL.
[0112] In the embodiments of the present disclosure, the overall capacity of short URLs that can be generated can be increased by providing a base number of numbers. For example, the number of digits is increased from base 62 to base 72, and correspondingly, the number of characters in each row of the alphabet is increased from 62 to 72. The overall capacity of short URLs can also be increased by increasing the number of digits of the short URL. For example, the short URL is increased from 6 digits to 8 digits. The embodiments of the present disclosure do not limit how to increase the capacity of short URLs.
[0113] The disclosed embodiment generates an alphabet of multiple lines of characters through an initial character array of a single line of characters. The arrangement order of characters in each line of the alphabet is different, which further increases the difficulty of cracking the short URL, solves the problem of information leakage or illegal access, and improves the security of the short URL.
[0114] In another exemplary embodiment, Figure 6 As shown, randomly generating P rows of characters according to the initial character array may include the following S601 to S603.
[0115] S601, generate N random numbers, where the N random numbers are different numbers in a closed interval from 0 to N-1.
[0116] In the disclosed embodiment, the method for generating N random numbers is not limited. For example, the random numbers can be generated using a pseudo-random algorithm, and it is necessary to ensure that the random numbers are different during the process of generating a row of characters, so that the characters in a row are not repeated.
[0117] S602, querying the character in the initial character array corresponding to each random number in the N random numbers, and obtaining the first row of characters in the alphabet.
[0118] Exemplarily, 62 values in [0, N-1] are randomly generated, and the 62 values are all different. The initial character array is a 62-base character array (i.e., [0-9, az, AZ]), and the corresponding characters are searched from the 62-base character array according to the order of the 62 randomly generated values, and the corresponding characters are arranged in the order of the 62 values to obtain the first row of characters of the two-dimensional alphabet.
[0119] It should be noted that the initial character array may be initialized before querying.
[0120] S603, the method of generating characters from the 2nd row to the Pth row of the alphabet includes the following S6031 to S6036.
[0121] S6031, regenerate N random numbers, where the N random numbers are different numbers in a closed interval from 0 to N-1.
[0122] In the disclosed embodiment, the method of generating N random numbers is the same as that in S601 and will not be described in detail in this embodiment.
[0123] S6032, query the character in the initial character array corresponding to each random number in the regenerated N random numbers, and obtain the i-th row of characters, where the initial value of i is 2, and i is an integer greater than 1 and less than or equal to P.
[0124] In the disclosed embodiment, the initial value of i is 2, and when each row of characters different from the row characters added to the randomly scrambled two-dimensional alphabet is generated, i=i+1, thereby generating P rows of different row characters. See S6033 and S6034.
[0125] S6033, determine whether the characters in the i-th row are the same as the characters in the row added to the alphabet (e.g., the characters in the 1st to i-1th rows). If they are the same as any row in the 1st to i-1th rows, regenerate N random numbers, i.e., execute S6031.
[0126] In the disclosed embodiment, it is determined whether the characters in the i-th row are the same as any row of characters from the 1st row to the i-1th row added to the alphabet. If any row of characters is the same, S6035 is executed.
[0127] S6034: If they are different, add the character in row i to the alphabet.
[0128] S6035, determine whether i is equal to P.
[0129] S6036, if i is not equal to P, then i is assigned to i+1, and N random numbers are regenerated, that is, S6031 is executed. If i is equal to P, then the execution ends.
[0130] The disclosed embodiment generates an alphabet of multiple lines of characters through an initial character array of a single line of characters, and the arrangement order of characters in each line of the alphabet is different, which can increase the difficulty of cracking the short URL and improve the security of the short URL. It can also increase the difficulty of guessing other short URLs and avoid information leakage.
[0131] In another exemplary embodiment, generating P rows of characters according to the initial character array may include: determining whether the number of rows of generated row characters is equal to P; if it is less than P, generating N random numbers, the N random numbers being different numbers in a closed interval of 0 to N-1; querying the character in the initial character array corresponding to each random number in the N random numbers to obtain the row characters to be added; determining whether the row characters to be added are the same as the row characters to be generated; if they are different, adding the row characters to be added to the row characters to be generated.
[0132] For example, Figure 7 As shown, randomly generating P rows of characters according to the initial character array may include S701 to S706.
[0133] S701, determine whether the number of lines of generated characters is equal to P; if it is equal to P, execute S702; if it is less than P, execute S703. It should be noted that before determining the number of lines of characters, the initial character array can be initialized.
[0134] S702, save the alphabet, that is, save the generated row characters.
[0135] S703, generate N random numbers, where the N random numbers are different numbers in a closed interval from 0 to N-1.
[0136] In the embodiment of the present disclosure, how to generate N random numbers is similar to the generation method in S601 and will not be described in detail here.
[0137] S704, querying the character in the initial character array corresponding to each random number in the N random numbers to obtain the character to be added.
[0138] In the embodiment of the present disclosure, the characters in the row to be added are multiple characters obtained by searching in the initial character array according to the value and arrangement order of the random number.
[0139] Exemplarily, 62 values in [0, N-1] are randomly generated, and the 62 values are all different. The initial character array is a 62-base character array (i.e., [0-9, az, AZ]), and the corresponding characters are searched from the 62-base character array according to the order of the 62 randomly generated values, and the corresponding characters are arranged in the order of the 62 values to obtain the row characters of the two-dimensional alphabet.
[0140] S705, determine whether the row character to be added is the same as the generated row character. If they are the same, generate N random numbers, that is, execute S703. If they are different, execute S706.
[0141] S706, adding the row characters to be added to the generated row characters, and determining whether the number of row characters added to the alphabet to be saved is equal to P, that is, executing S701.
[0142] The disclosed embodiment generates an alphabet of multiple lines of characters through an initial character array of a single line of characters, and the arrangement order of characters in each line of the alphabet is different, which can increase the difficulty of cracking the short URL and improve the security of the short URL. It can also increase the difficulty of guessing other short URLs and avoid information leakage.
[0143] The above explains how to generate the alphabet. The following explains how to use the generated short URL.
[0144] In an exemplary embodiment, after sending the short URL to the first device, the method provided by the embodiment of the present disclosure may further include the following steps A1 to A3.
[0145] Step A1: receiving a short URL resolution request sent by a second device, where the short URL resolution request includes a short URL sent by a first device to a second device.
[0146] In the disclosed embodiment, the short URL resolution request is a request for requesting the electronic device to resolve the short URL (obtain the actual address according to the short URL). It should be noted that the short URL resolution request can be a short URL. The system recognizes that the received URL is a short URL and resolves the short URL by default.
[0147] In the disclosed embodiment, the second device may be the same device as the first device described above, or may be different from the first device described above. When different, the first device may send the generated short URL to the second device via a communication method such as a text message or an email. When the second device needs to access the content of the actual address corresponding to the short URL, it may send a short URL resolution request to the electronic device.
[0148] Step A2, obtaining the actual address according to the associated information and the short URL.
[0149] In the disclosed embodiment, the actual address corresponding to the short URL is searched in the associated information.
[0150] Step A3: Send the actual address to the second device.
[0151] The electronic device sends the queried actual address to the second device, and the second device accesses the actual address. It should be noted that the user of the second device cannot see the actual address. After obtaining the actual address, the backend of the second device accesses the actual address and displays the accessed information for the user to browse.
[0152] In the disclosed embodiment, the second device obtains the required actual address by sending a short URL resolution request including the short URL. In other words, the second device accesses the longer long URL through a simple and easy-to-remember short address, which facilitates the user to obtain the required information.
[0153] In another exemplary embodiment, obtaining the actual address according to the associated information and the short URL may include: performing intrusion detection on the short URL resolution request; and obtaining the actual address according to the associated information and the short URL when the intrusion detection passes.
[0154] In the disclosed embodiment, an intrusion detection system can be used to detect intrusions in short URL resolution requests to detect whether there is a malicious attack. For example, if it is detected that the same IP (Internet Protocol) address accesses a large number of different short URLs in a short period of time, the IP address will be blocked. The intrusion detection result is failure, and the actual address cannot be obtained.
[0155] In yet another exemplary embodiment, obtaining the actual address according to the associated information and the short URL may include the following steps B1 to B4.
[0156] Step B1, performing intrusion detection on the short URL resolution request.
[0157] Step B2: if the intrusion detection passes, obtain the authorization information of the second device.
[0158] In the embodiment of the present disclosure, the authorization information is information indicating whether there is access right.
[0159] Step B3: perform authorization check on the authorization information.
[0160] In the disclosed embodiment, authorization information can be checked by a protective wall to prevent malicious traffic from entering the protected network, thereby reducing the risk of the network being attacked by hackers, viruses and other network attacks. Monitoring authorization information is conducive to improving the security of system access.
[0161] Step B4, when the detection is passed, the actual address is obtained according to the associated information and the short URL.
[0162] The disclosed embodiment places an intrusion detection system before acquiring the URL service, thereby greatly improving the security of the short URL.
[0163] Based on the same inventive concept, the present disclosure also provides a short URL generation system, as described in the following embodiments. Since the principle of solving the problem in the system embodiment is similar to that in the above method embodiment, the implementation of the system embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0164] like Figure 8 As shown, the short URL generation system may include: a letter generator 801, a short URL sequence number generator 802, and a short URL generator 803. The alphabet generator 801 may be used to obtain an initial character array, the initial character array includes N different characters; generate P rows of characters according to the initial character array, each row of characters in the P rows of characters includes N different characters in the initial character array, and the arrangement order of the N characters in each row of characters is different; combine the P rows of characters together to obtain an alphabet, where P is a positive integer greater than 1; the short URL sequence number generator 802 may be used to obtain a self-incrementing identifier; reorganize the self-incrementing identifier to obtain an M-based short URL sequence number, where M is a positive integer; the short URL generator 803 may be used to receive the alphabet and the short URL sequence number, convert the M-based URL sequence number into a number in the N-based number, where N is a positive integer greater than M; query the corresponding character of each value in the number in the alphabet row characters to obtain multiple short URL characters; combine multiple short URL characters together to obtain a short URL.
[0165] In one embodiment, if Fig. 9 As shown, the short URL generation system may further include a short URL generation request receiver 804. The short URL generation request receiver 804 may be used to receive a short URL generation request sent by the first device, the short URL generation request including an actual address; send the short URL generation request to the short URL generator 803; receive the short URL sent by the short URL generator 803; associate the short URL with the actual address to obtain association information;
[0166] In one embodiment, if Fig.10 As shown, the short URL generation system may further include a short URL storage device 806. The short URL storage device 806 may be used to receive the associated information sent by the short URL generation request receiver and store the associated information.
[0167] In one embodiment, if Fig.10As shown, the short URL generation system may further include a short URL resolution request receiver 805. The short URL resolution request receiver 805 may be used to receive a short URL resolution request sent by the second device, the short URL resolution request including the short URL sent by the first device to the second device; the short URL storage device 806 may also be used to receive the short URL sent by the short URL resolution request receiver 805, search for an actual address corresponding to the short URL in the associated information, and send the actual address to the URL resolution request receiver 805; the short URL resolution request receiver 805 is also used to send the received actual address to the second device.
[0168] It should be noted that the short URL resolution request will pass through the intrusion detection system to detect whether there is a malicious attack, thereby improving the security of the system. The short URL storage device 806 is placed behind the intranet firewall to further improve storage security.
[0169] The short URL generation system disclosed in the embodiment of the present disclosure converts an M-based short URL serial number into an N-based number, and queries the characters corresponding to the values of each bit in the number in the row of characters of the alphabet to obtain multiple short URL characters. The multiple short URL characters come from different rows of characters in the alphabet, which increases the difficulty of cracking the short URL, solves the problem of information leakage or illegal access, and improves the security of the short URL.
[0170] The present disclosure is explained below through the data processing flow.
[0171] The data processing flow of the present disclosure is as follows: step C1 to step C13.
[0172] Step C1, initialize the alphabet generator and the short URL serial number generator, and inject the alphabet generated by the alphabet generator into the short URL generator.
[0173] Step C2: The user or the server (through the first device) requests the short URL generation request receiver to generate a short URL, and the short URL generation request includes the actual address.
[0174] Step C3: After receiving the request, the short URL generation request receiver calls the short URL generator to generate a short URL.
[0175] Step C4: the short URL generator calls the short URL serial number generator to generate a short URL serial number.
[0176] Step C5: the short URL serial number generator generates a short URL serial number and returns it to the short URL generator.
[0177] Step C6, the short URL generator converts the short URL serial number into a high-base number, searches for the corresponding characters in the alphabet through the number, and combines them into a short URL and returns it.
[0178] Step C7, the short URL request receiver associates the actual address with the short URL, obtains association information, and stores the association information in the short URL storage device.
[0179] Step C8: the short URL request receiver returns the short URL to the first device.
[0180] Step C9: The first device distributes the short URL to other users (such as users of the second device) through other channels such as text messages, emails, etc.
[0181] Step C10, other users request the short URL resolution request receiver to resolve the short URL.
[0182] In step C11, the short URL resolution request will be passed through the intrusion detection system to detect whether there is a malicious attack. For example, if it is detected that the same IP address accesses a large number of different short URLs in a short period of time, the IP address will be blocked. If the intrusion detection passes, step C12 is executed.
[0183] Step C12, the short URL resolution request receiver searches the short URL storage device and searches the associated information for the actual address corresponding to the short URL. It should be noted that the short URL storage device can be placed behind the intranet firewall to further improve storage security.
[0184] Step C13: the short URL resolution request receiver returns the corresponding actual address.
[0185] Compared with the digest algorithm, the present disclosure can ensure that the generated short URLs are non-repetitive, thus avoiding collision detection and complicated subsequent processing (such as regenerating short URLs, repeating detection, etc.).
[0186] Compared with the self-incrementing sequence, the present invention greatly improves the randomness and irregularity of the generated short URLs by expanding the alphabet into a two-dimensional alphabet and adding randomness and reverse scrambling to the self-incrementing sequence, preventing users from guessing other existing short URLs, and placing an intrusion detection system before the short URL resolution request service, greatly improving security and avoiding information leakage.
[0187] After the auto-increment identifier is reorganized, the auto-increment identifier can be greatly changed by increasing by 1. On this basis, adding a preset random initial value will make the result even more unpredictable. Because the auto-increment identifier is unique, the auto-increment identifier is still unique after being caused by a unified rule or scrambled. On this basis, adding a fixed random initial value can still ensure the uniqueness of the result, but the randomness and unpredictability are greatly increased.
[0188] The alphabet is randomly scrambled, which can further enhance randomness. Basically, it is impossible for the attacker to predict the value of the next short URL without knowing the alphabet scrambling rules and the random superposition values of the self-incrementing sequence. An example is shown below, where currentId is the current self-incrementing identifier (such as a global self-incrementing identifier), and shortUrl is the short URL generated according to the self-incrementing identifier in accordance with the present disclosure. It can be seen that there is almost no regularity.
[0189] currentId=1000, shortUrl=j0O4Rb; currentId=1001, shortUrl=D7vZT7;
[0190] currentId=1002, shortUrl=SpuOwR; currentId=1003, shortUrl=TH64mL;
[0191] currentId=1004, shortUrl=cWdZUZ; currentId=1005, shortUrl=oDyT4d;
[0192] currentId=1006, shortUrl=x1D4dt; currentId=1007, shortUrl=2MjZ8e;
[0193] currentId=1008, shortUrl=YJ3ObV; currentId=1009, shortUrl=Ns94AO;
[0194] currentId=1010, shortUrl=ywsZzM; currentId=1011, shortUrl=rANTqf;
[0195] currentId=1012, shortUrl=tf24tK; currentId=1013, shortUrl=9ScZWn;
[0196] currentId=1014, shortUrl=i3RO5p; currentId=1015, shortUrl=A8b4kN;
[0197] currentId=1016, shortUrl=6XEv6B; currentId=1017, shortUrl=nU1ONl;
[0198] currentId=1018, shortUrl=aJt4u4; currentId=1019, shortUrl=zoPZeu;
[0199] currentId=1020, shortUrl=hGlOoc; currentId=1021, shortUrl=3zL4c8;
[0200] currentId=1022, shortUrl=W65ZnH; currentId=1023, shortUrl=gT7Thk;
[0201] currentId=1024, shortUrl=ITZXp; currentId=1025, shortUrl=YQyseH;
[0202] currentId=1026, shortUrl=5EaUvc; currentId=1027, shortUrl=ylDXi8;
[0203] currentId=1028, shortUrl=fcFtnB; currentId=1029, shortUrl=tu6U9l;
[0204] currentId=1030, shortUrl=0qvXY4; currentId=1031, shortUrl=iOHs7u;
[0205] currentId=1032, shortUrl=DPzUgV; currentId=1033, shortUrl=6EfXQO;
[0206] currentId=1034, shortUrl=TuStWM; currentId=1035, shortUrl=aQnURf;
[0207] currentId=1036, shortUrl=oZAXKK; currentId=1037, shortUrl=hqgs2n.
[0208] Based on the same inventive concept, the present disclosure also provides a short URL generation device, as described in the following embodiments. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the system embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0209] Fig.11 A schematic diagram of a device for generating a short URL in an embodiment of the present disclosure is shown. Fig.11 As shown, the short URL generation device includes an acquisition module 1101, a conversion module 1102, a query module 1103 and a combination module 1104. The acquisition module 1101 can be used to acquire a short URL serial number in M-base, where M is a positive integer; the conversion module 1102 can be used to convert the short URL serial number into a number in N-base, where N is a positive integer greater than M; the acquisition module 1101 can also be used to acquire an alphabet, where the alphabet includes multiple row characters; the query module 1103 can be used to query the characters corresponding to the values of each bit in the number in the row characters of the alphabet, and obtain multiple short URL characters, where the multiple short URL characters come from different row characters of the alphabet; the combination module 1104 can be used to combine multiple short URL characters together to obtain a short URL.
[0210] In one embodiment, the number of digits in the number is P, the alphabet includes P rows of characters, and P is an integer greater than 1; the query module 1103 can also be used to query the character corresponding to the value of the i-th digit in the number in the i-th row of characters in the alphabet to obtain the i-th short URL character, where i is an integer greater than 0 and less than or equal to P.
[0211] In one embodiment, before obtaining the M-ary short URL serial number, the obtaining module 1101 can also be used to obtain a self-incrementing identifier; and reorganize the self-incrementing identifier to obtain the short URL serial number.
[0212] In one embodiment, the acquisition module 1101 can also be used to reverse or scramble the auto-increment identifier to obtain a reorganized sequence number; obtain a random initial value; and obtain a short URL sequence number based on the reorganized sequence number and the random initial value.
[0213] In one embodiment, the alphabet includes P rows of characters, where P is an integer greater than 1; before obtaining the alphabet, the acquisition module 1101 can also be used to obtain an initial character array, which includes N different characters; P rows of characters are generated according to the initial character array, each row of characters in the P rows of characters includes N different characters in the initial character array, and the arrangement order of the N characters in each row of characters is different; the P rows of characters are combined together to obtain the alphabet.
[0214] In one embodiment, the acquisition module 1101 can also be used to determine whether the number of rows of generated row characters is equal to P; if it is less than P, N random numbers are generated, and the N random numbers are different numbers in the closed interval of 0 to N-1; query the character in the initial character array corresponding to each random number in the N random numbers to obtain the row character to be added; determine whether the row character to be added is the same as the row character that has been generated; if different, add the row character to be added to the generated row character.
[0215] In one embodiment, before obtaining the M-hexadecimal short URL serial number, the acquisition module 1101 can also be used to receive a short URL generation request sent by the first device, and the short URL generation request includes an actual address; the short URL generation device can also include a sending module 1105, and the sending module 1105 can be used to associate the short URL with the actual address to obtain association information; and send the short URL to the first device.
[0216] In one embodiment, after sending the short URL to the first device, the short URL generation device may further include a parsing module 1106, which may be used to receive a short URL resolution request sent by the second device, the short URL resolution request including the short URL sent by the first device to the second device; obtain the actual address based on the associated information and the short URL; and send the actual address to the second device.
[0217] In one embodiment, the parsing module 1106 can also be used to perform intrusion detection on the short URL resolution request; when the intrusion detection passes, the actual address is obtained based on the associated information and the short URL.
[0218] The short URL generation device disclosed in the embodiment of the present disclosure converts an M-based short URL serial number into an N-based number, and queries the character corresponding to the value of each bit in the number in the row of characters of the alphabet to obtain multiple short URL characters. The multiple short URL characters come from different rows of characters in the alphabet, which increases the difficulty of cracking the short URL, solves the problem of information leakage or illegal access, and improves the security of the short URL.
[0219] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0220] Refer to the following Fig.12 1200 according to this embodiment of the present disclosure is described. Fig.12 The electronic device 1200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0221] like Fig.12 As shown, the electronic device 1200 is in the form of a general computing device. The components of the electronic device 1200 may include but are not limited to: at least one processing unit 1210, at least one storage unit 1220, and a bus 1230 connecting different system components (including the storage unit 1220 and the processing unit 1210).
[0222] The storage unit stores program codes, which can be executed by the processing unit 1210, so that the processing unit 1210 executes the steps described in the above “exemplary method” section of this specification according to various exemplary embodiments of the present disclosure.
[0223] The storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 12201 and / or a cache storage unit 12202 , and may further include a read-only storage unit (ROM) 12203 .
[0224] The storage unit 1220 may also include a program / utility 12204 having a set (at least one) of program modules 12205, such program modules 12205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0225] Bus 1230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0226] The electronic device 1200 may also communicate with one or more external devices 1240 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1200, and / or communicate with any device that enables the electronic device 1200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1250. Furthermore, the electronic device 1200 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1260. As shown, the network adapter 1260 communicates with other modules of the electronic device 1200 via a bus 1230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0227] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0228] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is further provided, which may be a readable signal medium or a readable storage medium, on which a program product capable of implementing the above method of the present disclosure is stored.
[0229] In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present disclosure described in the above "Specific Implementation Methods" section of this specification.
[0230] More specific examples of computer-readable storage media in the present disclosure may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0231] In the present disclosure, a computer readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, wherein a readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0232] Alternatively, the program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0233] In a specific implementation, the program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0234] The embodiment of the present disclosure provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the short URL generation method provided in various optional ways in any embodiment of the present disclosure.
[0235] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0236] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0237] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The description and examples are to be regarded as exemplary only, and the true scope of the present disclosure is indicated by the appended claims.
Claims
1. A method for generating a short URL, characterized in that: include: Get the short URL serial number in M-base, where M is a positive integer; Convert the short URL serial number into a base-N number, where N is a positive integer greater than M; Obtaining an alphabet, the alphabet comprising a plurality of rows of characters; Query the characters corresponding to the values of each bit in the number in the row of characters in the alphabet to obtain a plurality of short URL characters, wherein the plurality of short URL characters are from different rows of characters in the alphabet; The multiple short URL characters are combined together to obtain a short URL.
2. The method according to claim 1, characterized in that The number of digits is P, the alphabet includes P characters, and P is an integer greater than 1; The characters corresponding to the values of each bit in the number in the row characters of the alphabet are queried to obtain a plurality of short URL characters, including: The character corresponding to the value of the i-th position in the number in the i-th row of characters in the alphabet is queried to obtain the i-th short URL character, where i is an integer greater than 0 and less than or equal to P.
3. The method according to claim 1, characterized in that Before obtaining the M-ary short URL serial number, the method further includes: Get the auto-increment identifier; The self-incrementing identifier is reorganized to obtain the short URL sequence number.
4. The method according to claim 3, characterized in that The self-incrementing identifier is reorganized to obtain the short URL sequence number, including: Reversing or scrambling the self-incrementing identifier to obtain a reorganized sequence number; Get a random initial value; The short URL sequence number is obtained according to the reorganized sequence number and the random initial value.
5. The method according to claim 1, characterized in that The alphabet includes P characters, where P is an integer greater than 1; Before obtaining the alphabet, the method further includes: Obtain an initial character array, wherein the initial character array includes N different characters; Generate P rows of characters according to the initial character array, each row of characters in the P rows of characters includes N different characters in the initial character array, and the arrangement order of the N characters in each row of characters is different; The P rows of characters are combined together to obtain the alphabet.
6. The method according to claim 5, characterized in that Generate P rows of characters according to the initial character array, including: Determine whether the number of lines of generated characters is equal to P; If it is less than P, N random numbers are generated, and the N random numbers are different numbers in the closed interval from 0 to N-1; Query the character in the initial character array corresponding to each random number in the N random numbers to obtain the character to be added; Determine whether the row character to be added is the same as the generated row character; If they are different, the row character to be added is added to the generated row character.
7. The method according to claim 1, characterized in that Before obtaining the M-ary short URL serial number, the method includes: Receiving a short URL generation request sent by a first device, wherein the short URL generation request includes an actual address; After combining the multiple short URL characters to obtain a short URL, the method further includes: Associating the short URL with the actual address to obtain association information; Send the short URL to the first device.
8. The method according to claim 7, characterized in that After sending the short URL to the first device, the method further includes: Receiving a short URL resolution request sent by a second device, wherein the short URL resolution request includes the short URL sent by the first device to the second device; Obtaining the actual address according to the associated information and the short URL; The actual address is sent to the second device.
9. The method according to claim 8, characterized in that Obtaining the actual address according to the associated information and the short URL includes: Performing intrusion detection on the short URL resolution request; When the intrusion detection passes, the actual address is obtained according to the associated information and the short URL.
10. A device for generating a short URL, characterized in that: include: The acquisition module is used to obtain the M-base short URL serial number, where M is a positive integer; A conversion module, used for converting the short URL serial number into a number in base N, where N is a positive integer greater than M; The acquisition module is further used to acquire an alphabet, wherein the alphabet includes a plurality of rows of characters; A query module, used for querying the characters corresponding to the values of each bit in the number in the row characters of the alphabet, and obtaining a plurality of short URL characters, wherein the plurality of short URL characters are from different rows of characters of the alphabet; The combining module is used to combine the multiple short URL characters together to obtain a short URL.
11. A website generation system, characterized in that: include: An alphabet generator is used to obtain an initial character array, the initial character array includes N different characters; generate P rows of characters according to the initial character array, each row of characters in the P rows of characters includes N different characters in the initial character array, and the arrangement order of the N characters in each row of characters is different; combine the P rows of characters together to obtain the alphabet, where P is a positive integer greater than 1; A short URL serial number generator is used to obtain a self-incrementing identifier; reorganize the self-incrementing identifier to obtain an M-base short URL serial number, where M is a positive integer; A short URL generator is used to receive the alphabet and the short URL serial number, convert the M-base URL serial number into an N-base number, where N is a positive integer greater than M; query the value of each bit in the number for the character corresponding to the row character in the alphabet to obtain a plurality of short URL characters; The multiple short URL characters are combined together to obtain a short URL.
12. The system according to claim 11, characterized in that The system further comprises: A short URL generation request receiver, configured to receive a short URL generation request sent by the first device, wherein the short URL generation request includes an actual address; send the short URL generation request to the short URL generator; receive the short URL sent by the short URL generator; associate the short URL with the actual address to obtain association information; The short URL storage device is used to receive the associated information sent by the short URL generation request receiver and store the associated information.
13. The system according to claim 12, characterized in that The system further comprises: A short URL resolution request receiver, configured to receive a short URL resolution request sent by a second device, wherein the short URL resolution request includes the short URL sent by the first device to the second device; The short URL storage device is further used to receive the short URL sent by the short URL resolution request receiver, search the association information for the actual address corresponding to the short URL, and send the actual address to the URL resolution request receiver; The short URL resolution request receiver is further configured to send the received actual address to the second device.
14. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the short URL generation method according to any one of claims 1 to 9 by executing the executable instructions.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a short URL as described in any one of claims 1 to 9 is implemented.
16. A computer program product, comprising a computer program or computer instructions, characterized in that: The computer program or the computer instruction is loaded and executed by a processor, so that the computer implements the short URL generation method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device for ensuring desensitization certainty based on multi-group data arrangement
CN114077754A
Converting data into addresses
US8499099B1
