CN112417326A - URL conversion method and device, electronic equipment and storage medium - Google Patents

URL conversion method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112417326A
CN112417326A CN202011316358.7A CN202011316358A CN112417326A CN 112417326 A CN112417326 A CN 112417326A CN 202011316358 A CN202011316358 A CN 202011316358A CN 112417326 A CN112417326 A CN 112417326A
Authority
CN
China
Prior art keywords
url
identification
character
replacement
rule
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011316358.7A
Other languages
Chinese (zh)
Inventor
莫康波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202011316358.7A priority Critical patent/CN112417326A/en
Publication of CN112417326A publication Critical patent/CN112417326A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a Uniform Resource Locator (URL) conversion method, relates to the technical field of computers, and can be used in the field of cloud platforms. The specific implementation scheme is as follows: in response to receiving a translation request for a first URL, determining a first identification ID generated for the first URL; and converting to obtain a second URL corresponding to the first URL based on the preset replacement character set, the character position exchange rule set and the first identification ID.

Description

URL conversion method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of computers, can be used in the field of cloud platforms, and more particularly relates to a method and a device for converting a Uniform Resource Locator (URL), an electronic device and a storage medium.
Background
The short URL generation service functions to map a longer URL to a shorter URL. When the user accesses the short URL, the short URL service restores the short URL to a corresponding long URL, and returns the webpage content pointed by the original long URL to the user by using the jumping capability of the browser.
Disclosure of Invention
The application provides a Uniform Resource Locator (URL) conversion method and device, electronic equipment and a storage medium.
According to a first aspect, there is provided a method for converting a uniform resource locator URL, comprising: in response to receiving a conversion request for a first URL, determining a first identification ID generated for the first URL; and converting to obtain a second URL corresponding to the first URL based on a preset replacement character set, a character position exchange rule set and the first identification ID.
According to a second aspect, there is provided a device for converting a uniform resource locator URL, comprising: a determining module, configured to determine, in response to receiving a conversion request for a first URL, a first identification ID generated for the first URL; and a conversion module, configured to convert, based on a preset replacement character set, a character position exchange rule set, and the first identifier ID, to obtain a second URL corresponding to the first URL.
According to a third aspect, there is provided an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; 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 execute the method of the embodiment of the present application.
According to a fourth aspect, there is provided a non-transitory computer readable storage medium having computer instructions stored thereon, comprising: the computer instructions are used for causing the computer to execute the method of the embodiment of the application.
According to the embodiment of the application, after the incremental ID corresponding to the long URL is converted by replacing the character set, the related operation of character position adjustment is also executed to finally generate the short URL, so that the difficulty of violently guessing the front short URL and the rear short URL can be increased, and the safety is improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present application, nor do they limit the scope of the present application. Other features of the present application will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
fig. 1 illustrates a system architecture of a URL conversion method and apparatus suitable for the embodiments of the present application;
FIG. 2 illustrates a flow diagram of a method of converting a URL according to an embodiment of the present application;
FIG. 3 illustrates a schematic diagram of a method for converting a URL according to an embodiment of the present application;
fig. 4 is a block diagram illustrating a URL conversion apparatus according to an embodiment of the present application; and
fig. 5 is a block diagram illustrating an electronic device for implementing the URL conversion method according to an embodiment of the present disclosure.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The normal short URL service may generate a new short URL by incrementing the ID (last order increment by 1) to indicate a new long URL. For example, the short URL service currently generates a short URL of UAx2A, and the short URL generated for the next long URL would be UAx 2B. Therefore, the self-increment ID mode with the last order increasing by 1 is easy to cause the front and back short URLs to be guessed, namely, the ordinary short URL service is easy to deduce the front and back links of each short URL, especially when the short URL service is used for a large number of long URLs containing privacy information, the non-self information is easy to obtain by modifying the short URLs, thereby causing the user information leakage. For example, when a normal short URL generation service is used for an order URL, the a user obtains the short URL of his order as D2Cbb, and if the a user changes the short URL to D2Cbc, the a user may view the order information of other users, thereby causing user information leakage.
By applying a hash algorithm (e.g., md5, crc32, etc.) to long URLs to obtain a relatively short URL, certain "discontinuities" may be provided, thereby avoiding "brute force" of short URLs. However, the hash algorithm usually has a longer operation result, for example, the operation result of md5 is usually 32 characters, and the operation result of crc32 can be up to 10 characters. It can be seen that the short URL generated by the short URL service is relatively long, which wastes character space, and the hash collision problem of the hash algorithm itself can result in that the one-to-one correspondence between the short URL and the long URL cannot be guaranteed. For example, for a short URL with a length of 5 characters, multiple long URLs may generate the same short URL with a length of 5 characters through a hash algorithm, and it cannot be guaranteed that the long URLs correspond to the short URLs one by one.
An ideal short URL service should be able to represent as many long URLs as possible through a limited character space and ensure that short URLs correspond to long URLs one-to-one.
In view of the above, the embodiments of the present application provide an improved URL conversion scheme, which can overcome the above-mentioned drawbacks. The inventive concept of the embodiment of the application is as follows: for each request for generating the short URL, the self-increment ID value is enabled to be +1, then the preset 'replacement character set' is used for converting the ID value into characters in the 'replacement character set', and finally the positions of the characters are exchanged according to a certain rule and then the short URL is output.
The present application will be described in detail with reference to specific examples.
The system architecture of the URL conversion method and apparatus suitable for the embodiment of the present application is described as follows.
Fig. 1 illustrates a system architecture of a URL conversion method and apparatus suitable for the embodiments of the present application. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present application may be applied to help those skilled in the art understand the technical content of the present application, but does not mean that the embodiments of the present application may not be used in other environments or scenarios.
As shown in fig. 1, system architecture 100 may include a client 101, a server 102, and a database 103. Under the condition that a user initiates a request for converting a long URL into a short URL through a client 101, a server 102 receives and responds to the request, firstly generates an identification ID through a short URL service, then converts the identification ID value into characters in a 'replacement character set' by using a preset 'replacement character set', and finally outputs the short URL after the positions of the characters are exchanged according to a certain rule. The short URL and the mapping relationship between the short URL and its corresponding long URL are then stored by the database 103.
It should be understood that the number of clients, servers, and databases in FIG. 1 is merely illustrative. There may be any number of clients, servers, and databases, as desired for implementation.
Application scenarios of the URL conversion method and apparatus suitable for the embodiment of the present application are described below.
It should be understood that short URLs are generally used where the length of content is limited, such as short messages, IM messages (instant messaging messages). In contrast, long URLs are typically used where the length of the content is long, e.g., a long URL may point to web page content. However, long URLs are too long and complex to be easily entered and remembered by the user. The short URL is just the opposite, not only short, but also simple, and is convenient for the user to input and memorize. Thus, in an application scenario where a long URL needs to be used, the long URL may be mapped to a short URL, and the short URL and the mapping relationship between the short URL and its corresponding long URL may be stored. When the user accesses the short URL, the short URL service restores the short URL to a corresponding long URL, and returns the webpage content pointed by the original long URL to the user by using the jumping capability of the browser.
For example, a long URL is represented as follows:
https://mbd.XXX.com/newspage/data/landingsharepageType=1&isBdboxFrom=1&context=%7B%22nid%22%3A%22news_9150874672365962997%22%2C%22sourceFrom%22%3A%22bjh%22%7D
the short URL to which the long URL maps may be expressed as follows:
https://mi.mbd.XXX.com/r/9Tctw4Dudq
it is clear that short URLs are more convenient for the user to enter and remember. The user may directly input the short URL to obtain the web content pointed to by the long URL.
According to an embodiment of the present application, a method for converting a URL is provided.
Fig. 2 illustrates a flowchart of a URL conversion method according to an embodiment of the present application.
As shown in fig. 2, the method 200 may include operations S210 and S220, for example.
In operation S210, in response to receiving a conversion request for a first URL, a first identification ID generated for the first URL is determined.
In operation S220, a second URL corresponding to the first URL is converted based on the preset replacement character set, the character position exchange rule set, and the first ID.
It should be noted that, in the embodiment of the present application, the first URL may be a long URL, and the second URL may be a short URL. The application scene can facilitate the user to use and memorize the URL.
In one embodiment, when a user initiates a request for converting a long URL into a short URL through a client, a server responds to receiving the request, generates an identification ID through a short URL service, replaces the identification ID value with a relevant character in a preset replacement character set to obtain a character string, and then exchanges the position of the relevant character in the character string according to a preset character position exchange rule in the rule set to output a short URL. Finally, the short URL and the mapping relationship between the short URL and the long URL carried in the request may be stored in a database.
Further, in one embodiment, the first identification ID in operation S210 may be obtained by a self-increment ID, for example.
Compared with the prior art that the short URL is generated aiming at the long URL through the self-increment ID, or the self-increment ID is generated aiming at the long URL firstly, and then the self-increment ID is converted based on the preset replacing character set to obtain the short URL corresponding to the long URL, the embodiment of the application can execute the related operation of character position adjustment after the self-increment ID is converted through the preset replacing character set, so that the difficulty that the front short URL and the rear short URL are guessed violently can be increased, and the short URL is safer when used for private information or sensitive information.
As an alternative embodiment, the replacement character set may be generated by: selecting a plurality of specific characters; and randomly scrambling the order of the plurality of specific characters to generate a replacement character set.
In the embodiment of the present application, the replacement character set and the character position exchange rule set referred to in operation S220 may be generated in advance and stored in the short URL generation apparatus to be used when generating the short URL by the short URL service.
Illustratively, the step of generating the replacement character set is as follows: 1) selecting a plurality of specific characters, wherein the selection rule is that the characters can be easily recognized and input by human beings, such as the following 82 characters can be selected: abcdefghijklmnfprwyzabcdefghijklmnopqrstuvwxyz 123456789! @ # $% & () - [ ] { } < >; 2) randomly scrambling the plurality of characters selected in step 1) to generate the replacement character set according to the embodiment of the present application, so as to prevent the arrangement order of the characters included in the replacement character set from being "violently guessed", for example, for the above 82 characters, the replacement character set obtained after random scrambling may be: 3XtLBq ═ Ku {9kIa) [6m > A7sW @ y (e ] fR Yhz _ QjxvlUc 8! M } S1Dd + O5Gg-TPbnpnJ2FZ 4% VH ioE # & w ^ C $ r <.
According to the embodiment of the application, when the replacement character set is generated, the technical means of randomly disordering the arrangement sequence of the selected characters in the replacement character set is adopted, so that even though a user can know which characters are contained in the replacement character set through violent guessing, the arrangement sequence of the characters is difficult to guess, the safety of the replacement character set can be improved, and meanwhile, when the short URL generated based on the replacement character set is used for private information or sensitive information, the short URL is safe.
In addition, in the embodiment of the present application, since the first identification ID can be obtained by a self-increment ID, and a certain number of characters can be selected for the replacement character set, it is possible to represent as many long URLs as possible by fully utilizing a character space through a limited character length range, and simultaneously make the generated short URL difficult to guess the values before and after the short URL, so that the short URL becomes safer when used for private information or sensitive information. Illustratively, the incremental ID value may be generated using a 10-ary incremental ID system of int64 bits.
As an alternative embodiment, the number of rules included in the character position exchange rule set is greater than a preset value. It should be noted that, in the embodiment of the present application, the greater the number of rules, the higher the security. This is because the more the number of rules, the less likely it is that all rules are guessed.
Illustratively, the step of generating the character position swapping rule set is as follows: 1) determining the number of the exchange rules, wherein the more the number of the rules is, the higher the safety is; 2) the character position exchange order of each exchange rule is determined. For example, the first bit is swapped with the fourth bit and the second bit is swapped with the third bit.
For example, the character position exchanging rule obtained by the above scheme may include: rule 0, the first bit is swapped with the fourth bit, and the second bit is swapped with the third bit; rule 1, the first bit is exchanged with the second bit, and the third bit is exchanged with the fourth bit; rule 2, the first bit is swapped with the third bit, the third bit is swapped with the fourth bit, and the second bit is swapped with the fifth bit.
It should be noted that, in the embodiment of the present application, all rules in the character position exchange rules may be selected simultaneously when performing character position exchange, and one or more rules may also be selected for use according to actual needs. The selection method of the swapping rule may include multiple methods, and the embodiments of the present application are not limited herein.
As an alternative embodiment, converting the second URL corresponding to the first URL based on the preset replacement character set, the character position exchange rule set, and the first identification ID may include, for example, the following operations.
And representing the first identification ID as a second identification ID by using the corresponding replacing character in the replacing character set.
Based on the second identification ID, a target rule is selected from the character position exchange rule set.
And performing character position swapping on the second identification ID based on the target rule to obtain a second URL.
In one embodiment, the length of the replacement character set may be determined, then the first ID value is subjected to successive quotient calculation and remainder calculation, and then the character on the corresponding bit in the replacement character set is found according to the obtained remainder to represent the first ID.
In addition, in the embodiment of the present application, a preset algorithm may be executed on the second identifier ID, so that the target rule is selected from the character position exchange rule set according to an algorithm execution result.
Through the embodiment of the application, a plurality of rules can be configured in the character position exchange rule set, but one or more rules can be selected in actual use, so that the difficulty of violently guessing the used exchange rule can be increased, and the safety is improved.
Further, as an alternative embodiment, the first identification ID may be an N-ary number, such as binary, decimal, hexadecimal, etc. Correspondingly, representing the first identification ID as the second identification ID with a corresponding replacement character in the replacement character set may, for example, comprise the following operations.
The length M of the replacement character set is determined. Where M is equal to the total number of characters contained in the replacement character set.
And converting the first identification ID in the N system into a third identification ID in the M system based on the determined length M.
And replacing the numerical value of each digit in the third identification ID with the corresponding replacement character in the replacement character set according to the sequence of the replacement characters in the replacement character set to obtain the second identification ID.
For example, assume that the alternative character set used in the embodiment of the present application is as follows:
3XtLBq=Ku{9kIa)[6m>A7sW@y(e]fR~Yhz_QjxvlUc8!M}S1Dd+O5Gg-TPbnpNJ2FZ4%VH*ioE#&w^C$r<
it can be determined that M is 82 in this case. Further, assume that the first ID obtained by the incremental ID system after performing the increment operation by 1 is 36219082. At this time, the operation of converting 36219082 in the 10 th system into 82 th system is as follows:
36219082/82 is 441696 or more than 10
441696/82 ═ 5386 and rest 44
5386/82 ═ 65 or more 56
65/82-0 or 65
Thus, 10-ary 36219082 may be represented by an 82-ary number as: (65)(56)(44)(10).
As shown in fig. 3, the above-mentioned replacement character set has character "Z" at position 66, character "T" at position 57, character "M" at position 45, and character "9" at position 11. Therefore, the 82-system (65) (56) (44) (10) is represented by the characters in the 'replacement character set' as follows: ZTM 9. ZTM9 is the second ID obtained in the embodiments of the present application.
Further, as an alternative embodiment, the selection of the target rule from the character position swapping rule set based on the second identification ID may include, for example, the following operations.
Each character in the second identification ID is represented as a K-ary number.
And calculating the accumulated sum of the K-system numbers corresponding to all the characters in the second identification ID.
The number of pieces of the character position exchanging rules included in the character position exchanging rule set is determined.
And determining a selection target rule based on the accumulated sum and the number of the strips.
In an embodiment of the present application, each character in the second identifier ID may be represented as a 10-ary number in an ASCII code table, the 10-ary numbers representing all characters in the second identifier ID are summed up, the sum is modulo by the number of the rules included in the character position exchange rule, and finally, a rule that needs to be used currently is selected from the character position exchange rules according to the modulo calculation result. The rule selection mode can determine the encryption and decryption rules more easily.
Illustratively, in the case where the second identification ID is ZTM9, each character in the string ZTM9 is expressed as: z > 90, T > 84, M > 77, 9 > 57. Accumulating the decimal representation of each character to obtain an accumulated value, namely: 90+84+77+ 57-308. The accumulated value is subjected to modulo operation based on the number of the character position exchange rule set to obtain a corresponding operation result, namely: the operation result 2 indicates that "rule 2" in "character position swapping rule set" can be selected for use, that is, the "rule 2" is swapped between the first bit and the third bit, the third bit and the fourth bit, and the second bit and the fifth bit "to process ZTM9 in this example, so as to obtain MT 9Z.
According to the embodiment of the application, the accumulation sum of the decimal representation of each character in one character string is not influenced by the character sequencing, so that the accumulation sum of the decimal representation of the short URL is the same as the accumulation sum of the decimal representation of each character in the character string before the character position is exchanged no matter what the short URL finally obtained after the character position is exchanged, and therefore the rule used for decoding the short URL can be conveniently deduced.
As an alternative embodiment, the method may further comprise: after the second identification ID is obtained, a specific domain name is added to the second identification ID.
Specifically, a specific domain name may be added to the second identification ID according to the format of the browser and the protocol used, so as to ensure that the short URL generated for the long URL can be used normally.
The present application is described in detail below with reference to one specific embodiment.
In response to a request to turn a long URL into a short URL, the short URL service will:
1) the "self-increment ID" is subjected to an increment operation of 1.
2) Converting the ID value obtained in the step 1) into a system of the length of the replacement character set through a system conversion algorithm. Taking the 82-bit "replacement character set" in the above embodiment as an example, and assuming that the "incremental ID" value after adding 1 incremental is 36219082, this step converts 36219082 in 10 scale into 82 scale representation:
36219082/82 is 441696 or more than 10
441696/82 ═ 5386 and rest 44
5386/82 ═ 65 or more 56
65/82-0 or 65
Thus, 10-ary 36219082 is represented by 82-ary: (65)(56)(44)(10). With continued reference to FIG. 3, the 66 th character of the "replacement character set" is "Z", the 57 th character bit is "T", the 45 th bit is "M", and the 11 th bit is "9". Therefore, 36219082 in 10-ary is represented by characters in the "replacement character set" as: ZTM 9.
3) Expressing the character string ZTM9 obtained in 2) in accordance with the decimal system of ASCII code table, and accumulating the decimal system expression of each character: z > 90, T > 84, M > 77, 9 > 57: 90+84+77+ 57-308.
4) And (3) the accumulated value obtained in the step (3) is modulo the number of the pieces of the character position exchange rule set, namely: 308% 3 ═ 2. Therefore, according to the calculation result, the example can be processed by using "rule 2, exchanging the first bit with the third bit, exchanging the third bit with the fourth bit, exchanging the second bit with the fifth bit" in the present embodiment.
5) The character string obtained in 2) is processed using the "character position exchange rule set" determined in 4) and the final "short URL" is obtained.
The above example here is a process: 2) the resulting string: ZTM 9. 4) The determined swap rule: "rule 2. the first bit is swapped with the third bit, the third bit is swapped with the fourth bit, and the second bit is swapped with the fifth bit". Thus the final "short URL" is: ZTM9 > MTZ9 (first bit swapped with third bit) > MT9Z (third bit swapped with fourth bit) > MT9Z (the "second bit swapped with fifth bit" discard is not performed because the current bit length is not five bits long).
And adding the final 'short URL' with a domain name and returning the domain name to the caller, for example, adding https: com/load "MT 9Z" previously obtained "https: com/MT9Z ".
It should be noted that, for short URLs used in web scenes, adding a domain name can ensure that the short URL meets the requirements of the browser on the format of the URL and the protocol used. For the scene that the short URL is used on the same set of equipment or the same APP, the domain name does not need to be added.
According to the embodiment of the application, the application also provides a URL conversion device.
Fig. 4 is a block diagram illustrating a URL conversion apparatus according to an embodiment of the present application.
As shown in fig. 4, the apparatus 400 may include: a determination module 410 and a conversion module 420. It should be understood that the apparatus may be used to implement the method as shown in fig. 2.
A determining module 410 is configured to determine, in response to receiving a translation request for a first URL, a first identification ID generated for the first URL.
The conversion module 420 is configured to obtain a second URL corresponding to the first URL by conversion based on the preset replacement character set, the character position exchange rule set, and the first identifier ID.
Through the embodiment of the application, after the self-increment ID is converted through the preset replacing character set, the related operation of character position adjustment is also executed, so that the difficulty that the front short URL and the rear short URL are guessed violently can be increased, and the short URL is safer when used for private information or sensitive information.
As an alternative embodiment, the conversion module may include: and the character replacing unit is used for representing the first identification ID as the second identification ID by using the corresponding replacing character in the replacing character set. And the rule selecting unit is used for selecting the target rule from the character position exchange rule set based on the second identification ID. And the character position exchanging unit is used for exchanging the character position of the second identification ID based on the target rule so as to obtain a second URL.
As an alternative embodiment, the first identifier ID is an N-ary number; the character replacement unit includes: a first determining subunit, configured to determine a length M of the replacement character set; a first conversion subunit, configured to convert, based on the determined length M, the N-ary first identification ID into an M-ary third identification ID; and the replacing subunit is used for replacing the numerical value of each digit in the third identification ID with the corresponding replacing character in the replacing character set according to the sequence of each replacing character in the replacing character set so as to obtain the second identification ID.
As an alternative embodiment, the rule selecting unit includes: a second conversion subunit, configured to represent each character in the second identification ID as a K-ary number; the calculating subunit is used for calculating the accumulated sum of the K-system numbers corresponding to all the characters in the second identification ID; a second determining subunit, configured to determine the number of character position exchange rules included in the character position exchange rule set; and a third determining subunit, configured to determine the selection target rule based on the accumulated sum and the number of pieces.
As an alternative embodiment, the apparatus further comprises: and the domain name adding module is used for adding the specific domain name on the second identification ID after the second identification ID is obtained.
As an alternative embodiment, the replacement character set is generated by: selecting a plurality of specific characters; and randomly scrambling the order of the plurality of specific characters to generate a replacement character set.
As an alternative embodiment, the number of rules included in the character position exchange rule set is greater than a preset value.
As an alternative embodiment, the first URL is a long URL and the second URL is a short URL.
It should be understood that the embodiments of the apparatus portion of the present application correspond to the same or similar embodiments of the method portion of the present application, and are not described herein again.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
Fig. 5 is a block diagram of an electronic device according to an embodiment of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 5, the electronic apparatus includes: one or more processors 501, memory 502, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). In fig. 5, one processor 501 is taken as an example.
Memory 502 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the URL translation method provided herein. The non-transitory computer-readable storage medium of the present application stores computer instructions for causing a computer to execute the method of converting a URL provided by the present application.
The memory 502, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules (e.g., the determination module 410 and the conversion module 420 shown in fig. 4) corresponding to the conversion method of the URL in the embodiments of the present application. The processor 501 executes various functional applications of the server and data processing, i.e., implementing the URL conversion method in the above-described method embodiment, by running non-transitory software programs, instructions, and modules stored in the memory 502.
The memory 502 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created from the use of the electronic device for the conversion of the URL, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 502 may optionally include memory located remotely from processor 501, which may be connected to the URL's translation electronics via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device for implementing the URL conversion method of the present application may further include: an input device 503 and an output device 504. The processor 501, the memory 502, the input device 503 and the output device 504 may be connected by a bus or other means, and fig. 5 illustrates the connection by a bus as an example.
The input device 503 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device for conversion of the URL, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or other input device. The output devices 504 may include a display device, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other; the server may be a server of a distributed system or a server incorporating a blockchain. The server can also be a cloud server, or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology.
According to the technical scheme of the embodiment of the application, after the incremental ID corresponding to the long URL is converted by replacing the character set, the short URL is finally generated by executing the related operation of character position adjustment, so that the difficulty of violently guessing the front short URL and the rear short URL can be increased, and the safety is improved.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (11)

1. A method for converting Uniform Resource Locator (URL) comprises the following steps:
in response to receiving a translation request for a first URL, determining a first identification ID generated for the first URL; and
and converting to obtain a second URL corresponding to the first URL based on a preset replacement character set, a character position exchange rule set and the first identification ID.
2. The method of claim 1, wherein converting a second URL corresponding to the first URL based on a preset replacement character set, a character position exchange rule set, and the first identification ID comprises:
representing the first identification ID as a second identification ID by using a corresponding replacing character in the replacing character set;
selecting a target rule from the character position exchange rule set based on the second identification ID; and
and performing character position exchange on the second identification ID based on the target rule to obtain the second URL.
3. The method of claim 2, wherein:
the first identification ID is an N-system number;
representing the first identification ID as a second identification ID by using a corresponding replacing character in the replacing character set, and the method comprises the following steps:
determining the length M of the replacement character set;
converting the first identification ID in an N system into a third identification ID in an M system based on the determined length M; and
and replacing the numerical value of each digit in the third identification ID with the corresponding replacement character in the replacement character set according to the sequence of the replacement characters in the replacement character set to obtain the second identification ID.
4. A method according to claim 2 or 3, wherein selecting a target rule from the character position swapping rule set based on the second identification ID comprises:
representing each character in the second identification ID as a K-ary number;
calculating the accumulated sum of K-system numbers corresponding to all characters in the second identification ID;
determining the number of the character position exchange rules contained in the character position exchange rule set; and
and determining to select the target rule based on the accumulated sum and the number.
5. The method of claim 3, further comprising: after having obtained the second identification ID,
adding a specific domain name to the second identification ID.
6. The method of claim 1, wherein the replacement character set is generated by:
selecting a plurality of specific characters; and
randomly shuffle an order of the plurality of specific characters to generate the replacement character set.
7. The method according to claim 1, wherein the number of rules included in the character position swapping rule set is greater than a preset value.
8. The method of claim 1, wherein the first URL is a long URL and the second URL is a short URL.
9. An apparatus for Uniform Resource Locator (URL) conversion, comprising:
a determining module for determining a first identification ID generated for a first URL in response to receiving a conversion request for the first URL; and
and the conversion module is used for converting to obtain a second URL corresponding to the first URL based on a preset replacement character set, a character position exchange rule set and the first identification ID.
10. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
11. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-8.
CN202011316358.7A 2020-11-20 2020-11-20 URL conversion method and device, electronic equipment and storage medium Pending CN112417326A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011316358.7A CN112417326A (en) 2020-11-20 2020-11-20 URL conversion method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011316358.7A CN112417326A (en) 2020-11-20 2020-11-20 URL conversion method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112417326A true CN112417326A (en) 2021-02-26

Family

ID=74777664

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011316358.7A Pending CN112417326A (en) 2020-11-20 2020-11-20 URL conversion method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112417326A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115529352A (en) * 2022-09-20 2022-12-27 蚂蚁区块链科技(上海)有限公司 Routing processing method and device for computing service

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104080059A (en) * 2013-03-25 2014-10-01 ***通信集团福建有限公司 Method, device and system of implementing short message sending and receiving
WO2015101464A1 (en) * 2013-12-31 2015-07-09 Amadeus Sas Redirection system and method
US20170013091A1 (en) * 2013-04-23 2017-01-12 Paypal, Inc. Commerce oriented uniform resource locater (url) shortener
CN106953937A (en) * 2016-11-16 2017-07-14 阿里巴巴集团控股有限公司 A kind of uniform resource position mark URL conversion method and device
CN109313660A (en) * 2018-08-17 2019-02-05 福建联迪商用设备有限公司 A kind of method and terminal generating short network address
CN110851748A (en) * 2019-10-14 2020-02-28 平安科技(深圳)有限公司 Short link generation method, server, storage medium and computer equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104080059A (en) * 2013-03-25 2014-10-01 ***通信集团福建有限公司 Method, device and system of implementing short message sending and receiving
US20170013091A1 (en) * 2013-04-23 2017-01-12 Paypal, Inc. Commerce oriented uniform resource locater (url) shortener
WO2015101464A1 (en) * 2013-12-31 2015-07-09 Amadeus Sas Redirection system and method
CN106953937A (en) * 2016-11-16 2017-07-14 阿里巴巴集团控股有限公司 A kind of uniform resource position mark URL conversion method and device
CN109313660A (en) * 2018-08-17 2019-02-05 福建联迪商用设备有限公司 A kind of method and terminal generating short network address
CN110851748A (en) * 2019-10-14 2020-02-28 平安科技(深圳)有限公司 Short link generation method, server, storage medium and computer equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郭一华;: "短网址服务***的实现及相关技术研究", 软件, no. 01, pages 81 - 85 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115529352A (en) * 2022-09-20 2022-12-27 蚂蚁区块链科技(上海)有限公司 Routing processing method and device for computing service

Similar Documents

Publication Publication Date Title
CN112380464B (en) Short link generation method and related equipment
CN106407201B (en) Data processing method and device and computer readable storage medium
CN111131317B (en) Data processing method, device, equipment and medium based on block chain
CN110909372A (en) Data processing method, device, equipment and medium
CN111523001B (en) Method, device, equipment and storage medium for storing data
CN103379135A (en) Method and device for information sharing
CN107908482B (en) Information transmission method, equipment and computer readable medium
CN111147242B (en) Block generation method, device, electronic equipment and storage medium
CN112184367A (en) Order processing method and device
CN111552934A (en) Database access method and device
CN112417326A (en) URL conversion method and device, electronic equipment and storage medium
KR20220061926A (en) Method and apparatus for switching skin of mini-program page, and electronic device
CN108170275B (en) Input information processing method and device of external equipment of virtual reality equipment
CN112235104B (en) Data encryption transmission method, system, terminal and storage medium
CN110536283B (en) Terminal identifier acquisition method, device, electronic equipment and medium
CN108595973B (en) Instruction determination method, equipment control method, device and system
CN111371773A (en) Information sending and displaying method, device, equipment and storage medium
CN105979021B (en) A kind of information processing method and user terminal
CN116015960A (en) Multi-node traffic confusion method, device, equipment and storage medium
KR102208082B1 (en) Server device, information management system, information management method, and recording medium storing a computer program
CN114359015A (en) Data transmission method and device and graphic processing server
CN111782422B (en) Distributed message processing method, device, electronic equipment and storage medium
CN111737534A (en) File processing method, device and equipment
CN111177558A (en) Channel service construction method and device
CN112560460B (en) Method and device for extracting structured information, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination