CN112380464B - Short link generation method and related equipment - Google Patents

Short link generation method and related equipment Download PDF

Info

Publication number
CN112380464B
CN112380464B CN202011251503.8A CN202011251503A CN112380464B CN 112380464 B CN112380464 B CN 112380464B CN 202011251503 A CN202011251503 A CN 202011251503A CN 112380464 B CN112380464 B CN 112380464B
Authority
CN
China
Prior art keywords
short link
link
target
short
character
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.)
Active
Application number
CN202011251503.8A
Other languages
Chinese (zh)
Other versions
CN112380464A (en
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.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China 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 Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN202011251503.8A priority Critical patent/CN112380464B/en
Publication of CN112380464A publication Critical patent/CN112380464A/en
Application granted granted Critical
Publication of CN112380464B publication Critical patent/CN112380464B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/9554Retrieval from the web using information identifiers, e.g. uniform resource locators [URL] by using bar codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Telephonic Communication Services (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a short link generation method and related equipment, wherein the method comprises the following steps: responding to a long-link conversion request submitted by a terminal device, and acquiring a target long-link address to be converted carried by the long-link conversion request and a short-link conversion strategy set for the target long-link address; generating a first short link brief code set corresponding to the target long link address according to the short link conversion strategy; and when the second short link brief code set is traversed to determine that the second short link brief code set does not have the target short link brief code, generating a target short link address comprising the target short link brief code, and outputting the target short link address through the terminal equipment. By adopting the method and the device, the short link conversion process can be more flexible, and the validity of the generated short link address can be improved. The present application relates to blockchain techniques, such as writing target long link addresses and target short link addresses to blockchains.

Description

Short link generation method and related equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a short link generation method and related devices.
Background
With the rapid development of information technology, two-dimensional codes, short messages, and APP message pushing all start to refer to technologies that jump to a corresponding long link address to access the corresponding long link address by accessing the short link address. This technique was developed for the following reasons: because the length of the recorded information of the two-dimensional code is limited, the longer the recorded information is, the lower the identification rate of the two-dimensional code is, so that the identification difficulty of the two-dimensional code is increased by recording a long link address through the two-dimensional code; if a long-chain address is added in the short message, the short message provider can automatically split the short message into two short messages, and the short message cost is changed into the cost of the two short messages, so that the short message cost of a user is increased; similarly, the APP application generally limits the content released within a certain word number range, and if the content exceeds the word number range, the content will be intercepted by the platform, that is, when the content released includes a long link address, the content released may fail to release due to excessive word number. In addition, the long link address may also impair the overall performance of the server, such as may affect the length of the long connection time of the server, thereby directly affecting the concurrency number of the server.
In general, long link addresses may be converted to short link addresses by: the user uses the terminal equipment to request the server to convert a certain long-link address, and after the server receives the long-link address, the server can select one short-link address from a plurality of short-link addresses configured by a developer in advance and return the short-link address to the user. However, this short link address translation is not flexible enough and there may be cases where the short link address returned to the user is already occupied by other long link addresses, resulting in the short link address being unavailable.
Disclosure of Invention
The embodiment of the application provides a short link generation method and related equipment, which can enable a short link conversion process to be more flexible and can promote the effectiveness of a short link address.
In a first aspect, the present application discloses a short link generation method, the method comprising:
responding to a long-link conversion request submitted by a terminal device, and acquiring a target long-link address to be converted carried by the long-link conversion request and a short-link conversion strategy set for the target long-link address, wherein the short-link conversion strategy comprises a short-link generation mode and a short-link constraint condition corresponding to the short-link generation mode;
Generating a first short link brief code set corresponding to the target long link address according to the short link conversion strategy, wherein the first short link brief code set comprises one or more candidate short link brief codes;
traversing a second short link brevity code set to determine whether a target short link brevity code in the first short link brevity code set exists in the second short link brevity code set, wherein the target short link brevity code is any candidate short link brevity code in the first short link brevity code set, and the second short link brevity code set comprises one or more short link brevity codes which are used;
and when the target short link brevity code does not exist in the second short link brevity code set, generating a target short link address comprising the target short link brevity code, and outputting the target short link address through terminal equipment.
In a second aspect, embodiments of the present application disclose a short link generation apparatus, the apparatus including:
the device comprises an acquisition module, a short link conversion module and a short link conversion module, wherein the acquisition module is used for responding to a long link conversion request submitted by a terminal device, acquiring a target long link address to be converted carried by the long link conversion request and a short link conversion strategy set for the target long link address, and the short link conversion strategy comprises a short link generation mode and a short link constraint condition corresponding to the short link generation mode;
The processing module is used for generating a first short link brief code set corresponding to the target long link address according to the short link conversion strategy, wherein the first short link brief code set comprises one or more candidate short link brief codes;
the processing module is further configured to traverse a second short link brief code set to determine whether a target short link brief code in the first short link brief code set exists in the second short link brief code set, where the target short link brief code is any candidate short link brief code in the first short link brief code set, and the second short link brief code set includes one or more short link brief codes that have been used;
and the processing module is further configured to generate a target short link address including the target short link brevity code when the target short link brevity code does not exist in the second short link brevity code set, and output the target short link address through a terminal device.
In a third aspect, an embodiment of the present application provides an electronic device, including: the system comprises a processor, an input device, an output device and a memory, wherein the processor, the input device, the output device and the memory are mutually connected, the memory is used for storing a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions and execute the short link generation method.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program comprising program instructions that, when executed by a processor, cause the processor to perform the above-described short link generation method.
In the embodiment of the present invention, an electronic device responds to a long-link conversion request submitted by a terminal device, obtains a target long-link address to be converted and a short-link conversion policy set for the target long-link address, and generates a first short-link brief code set corresponding to the target long-link address according to the short-link conversion policy, and at the same time, traverses a second short-link brief code set to determine whether the second short-link brief code set has a target short-link brief code in the first short-link brief code set, and when the second short-link brief code set does not have a target short-link brief code, generates a target short-link address including the target short-link brief code, and outputs the target short-link address through the terminal device.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a short link generation system according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart of a short link generation method disclosed in an embodiment of the present application;
FIG. 3 is a schematic flow diagram of another short link generation method disclosed in an embodiment of the present application;
FIG. 4 is an interface schematic diagram of a short link generation interface disclosed in an embodiment of the present application;
FIG. 5 is a schematic flow diagram of yet another short link generation method disclosed in an embodiment of the present application;
FIG. 6 is an interface schematic diagram of another short link generation interface disclosed in an embodiment of the present application;
FIG. 7 is an interface schematic diagram of yet another short link generation interface disclosed in an embodiment of the present application;
fig. 8 is a schematic structural diagram of a short link generating device according to an embodiment of the present disclosure;
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
The embodiment of the application provides a short link generation scheme, which can solve the problems of lower flexibility and low validity of generated short link addresses in the short link conversion process in the prior art, can enable the short link conversion process to be more flexible, and improves the validity of the generated short link addresses. The short link generation scheme may be implemented by an electronic device, which may be a terminal device or a server. The terminal device may be a handheld device, an in-vehicle device, a wearable device or a computing device with wireless communication function. The terminal device may be a mobile phone, a tablet computer, or a computer with a wireless transceiver function, for example. But also Virtual Reality (VR) terminal equipment, augmented reality (augmented reality, AR) terminal equipment, wireless terminal equipment in industrial control, wireless terminal equipment in unmanned aerial vehicle, wireless terminal equipment in telemedicine, wireless terminal equipment in smart grid, wireless terminal equipment in smart city, wireless terminal equipment in smart home (smart home), etc. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms.
The following describes a short link generation system provided in the embodiments of the present application with an electronic device as a server. The short link generation scheme described in the embodiments of the present application may be implemented by the short link generation system shown in fig. 1. The short link generation system shown in fig. 1 includes a terminal device 101 and a server 102. The terminal device 101 may be in communication connection with the server 102. The terminal device 101 may receive a target long link address to be converted and a short link conversion policy set for the target long link address, which are configured by a user, and send a long link conversion request to the server 102, where the long link conversion request carries the target long link address and the short link conversion policy; the server 102 may process the target long link address to obtain a corresponding first short link brief code set, and generate a target short link address according to the first short link brief code set, and send the target short link address to the terminal device 101. Specifically: the server 102 may respond to the long link conversion request submitted by the terminal device 101, obtain a target long link address and a short link conversion policy carried by the long link conversion request, generate a first short link brief code set corresponding to the target long link address according to the short link conversion policy, traverse the second short link brief code set to determine whether the second short link brief code set has a target short link brief code in the first short link brief code set, generate a target short link address including the target short link brief code when the second short link brief code set does not have the target short link brief code, and output the target short link address through the terminal device 101. By adopting the process, reliable short link addresses can be generated, and the flexibility of the short link conversion process is improved due to the variety of the short link generation modes.
In one embodiment, the terminal device 101 may send the target short link address to at least one user device (not shown) after receiving the target short link address. In an application scenario, different user devices correspond to different clients, and considering that an output target short link address may be used by an enterprise or a person for various services, for these situations, the target short link address may be sent to different clients in the form of a two-dimensional code or may be sent to different clients in the form of a short message, and after receiving the target short link address, the client performs a corresponding clicking operation to access the target short link address. When the electronic device is a server, the server can count the access times of the target short link address, so as to count the heat of the target short link address and/or the corresponding short link generator. And if the risk of the IP address of a certain user equipment accessing the target short link address is detected, the processing of the access request of the target short link address can be refused, or if the risk is detected in the access process, the access operation of the client to the target short link address is interrupted.
The user device may be a handheld device, an in-vehicle device, a wearable device, or a computing device with wireless communication capabilities. The terminal device may be a mobile phone, a tablet computer, or a computer with a wireless transceiver function, for example. But also Virtual Reality (VR) terminal equipment, augmented reality (augmented reality, AR) terminal equipment, wireless terminal equipment in industrial control, wireless terminal equipment in unmanned aerial vehicle, wireless terminal equipment in telemedicine, wireless terminal equipment in smart grid, wireless terminal equipment in smart city, wireless terminal equipment in smart home (smart home), etc.
Embodiments of the present application may relate to blockchain techniques, such as writing target long link addresses and target short link addresses into a blockchain.
Referring to fig. 2, fig. 2 is a flowchart of a short link generation method according to an embodiment of the present application, where the method specifically includes the following steps:
s201, the electronic equipment responds to a long-link conversion request submitted by the terminal equipment to acquire a target long-link address to be converted carried by the long-link conversion request and a short-link conversion strategy set for the target long-link address, wherein the short-link conversion strategy comprises a short-link generation mode and a short-link constraint condition corresponding to the short-link generation mode.
In this embodiment of the present invention, after a user may configure a target long link address and a short link conversion policy set for the target long link address based on a visual interface displayed by a terminal device, for example, a short link generation interface, the user may trigger the terminal device to submit a long link conversion request to an electronic device, and the electronic device may respond to the long link conversion request submitted by the terminal device to obtain a target long link address to be converted and a short link conversion policy set for the target long link address, where the short link conversion policy includes a short link generation manner and a short link constraint condition corresponding to the short link generation manner.
The short link conversion strategy comprises a short link generation mode and short link constraint conditions corresponding to the short link generation mode, and specifically: the short link generation mode can be a random generation mode or a custom generation mode, and different short link generation modes correspond to different short link constraint conditions. When the short link generation mode is a random generation mode, the corresponding short link constraint condition comprises at least one of the following: the character set type, the character set length and the encryption mode can be one of the short link constraint conditions, the combination of any two short link constraint conditions or all the short link constraint conditions. When the short link generation mode is a custom generation mode, the short link constraint condition comprises a specified character string. It should be noted that when the short link generation mode is a random generation mode, when only one or two of the short link generation modes are selected, the constraint condition is not selected to perform default setting.
Wherein, the character set category can be any of the following: pure digits (corresponding digits may be all digits of 0-9), pure lowercase letters (corresponding lowercase letters may be all lowercase letters of a-Z), pure uppercase letters (corresponding uppercase letters may be all uppercase letters of a-Z), combinations of digits and lowercase letters, combinations of digits and uppercase letters, combinations of lowercase letters, and combinations of digits and lowercase letters. The character set length may be a length value within a predetermined length range (e.g., 4-16). The encryption mode may be a mode of encrypting the universal unique identification code Universally Unique Identifier, UUID) or a mode of encrypting the MD5, which is not limited in the embodiment of the present application. In an application scenario, after selecting a random generation mode by using a terminal device, a user may set a short link constraint condition on a short link generation interface displayed by the terminal device. If the user does not select the character set length and encryption mode, the character set length may be a default character set length, such as 6. The encryption mode can adopt a default encryption mode, such as a UUID encryption mode.
S202, the electronic equipment generates a first short link brief code set corresponding to the target long link address according to a short link conversion strategy, wherein the first short link brief code set comprises one or more candidate short link brief codes.
In one possible implementation, when the short link generation manner is a random generation manner, the corresponding first short link brief code set may include a plurality of candidate short link brief codes, for example, may include 4 or more candidate short link brief codes. When the short link generation mode is a custom generation mode, the corresponding first short link brief code set may include a candidate short link brief code, for example, may include obtaining the candidate short link brief code according to the specified character string.
In one possible implementation manner, when the short link generation manner is a random generation manner and the corresponding short link constraint condition includes a character set type, the process of generating, by the electronic device, the first short link brevity code set corresponding to the target long link address according to the short link conversion policy may determine a target character set corresponding to the character set type for the electronic device, select a plurality of groups of characters from the target character set, and construct a candidate short link brevity code corresponding to the group of characters by using each group of characters. For example, the character set category includes a combination of digits and lowercase letters, the target character set corresponding to the character set category includes all digits from 0 to 9 and all lowercase letters of a-z, the electronic device may select a group of characters from the target character set at a time, such as selecting a first number of digits from all digits from 0 to 9 and selecting a second number of lowercase letters from all lowercase letters of a-z, and construct the candidate short-link shorthand code of the present time using the first number of digits and the second number of lowercase letters. In one embodiment, the electronic device selects a plurality of groups of characters from the target character set, and the electronic device may select a plurality of groups of characters from the target character set according to a default character set length, where the length of each group of characters is the default character set length.
In one possible implementation manner, when the short link generation manner is a random generation manner and the corresponding short link constraint condition includes a character set type, the process of generating, by the electronic device, the first short link brief code set corresponding to the target long link address according to the short link conversion policy may encrypt the target long link by using a default encryption manner for the electronic device, to obtain a first encrypted string, select multiple groups of characters from the first encrypted string, and construct a candidate short link brief code corresponding to the group of characters by using each group of characters. In one embodiment, the electronic device selects a plurality of groups of characters from the first encrypted character string, and may select a plurality of groups of characters from the first encrypted character string according to a default character set length for the electronic device.
In one possible implementation manner, when the short link generation manner is a random generation manner and the corresponding short link constraint condition includes a character set length, the process of generating, by the electronic device, the first short link brief code set corresponding to the target long link address according to the short link conversion policy may determine a target character set corresponding to a default character set type for the electronic device, select a plurality of groups of characters from the target character set according to the character set length, and construct a candidate short link brief code corresponding to the group of characters by using each group of characters, where the length of the candidate short link brief code is the character set length. For example, the character set category includes a combination of numbers and lowercase letters, the target character set corresponding to the character set category includes all numbers from 0-9 and all lowercase letters of a-z, and the electronic device may select a group of characters at a time based on the character set length. If the character set length is 6, the electronic device selects a first number of digits, such as 4 digits, from all digits 0-9 and a second number of digits, such as 2 lower case letters, from all lower case letters of a-z. The electronic device may construct a candidate short-link shortcode of this time using the 4 digits and the 2 lower case letters, where the length of the candidate short-link shortcode is 6. In one embodiment, when the short link constraint does not include a character set length, the electronic device may select multiple sets of characters from the target character set according to a default character set length.
In one possible implementation manner, when the short link generation manner is a random generation manner and the corresponding short link constraint condition includes a character set length, the electronic device may encrypt the target long link address according to the short link conversion policy in the process of generating the first short link brief code set corresponding to the target long link address by the electronic device, to obtain a first encrypted character string, select multiple groups of characters from the first encrypted character string according to a default character set type and the character set length, and construct a candidate short link brief code corresponding to the group of characters by using each group of characters, where the length of the candidate short link brief code is the character set length.
In a possible implementation manner, when the short link generation manner is a random generation manner and the corresponding short link constraint condition includes an encryption manner, the electronic device may encrypt the target long link address by using the encryption manner in a process of generating the first short link brief code set corresponding to the target long link address according to the short link conversion policy by using the electronic device to obtain a second encrypted string (the second encrypted string is used for distinguishing between encrypting the target long link address by using a default encryption manner to obtain the first encrypted string here), and select multiple groups of characters from the encrypted string according to a default character set type and/or a default character set length, and construct a candidate short link brief code corresponding to each group of characters according to each group of characters. For example, the default character set length is 4, and the electronic device may randomly select 4 characters from the encrypted character string each time as a group of characters to construct the candidate short link brevity code of this time. For another example, when the default character string is a combination of digits and lowercase letters, the electronic device may select a group of characters from the encrypted character string each time, for example, selecting a first number of digits and selecting a second number of lowercase letters to construct a candidate short-link brevity code of the present time. For another example, when the default character set type is a combination of numbers and lower case letters and the default character set length is 4, the electronic device may select a group of character strings from the encrypted character strings each time according to the default character set type and the default character set length, for example, select a first number of numbers and select a second number of lower case letters to construct a candidate short link brevity code of this time, and at this time, the length of the candidate short link brevity code is 4.
In one possible implementation manner, when the short link generation manner is a random generation manner and the corresponding short link constraint condition includes a character set type and a character set length, the process of generating, by the electronic device, the first short link brief code set corresponding to the target long link address according to the short link conversion policy may determine a target character set corresponding to the character set type for the electronic device, select a plurality of groups of characters from the target character set according to the character set length, and construct a candidate short link brief code corresponding to the group of characters by using each group of characters. For example, the character set type includes a combination of digits and lowercase letters, the target character set corresponding to the character set type includes all digits from 0 to 9 and all lowercase letters of a-z, the character set length is 6, the electronic device may select a group of characters from the target character set at a time, such as selecting a first number of digits from 0 to 9 and selecting a second number of lowercase letters from all lowercase letters of a-z, and construct a candidate short-link shortcode of this time using the first number of digits and the second number of lowercase letters, the group of characters has a length of 6, a sum of the first number and the second number of digits is 6, and the candidate short-link shortcode has a length of 6.
In one possible implementation manner, when the short link generation manner is a random generation manner and the corresponding short link constraint condition includes a character set type and a character set length, the process of generating, by the electronic device, the first short link brief code set corresponding to the target long link address according to the short link conversion policy may encrypt the target long link by the electronic device according to a default encryption manner to obtain a first encrypted character string, determine the character set type and the character set length, select a plurality of groups of characters from the first encrypted characters, and construct a candidate short link brief code corresponding to the group of characters by using each group of characters.
In one possible implementation manner, when the short link generation manner is a random generation manner and the corresponding short link constraint condition includes a character set type, a character set length and an encryption manner, the process of generating, by the electronic device, the first short link brief code set corresponding to the target long link address according to the short link conversion policy may encrypt the target long link address according to the encryption manner by the electronic device to obtain a second encrypted character string, and select a plurality of groups of characters from the second encrypted character string according to the character set type and the character set length, and construct the candidate short link brief code corresponding to the group of characters by using each group of characters.
S203, the electronic device traverses the second short link brief code set to determine whether a target short link brief code in the first short link brief code set exists in the second short link brief code set, wherein the target short link brief code is any candidate short link brief code in the first short link brief code set, and the second short link brief code set comprises one or more short link brief codes which are used.
Wherein the second short-link brevity code set may include one or more short-link brevity codes that have been used, and the short-link brevity code already has a long-link address corresponding to the short-link brevity code. In one embodiment, the short link profile in the second set of short link profiles may be time-efficient. For example, if the time of setting a short link profile in the second set of short link profiles is within 1 month, then after one month the short link profile will be cleaned up and will not appear in the second set of short link profiles.
In one possible implementation manner, the electronic device traverses the second short link brief code set to determine whether the target short link brief code in the first short link brief code set exists in the second short link brief code set, specifically: the electronic device traverses each short link brief code in the first short link brief code set in sequence in the second short link brief code set to determine whether a target short link brief code in the first short link brief code set exists in the second short link brief code set. For example, if the 1 st short link short code in the first short link short code set exists in the second short link short code set, the 2 nd short link short code in the first short link short code set is used for traversing until a short link short code in the first short link short code set is regarded as the target short link short code when the short link short code in the first short link short code set does not exist in the second short link short code set. In one possible implementation manner, the electronic device may traverse each short link brief code in the first short link brief code set in the second short link brief code set at the same time in addition to the above sequential traversing manner, so as to determine whether the second short link brief code set has the target short link brief code in the first short link brief code set. If it is determined that a plurality of target short link brevity codes exist in the first short link brevity code set in the second short link brevity code set, one target short link brevity code of the plurality of target short link brevity codes is randomly selected, so that a target short link address including the randomly selected target short link brevity code is generated.
Further, if all short link shortcodes in the first short link shortcode exist in the second short link shortcode set, repeating the steps S202 to S203, thereby determining the target short link shortcode. This is typically a small probability event.
S204, when the second short link brief code set does not have the target short link brief code, the electronic equipment generates a target short link address comprising the target short link brief code, and outputs the target short link address through the terminal equipment.
After the electronic device obtains the target short link address, the target short link address may be sent to the terminal device for output. The related equipment can realize the access process of the target long-chain link address by means of the target short-chain link address. For example, the terminal device or the user device may initiate an access request to the target short link address to the server, and when the server detects the access request to the target short link address, the server may query the target long link address corresponding to the target short link address, and implement an access procedure to the target long link address.
In one possible implementation, the generating, by the electronic device, the target short link address including the target short link brevity code may specifically be: and performing splicing processing on the target short link brief code and the preset character to obtain a target short link address comprising the target short link brief code. In one embodiment, the preset characters may include characters of a protocol portion and characters of an IP address portion (or domain name portion). For example, the preset character may be http:// IP address 1/, and the target short link brevity code is abddf, and then the target short link brevity code and the preset character may be spliced to obtain the target short link address including the target short link brevity code abddf: http:// IP address 1/abddf.
In one possible implementation manner, when the second short link brief code set does not have the target short link brief code, the electronic device may record a corresponding relationship between the target short link brief code and the corresponding target long link address, or record a corresponding relationship between the target short link address and the target long link address, so that the related device may successfully access the target long link address through the target short link address. Meanwhile, when the second short link brief code set does not have the target short link brief code, the electronic device may further add the target short link brief code to the second short link brief code set to identify that the target short link brief code has been used.
In one possible implementation manner, when the second short link brief code set does not have the target short link brief code, the electronic device may further record a corresponding relationship between the target short link brief code, the target long link address, and the IP address of the terminal device, or record a corresponding relationship between the target short link address, the target long link address, and the IP address of the terminal device. The correspondence may be used for access control to the terminal device. For example, whether the terminal device has malicious access behaviors can be monitored according to the corresponding relationship, the malicious access behaviors can be behaviors of continuously sending long-chain conversion requests aiming at the same long-chain address, and if the malicious access behaviors are monitored, the electronic device can refuse to process the long-chain conversion requests submitted by the terminal device.
In one possible implementation manner, when the electronic device is a server, and when other systems want to use the short-link generation method of the present application, an acquisition request for the short-link generation interface may be initiated, where the request carries an APPID and a token, and the server may return the short-link interface to the other systems after checking the APPID and the token.
In this embodiment, an electronic device responds to a long link conversion request submitted by a terminal device, obtains a target long link address to be converted and a short link conversion policy set for the target long link address, which are carried by the long link conversion request, and generates a first short link brief code set corresponding to the target long link address according to the short link conversion policy, and at the same time, traverses a second short link brief code set to determine whether the second short link brief code set has a target short link brief code in the first short link brief code set, and generates a target short link address including the target short link brief code when the second short link brief code set does not have the target short link brief code.
Referring to fig. 3, fig. 3 is a flowchart of another short link generation method provided in the embodiment of the present application, where the flowchart mainly illustrates specific flow steps corresponding to a short link generation mode being a random generation mode, and may specifically include:
s301, the electronic equipment responds to a long-link conversion request submitted by the terminal equipment to obtain a target long-link address to be converted carried by the long-link conversion request and a short-link conversion strategy set for the target long-link address, wherein a short-link generation mode corresponding to the short-link conversion strategy is a random generation mode, and the short-link constraint conditions comprise character set types, character set lengths and encryption modes.
The short link constraint conditions in the embodiment of the present application include a character set type, a character set length, and an encryption mode. In some possible embodiments, the short link constraint may include only one or a combination of any two. For example, when the short link constraint is a character set type, there is a default character set length and a default encryption mode; when the short link constraint condition is character set length, a default encryption mode exists, and the character set type can be set by default; when the short link constraint condition is the character set type and the character set length, a corresponding default encryption mode exists. The default values of the character set types, the default values of the character set lengths and the default values of the encryption modes can be set by a developer independently, and are not limited in the embodiment of the application.
S302, the electronic equipment encrypts the target long link address according to an encryption mode to obtain encrypted data.
The encryption method may be a UUID encryption method, an MD5 encryption method, or the like.
S303, the electronic equipment splits the encrypted data to obtain a preset number of character strings.
The preset number of character strings may be used to generate a preset number of candidate short link brevity codes, where the length of each of the preset number of character strings may be the same. For example, the encrypted data is a 32-bit string, and the electronic device may split the encrypted data to obtain 4 8-bit strings.
S304, the electronic equipment determines a data subscript range corresponding to the character set type according to the character set type, determines a displacement step length according to the character set length, and the character set length is n.
In one possible implementation, the electronic device determines a range of data subscripts corresponding to the character set category according to the character set category. For example, when the character set type is a pure number, the electronic device may determine that the range of the data index corresponding to the pure number is 0 to 9, when the character set type is a pure lowercase letter, the electronic device may determine that the range of the corresponding data index is 10 to 35, and when the character set type is a pure uppercase letter, the electronic device may determine that the range of the corresponding data index is 36 to 61.
In one possible implementation manner, the electronic device determines a displacement step according to the character set length, and specifically, the electronic device may determine the quotient of the binary number of the character string and the character set length as the displacement step. Assuming that the character set length is 4, the character string is an 8-bit character string, and the number of bits of the 8-bit character string is 32 bits, the corresponding displacement step may be 32/4=8. It should be noted that in some cases, the electronic device may have a remainder by the quotient of the binary digits of the character string and the character set length, so the displacement step may be determined by rounding down the quotient. For example, a character set length of 5, a quotient of 32/5=6.4, and the electronic device rounds down the 6.4, the displacement step size of 6 can be obtained. In some possible embodiments, the displacement step may be determined by rounding up, which is not described in detail in this embodiment of the present application.
S305, the electronic equipment determines a first bit character of a short-link brevity code corresponding to a target character string according to a target data index corresponding to a data index range and the target character string in the preset number of character strings, wherein the target character string is any character string in the preset number of character strings.
In one possible implementation manner, the electronic device performs an and operation on a target data subscript corresponding to the data subscript range and a target character string in a preset number of character strings to obtain a first operation result, and determines a first bit character of a short link brevity code corresponding to the target character string according to the first operation result. For example, when the character set category is a pure number, the target data index corresponding to the range of data indices may be 9,
In one possible implementation manner, the process of performing an and operation on the target data subscript corresponding to the data subscript range and the target character string in the preset number of character strings by the electronic device to obtain the first operation result may be: and the electronic equipment performs AND operation on the target data subscript corresponding to the data subscript range and the target character string to obtain a first operation result. In one embodiment, the electronic device performs an and operation on the target data subscript corresponding to the data subscript range and the target character string in the preset number of character strings, so as to obtain a first operation result, which may be: the electronic equipment converts the target character string into a decimal number, then calculates a first binary number corresponding to a target data index corresponding to the data index range and a second binary number corresponding to the decimal number, and then performs AND operation on the first binary number and the second binary number to obtain a first operation result.
In one possible implementation manner, the process of determining, by the electronic device, the first bit character of the short-link shortcode corresponding to the target character string according to the first operation result may determine, by the electronic device, the first operation result as a first data index, determine, according to a correspondence between the data index and the character, the character corresponding to the first data index, and determine, by the electronic device, the character corresponding to the first data index as the first bit character of the short-link shortcode corresponding to the target character string.
In one embodiment, when the character set is a pure lowercase letter, the target data index corresponding to the data index range may be 25 (35-10), and correspondingly, (the first operation result+10) may be the first character of the short-link brevity code corresponding to the target character string. When the character set category is a pure lowercase letter, the target data index corresponding to the range of data indices may be 25 (61-36). Accordingly, the character corresponding to (the first operation result +36) may be the first character of the short link brevity code corresponding to the target character string. When the character set type is a combination (a combination of a number and a lower case letter, a combination of a number and a upper case letter, or a combination of a number and a lower case letter), the electronic device may perform an and operation with the target character string by using the corresponding target data subscript according to the type (e.g., the number, the lower case letter, or the upper case letter) of the first character when generating the first character of the short-link shorthand corresponding to the target character string, so as to obtain a first operation result. Accordingly, the character corresponding to the m+1 operation result can be used as the m+1 bit character. When generating the (m+1) -th bit character of the short link brevity code corresponding to the target character string, the electronic device performs AND operation on the corresponding target data subscript and the (m) -th shift data according to the type (such as number, lowercase letter or uppercase letter) of the (m+1) -th bit character to obtain an (m+1) -th operation result. Accordingly, the character corresponding to the m+1 operation result can be used as the m+1 character.
S306, the electronic equipment acquires m shift data corresponding to the target character string according to the shift step length, wherein m is an integer which is more than 0 and less than n.
In one possible implementation manner, after determining the displacement step length according to the character set length, the electronic device performs a corresponding displacement operation on the selected target character string according to the displacement step length, so as to obtain corresponding mth displacement data. Specifically, when m is equal to 1, first shift data corresponding to the target character string is obtained according to the shift step length, and when m is greater than 1, shift data corresponding to the (m-1) -th shift data is obtained according to the shift step length and is used as the m-th shift data corresponding to the target character string.
In one possible implementation manner, after the electronic device performs an and operation on the target data index included in the data index range and the target character string to obtain a first operation result, the electronic device may perform a shift process on the second binary number according to the displacement step length to obtain a third binary number, and then convert the third binary number into a hexadecimal number as first shift data corresponding to the target character string. And then, the electronic equipment can carry out shift processing on the first shift data according to the shift step length to obtain a fourth binary number, then convert the fourth binary number into hexadecimal number as second shift data corresponding to the target character string, and the like until all shift data corresponding to the target character string are obtained.
In one possible implementation manner, after the electronic device converts the target character string into a decimal number, then calculates a first binary number corresponding to a target data subscript included in the data subscript range and a second binary number corresponding to the decimal number, then performs an and operation on the first binary number and the second binary number to obtain a first operation result, the electronic device can perform a shift process on the second binary number according to a displacement step length to obtain first shift data corresponding to a third binary number serving as the target character string. And then, the electronic equipment can carry out shift processing on the first shift data according to the shift step length to obtain a fourth binary number as second shift data corresponding to the target character string, and the like until all shift data corresponding to the target character string are obtained.
S307, the electronic device determines the (m+1) -th bit character of the short link brevity code corresponding to the target character string according to the target data subscript and the (m) -th shift data.
In one possible implementation manner, the electronic device performs an and operation on the target data subscript and the mth shift data to obtain an mth+1 operation result, and determines an mth+1 bit character of the short link brevity code corresponding to the target character string according to the mth+1 operation result. The method for determining, by the electronic device, the m+1st character of the short link brevity code corresponding to the target character string according to the m+1st operation result may refer to the method for determining, by the electronic device, the 1 st character of the short link brevity code corresponding to the target character string according to the 1 st operation result, which is not described in detail in this embodiment of the present application.
For example, after the first bit character of the short-link brevity code corresponding to the target character string is obtained, determining first shift data according to the shift step length, performing an AND operation on the first shift data and the target data subscript to obtain a second operation result, and determining the second operation result as the second bit character of the short-link brevity code corresponding to the target character string according to the corresponding relation between the data subscript and the character. And similarly, obtaining all characters of the short-link brief code corresponding to the target character string, and forming the short-link brief code corresponding to the target character string according to the sequence of all the characters.
S308, the electronic equipment determines short link brief codes corresponding to the target character strings as candidate short link brief codes, and constructs a first short link brief code set comprising the candidate short link brief codes.
In one possible implementation manner, the character string obtained by encrypting the target long-link address is split into a preset number of character strings, and correspondingly, according to the method, a preset number of candidate short-link brevity codes are obtained, so that the first short-link brevity code set is constructed by the preset number of candidate short-link brevity codes.
S309, the electronic device traverses the second short link brevity code set to determine whether a target short link brevity code in the first short link brevity code set exists in the second short link brevity code set, wherein the target short link brevity code is any candidate short link brevity code in the first short link brevity code set, and the second short link brevity code set comprises one or more short link brevity codes which are used.
And S310, when the second short link brief code set does not have the target short link brief code, the electronic equipment generates a target short link address comprising the target short link brief code and outputs the target short link address through the terminal equipment.
Step S309 to step S310 are identical to step S203 to step S204, and will not be described in detail here.
The embodiment corresponding to fig. 3 may be described by a specific example, and assuming that the target long link address is long link address 1, the short link generation mode is a random generation mode, and the corresponding short link constraint condition includes: the character set type and the character set length of the short link and the encryption mode of the target long link address. The character set is of a pure number, the number range corresponding to the pure number is 0-9, the character set length is 4 bits, and the encryption mode is md5. The specific process of generating the first short link brief code set corresponding to the target long link address according to the target long link address and the short link conversion policy may be as follows:
1. the electronic equipment encrypts the target long link address by using an encryption mode md5 to obtain encrypted data, wherein the encrypted data is a 32-bit character string, namely 2ddad8f26899b37d818334652b1173d9;
2. Dividing the 32-bit character string into 4 8-bit character strings for generating 4 candidate short-link brevity codes;
3. converting the first 8-bit string 2ddad8f2 (target string) into a decimal number, hexindex= 769317106;
4. determining a data subscript range: 0-9, calculating displacement step length: step=32/4=8;
5. and performing AND operation on the maximum data index (9) corresponding to the data index range and the decimal number hexIndex= 769317106, wherein the binary corresponding to 9 is: 1001 Binary corresponding to 769317106: 1011 0111 0110 1011 0110 0011 1100 10, if the result obtained after the and operation is 0, the first bit character of the first short link brevity code is 0;
6. stepping the binary number corresponding to hexaindex by 8 bits 1011 0111 0110 1011 0110 0011 1100 10> >8 (which can be understood as 769317106 divided by the 7 th power of 2) to obtain first shift data 1011 0111 0110 1011 0110 00, wherein the decimal corresponding value is 3005144, as a new hexaindex value;
7. repeating the steps 1-5, performing logical AND operation on 3005144 and 9 to obtain a result of 8, and enabling the second bit character of the first short link brevity code to be 8;
8. shifting the binary number corresponding to the new hexIndex value 3005144 by 8 bits to obtain second shift data 11738 as a new hexIndex value, and circularly obtaining a third bit character and a fourth bit character which are respectively 8 and 9, wherein the first short link brevity code is 0889;
9. The first 8-bit character string is consumed, and the remaining 3 8-bit character strings are consumed according to the method, so that a second short link brevity code 9198, a third short link brevity code 1011 and a fourth short link brevity code 9119 are respectively obtained;
10. from the above, the first short link brief code set generated by the target long link address is: 0889, 9198, 1011, 9119.
In a possible implementation manner, the short link generation interface corresponding to the embodiment shown in fig. 3 may be as shown in fig. 4, and includes: the input box of the original link (target long link address), the character set (character set type) is selected, the length (character set length) is generated, and the pattern (encryption scheme) is generated. As shown in fig. 4, the input original link is a long link address 1, the generation mode is a random character, the character set type is a pure number, the character set length is 4, and the encryption mode is an MD5 encryption mode.
In the embodiment of the invention, an electronic device responds to a long-link conversion request submitted by a terminal device, acquires a target long-link address to be converted and a short-link conversion strategy set for the target long-link address, which are carried by the long-link conversion request, encrypts the target long-link address according to an encryption mode to obtain encrypted data, splits the encrypted data to obtain a preset number of character strings, determines a data index range corresponding to the character set type according to the character set type, determines a displacement step length according to the character set length, processes the preset number of character strings by utilizing the data index range and the displacement step length to obtain a first short-link brief code set, traverses the second short-link brief code set to determine whether the second short-link brief code set has the target short-link brief code in the first short-link brief code set, generates the target short-link address comprising the target short-link brief code when the second short-link brief code set does not have the target short-link brief code, and outputs the target short-link address through the terminal device.
Referring to fig. 5, fig. 5 is a flowchart of another short link generation method provided in the embodiment of the present application, where the flowchart mainly illustrates specific flow steps corresponding to a short link generation mode being a custom generation mode, and may specifically include:
s501, the electronic equipment responds to a long-link conversion request submitted by the terminal equipment to acquire a target long-link address to be converted carried by the long-link conversion request and a short-link conversion strategy set for the target long-link address, wherein a short-link generation mode corresponding to the short-link conversion strategy is a custom generation mode, and a short-link constraint condition is a designated character string.
In one possible implementation manner, after receiving a long-link conversion request submitted by a terminal device, the electronic device detects a short-link conversion policy of the electronic device, and if the detected short-link generation mode is a custom generation mode, a corresponding short-link generation interface is shown in fig. 6, and the used short-link constraint condition is a specified character string, and if the specified character string input in fig. 6 is 25011253. The length of the specified character string is a predetermined length range (e.g., 4-16). For example, the user may input the character set ABCD (length 4), and the ABCD may be used as the short link shortcode corresponding to the target long link address. For another example, the user may input the character set 0123456789asdfgh (length is 16), and then 0123456789asdfgh may be used as the short link brief code corresponding to the long link address.
Under an application scene, a user can directly express the purpose of the user in the form of a character string, for example, a favorite questionnaire is required to be made, the character string 'xihaowenjuan' can be customized, and thus, the target short link address corresponding to the short link brief code is sent to a client, and the client knows what purpose link address at one glance, thereby improving the use experience of the user and facilitating the flexible management of enterprises.
S502, the electronic equipment determines the appointed character string as a candidate short link brief code, and a first short link brief code set comprising the candidate short link brief code is constructed.
In this embodiment of the present application, the first short link brief code set is generally one candidate short link brief code included in the first short link brief code set.
S503, the electronic device traverses the second short link brief code set to determine whether the target short link brief code in the first short link brief code set exists in the second short link brief code set, and the second short link brief code set includes one or more short link brief codes that have been used.
As can be seen from the foregoing, the first short link brevity code set generally includes one candidate short link brevity code, so that the interface shown in fig. 7 will appear, and the user is required to repeatedly execute steps S501 to S503 to obtain the target short link brevity code that meets the user' S requirement.
S504, when the second short link brief code set does not have the target short link brief code, the electronic equipment generates a target short link address comprising the target short link brief code, and outputs the target short link address through the terminal equipment.
Step S504 is identical to step S204, and will not be described in detail here.
In the embodiment of the present invention, an electronic device responds to a long link conversion request submitted by a terminal device, obtains a target long link address to be converted and a short link conversion policy set for the target long link address, where a short link generation mode corresponding to the short link conversion policy is a custom generation mode, a short link constraint condition designates a character string, the electronic device determines the designated character string as a candidate short link brief code, constructs a first short link brief code set including the candidate short link brief code, and traverses a second short link brief code set to determine whether a target short link brief code in the first short link brief code set exists in the second short link brief code set, and when the target short link brief code does not exist in the second short link brief code set, the electronic device generates the target short link address including the target short link brief code, and outputs the target short link address through the terminal device.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a short-link generating device according to an embodiment of the present application, where the short-link generating device 80 may include: an acquisition module 801, a processing module 802, and a determination module 803, configured to:
an obtaining module 801, configured to obtain, in response to a long link conversion request submitted by a terminal device, a target long link address to be converted and a short link conversion policy set for the target long link address, where the short link conversion policy includes a short link generation manner and a short link constraint condition corresponding to the short link generation manner;
a processing module 802, configured to generate a first short link brief code set corresponding to the target long link address according to the short link conversion policy, where the first short link brief code set includes one or more candidate short link brief codes;
the processing module 802 is further configured to traverse a second short link brevity code set to determine whether a target short link brevity code in the first short link brevity code set exists in the second short link brevity code set, where the target short link brevity code is any candidate short link brevity code in the first short link brevity code set, and the second short link brevity code set includes one or more short link brevity codes that have been used;
The processing module 802 is further configured to generate a target short link address including the target short link brevity code when the target short link brevity code does not exist in the second short link brevity code set, and output the target short link address through a terminal device.
In one possible implementation manner, the short link generation manner is a random generation manner or a custom generation manner;
when the short link generation mode is the random generation mode, the short link constraint condition comprises at least one of the following: character set type, character set length and encryption mode;
when the short link generation mode is the custom generation mode, the short link constraint condition comprises a designated character string.
In one possible implementation, when the short link generation manner is a random generation manner and the short link constraint condition includes a character set type, a character set length, and an encryption manner, the processing module 802 is configured to generate, according to the short link conversion policy, a first short link brevity code set corresponding to the target long link address, including (for):
encrypting the target long link address according to the encryption mode to obtain encrypted data;
Splitting the encrypted data to obtain a preset number of character strings;
determining a data subscript range corresponding to the character set type according to the character set type, and determining a displacement step length according to the character set length;
and processing the preset number of character strings by utilizing the data subscript range and the displacement step length to obtain a first short link brief code set.
In one possible implementation manner, the character set length is n, and the processing module 802 processes the preset number of character strings by using the data subscript range and the displacement step length to obtain a first short link brevity code set, including:
determining a first bit character of a short link brevity code corresponding to a target character string according to the target data index in the data index range and the target character string in the preset number of character strings; the target character string is any character string in the preset number of character strings;
acquiring mth shift data corresponding to the target character string according to the shift step length; wherein m is an integer greater than 0 and less than n;
according to the target data subscript and the mth shift data, determining an (m+1) -th bit character of a short link brevity code corresponding to the target character string;
And determining the short link brief code corresponding to the target character string as a candidate short link brief code, and constructing a first short link brief code set comprising the candidate short link brief code.
In a possible implementation manner, the determining module 803 is configured to determine, according to a target data subscript in the data subscript range and a target character string in the preset number of character strings, a first bit character of a short link brevity code corresponding to the target character string, where the determining module includes:
performing AND operation on the target data subscript corresponding to the data subscript range and the target character strings in the preset number of character strings to obtain a first operation result;
determining a first bit character of a short link brevity code corresponding to the target character string according to the first operation result;
the determining the (m+1) -th bit character of the short link brevity code corresponding to the target character string according to the target data subscript and the (m) -th shift data comprises the following steps:
performing AND operation on the target data subscript and the mth shift data to obtain an mth+1th operation result;
and determining the m+1st character of the short link brevity code corresponding to the target character string according to the m+1st operation result.
In a possible implementation manner, the determining module 803 is configured to determine, according to the first operation result, a first bit character of a short link shortcode corresponding to the target character string, where the determining module includes:
Determining a first data index according to the first operation result;
determining the character corresponding to the first data subscript according to the corresponding relation between the data subscript and the character;
and determining the character corresponding to the first data subscript as a first bit character of a short link brevity code corresponding to the target character string.
In a possible implementation manner, the obtaining module 801 is configured to obtain, according to the displacement step, mth shift data corresponding to the target string, where the obtaining module includes:
when m is equal to 1, acquiring first shift data corresponding to the target character string according to the shift step length;
and when m is greater than 1, acquiring shift data corresponding to the (m-1) th shift data according to the shift step length, and taking the shift data as the m-th shift data corresponding to the target character string.
In a possible implementation manner, when the short link generation manner is a custom generation manner and the short link constraint condition includes a specified string, the processing module 802 is configured to generate, according to the short link conversion policy, a first short link brevity code set corresponding to the target long link address, including:
determining the appointed character string as a candidate short link brief code;
And constructing a first short link brevity code set comprising the candidate short link brevity codes.
In this embodiment, in response to a long link conversion request submitted by a terminal device, an obtaining module 801 obtains a target long link address to be converted and a short link conversion policy set for the target long link address, where the target long link address is carried by the long link conversion request, and a processing module 802 generates a first short link brief code set corresponding to the target long link address according to the short link conversion policy, and at the same time traverses a second short link brief code set to determine whether the second short link brief code set has a target short link brief code in the first short link brief code set, and when the second short link brief code set does not have the target short link brief code, generates a target short link address including the target short link brief code, and outputs the target short link address through the terminal device.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the electronic device includes: at least one processor 901, an input device 903, an output device 904, a memory 905, and at least one communication bus 902. Wherein a communication bus 902 is employed to facilitate a coupled communication between the components. Wherein the input device 903 may be a control panel or a microphone, etc., and the output device 904 may be a display screen, etc. The memory 905 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The memory 905 may also optionally be at least one storage device located remotely from the processor 901. Wherein the processor 901 may store a set of program code in the memory 905 as described in connection with fig. 8, and the processor 901, the input device 903, the output device 904 call the program code stored in the memory 905 for:
Responding to a long-link conversion request submitted by a terminal device, and acquiring a target long-link address to be converted carried by the long-link conversion request and a short-link conversion strategy set for the target long-link address, wherein the short-link conversion strategy comprises a short-link generation mode and a short-link constraint condition corresponding to the short-link generation mode;
generating a first short link brief code set corresponding to the target long link address according to the short link conversion strategy, wherein the first short link brief code set comprises one or more candidate short link brief codes;
traversing a second short link brevity code set to determine whether a target short link brevity code in the first short link brevity code set exists in the second short link brevity code set, wherein the target short link brevity code is any candidate short link brevity code in the first short link brevity code set, and the second short link brevity code set comprises one or more short link brevity codes which are used;
and when the target short link brevity code does not exist in the second short link brevity code set, generating a target short link address comprising the target short link brevity code, and outputting the target short link address through terminal equipment.
In one possible implementation manner, the short link generation manner is a random generation manner or a custom generation manner;
when the short link generation mode is the random generation mode, the short link constraint condition comprises at least one of the following: character set type, character set length and encryption mode;
when the short link generation mode is the custom generation mode, the short link constraint condition comprises a designated character string.
In one possible implementation manner, when the short link generation manner is a random generation manner and the short link constraint condition includes a character set type, a character set length, and an encryption manner, the processor 901 is configured to generate, according to the short link conversion policy, a first short link brevity code set corresponding to the target long link address, including (for):
encrypting the target long link address according to the encryption mode to obtain encrypted data;
splitting the encrypted data to obtain a preset number of character strings;
determining a data subscript range corresponding to the character set type according to the character set type, and determining a displacement step length according to the character set length;
And processing the preset number of character strings by utilizing the data subscript range and the displacement step length to obtain a first short link brief code set.
In a possible implementation manner, the character set length is n, and the processor 901 processes the preset number of character strings by using the data subscript range and the displacement step length to obtain a first short link brevity code set, including:
determining a first bit character of a short link brevity code corresponding to a target character string according to the target data index in the data index range and the target character string in the preset number of character strings; the target character string is any character string in the preset number of character strings;
acquiring mth shift data corresponding to the target character string according to the shift step length; wherein m is an integer greater than 0 and less than n;
according to the target data subscript and the mth shift data, determining an (m+1) -th bit character of a short link brevity code corresponding to the target character string;
and determining the short link brief code corresponding to the target character string as a candidate short link brief code, and constructing a first short link brief code set comprising the candidate short link brief code.
In a possible implementation manner, the processor 901 is configured to determine, according to a target data index in the data index range and a target character string in the preset number of character strings, a first bit character of a short link brevity code corresponding to the target character string, where the first bit character includes:
performing AND operation on the target data subscript corresponding to the data subscript range and the target character strings in the preset number of character strings to obtain a first operation result;
determining a first bit character of a short link brevity code corresponding to the target character string according to the first operation result;
the determining the (m+1) -th bit character of the short link brevity code corresponding to the target character string according to the target data subscript and the (m) -th shift data comprises the following steps:
performing AND operation on the target data subscript and the mth shift data to obtain an mth+1th operation result;
and determining the m+1st character of the short link brevity code corresponding to the target character string according to the m+1st operation result.
In a possible implementation manner, the processor 901 is configured to determine, according to the first operation result, a first bit character of a short link shortcode corresponding to the target character string, where the first bit character includes:
Determining a first data index according to the first operation result;
determining the character corresponding to the first data subscript according to the corresponding relation between the data subscript and the character;
and determining the character corresponding to the first data subscript as a first bit character of a short link brevity code corresponding to the target character string.
In a possible implementation manner, the processor 901 is configured to obtain, according to the displacement step, mth shift data corresponding to the target string, where the mth shift data includes:
when m is equal to 1, acquiring first shift data corresponding to the target character string according to the shift step length;
and when m is greater than 1, acquiring shift data corresponding to the (m-1) th shift data according to the shift step length, and taking the shift data as the m-th shift data corresponding to the target character string.
In a possible implementation manner, when the short link generation manner is a custom generation manner and the short link constraint condition includes a specified string, the processor 901 is configured to generate, according to the short link conversion policy, a first short link brevity code set corresponding to the target long link address, including:
determining the appointed character string as a candidate short link brief code;
and constructing a first short link brevity code set comprising the candidate short link brevity codes.
In this embodiment, the processor 901 obtains a target long link address to be converted and a short link conversion policy set for the target long link address, which are carried by a long link conversion request in response to a long link conversion request submitted by a terminal device, generates a first short link brief code set corresponding to the target long link address according to the short link conversion policy, and traverses a second short link brief code set to determine whether the second short link brief code set has a target short link brief code in the first short link brief code set, and generates a target short link address including the target short link brief code when the second short link brief code set does not have the target short link brief code, and outputs the target short link address through the terminal device.
Embodiments of the present application also provide a computer storage medium storing a computer program comprising program instructions that, when executed by a processor, perform the steps performed in the embodiments of fig. 2, 3 and 5 described above.
It should be appreciated that in embodiments of the present application, the processor 901 may be a central processing module (Central Processing Unit, CPU), which may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are presently preferred, and that the acts and modules involved are not necessarily essential to the present application
In the several embodiments provided in this application, it should be understood that the disclosed apparatus may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, such as the above-described division of units, merely a division of logic functions, and there may be additional manners of dividing in actual implementation, such as multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, or may be in electrical or other forms.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units described above, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be essentially or a part contributing to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc., in particular may be a processor in the computer device) to perform all or part of the steps of the above-described method of the various embodiments of the present application. Wherein the aforementioned storage medium may comprise: a U-disk, a removable hard disk, a magnetic disk, an optical disk, a Read-Only Memory (abbreviated as ROM), a random access Memory (abbreviated as Random Access Memory, RAM), or the like.
The above embodiments are merely for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (7)

1. A short link generation method, the method comprising:
responding to a long-link conversion request submitted by a terminal device, and acquiring a target long-link address to be converted carried by the long-link conversion request and a short-link conversion strategy set for the target long-link address, wherein the short-link conversion strategy comprises a short-link generation mode and a short-link constraint condition corresponding to the short-link generation mode; when the short link generation mode is a random generation mode, the short link constraint condition comprises at least one of the following: character set type, character set length and encryption mode; when the short link generation mode is a custom generation mode, the short link constraint condition comprises a designated character string;
when the short link generation mode is a random generation mode and the short link constraint condition comprises a character set type, a character set length and an encryption mode, encrypting the target long link address according to the encryption mode to obtain encrypted data; splitting the encrypted data to obtain a preset number of character strings; determining a data subscript range corresponding to the character set type according to the character set type, and determining a displacement step length according to the character set length; processing the preset number of character strings by utilizing the data subscript range and the displacement step length to obtain a first short link brief code set;
When the short link generation mode is a custom generation mode and the short link constraint condition comprises a designated character string, determining the designated character string as a candidate short link brevity code; constructing a first short link brief code set comprising the candidate short link brief codes; the first short link brevity code set comprises one or more candidate short link brevity codes;
traversing a second short link brevity code set to determine whether a target short link brevity code in the first short link brevity code set exists in the second short link brevity code set, wherein the target short link brevity code is any candidate short link brevity code in the first short link brevity code set, and the second short link brevity code set comprises one or more short link brevity codes which are used;
and when the target short link brevity code does not exist in the second short link brevity code set, generating a target short link address comprising the target short link brevity code, and outputting the target short link address through terminal equipment.
2. The method of claim 1, wherein the character set length is n, and the processing the predetermined number of character strings using the data index range and the displacement step length to obtain a first short link brevity code set comprises:
Determining a first bit character of a short link brevity code corresponding to a target character string according to a target data index corresponding to the data index range and the target character string in the preset number of character strings; the target character string is any character string in the preset number of character strings;
acquiring mth shift data corresponding to the target character string according to the shift step length; wherein m is an integer greater than 0 and less than n;
according to the target data subscript and the mth shift data, determining an (m+1) -th bit character of a short link brevity code corresponding to the target character string;
and determining the short link brief code corresponding to the target character string as a candidate short link brief code, and constructing a first short link brief code set comprising the candidate short link brief code.
3. The method according to claim 2, wherein the determining the first bit character of the short link shortcode corresponding to the target character string according to the target data index corresponding to the data index range and the target character string in the preset number of character strings includes:
performing AND operation on the target data subscript corresponding to the data subscript range and the target character strings in the preset number of character strings to obtain a first operation result;
Determining a first bit character of a short link brevity code corresponding to the target character string according to the first operation result;
the determining the (m+1) -th bit character of the short link brevity code corresponding to the target character string according to the target data subscript and the (m) -th shift data comprises the following steps:
performing AND operation on the target data subscript and the mth shift data to obtain an mth+1th operation result;
and determining the m+1st character of the short link brevity code corresponding to the target character string according to the m+1st operation result.
4. The method of claim 3, wherein determining the first bit character of the short link shortcode corresponding to the target string according to the first operation result includes:
determining a first data index according to the first operation result;
determining the character corresponding to the first data subscript according to the corresponding relation between the data subscript and the character;
and determining the character corresponding to the first data subscript as a first bit character of a short link brevity code corresponding to the target character string.
5. The method according to any one of claims 2-4, wherein the obtaining, according to the displacement step, mth displacement data corresponding to the target character string includes:
When m is equal to 1, acquiring first shift data corresponding to the target character string according to the shift step length;
and when m is greater than 1, acquiring shift data corresponding to the m-1 shift data according to the shift step length, and taking the shift data as the m shift data corresponding to the target character string.
6. A short link generation device, characterized in that the device is applied to the short link generation method of any one of claims 1-5.
7. An electronic device, the electronic device comprising: processor, input device, output device and memory, said processor, input device, output device and memory being interconnected, wherein said memory is adapted to store a computer program comprising program instructions, said processor being configured to invoke said program instructions to perform the short link generation method according to any of claims 1-5.
CN202011251503.8A 2020-11-10 2020-11-10 Short link generation method and related equipment Active CN112380464B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011251503.8A CN112380464B (en) 2020-11-10 2020-11-10 Short link generation method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011251503.8A CN112380464B (en) 2020-11-10 2020-11-10 Short link generation method and related equipment

Publications (2)

Publication Number Publication Date
CN112380464A CN112380464A (en) 2021-02-19
CN112380464B true CN112380464B (en) 2023-07-28

Family

ID=74578669

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011251503.8A Active CN112380464B (en) 2020-11-10 2020-11-10 Short link generation method and related equipment

Country Status (1)

Country Link
CN (1) CN112380464B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113420238A (en) * 2021-06-18 2021-09-21 浙江集享电子商务有限公司 Short link generation method, device, electronic device and storage medium
CN113505318A (en) * 2021-07-26 2021-10-15 全景智联(武汉)科技有限公司 Short link generation method, device, equipment and storage medium
CN113761406B (en) * 2021-09-03 2024-06-04 丰巢网络技术有限公司 Intelligent cabinet two-dimension code short-chain generation method and device, medium and electronic equipment
CN115438145B (en) * 2022-04-13 2024-05-14 盐城天眼察微科技有限公司 Method and device for adding enterprise detail inner links
CN115065945B (en) * 2022-06-28 2023-08-29 飞鸟鱼信息科技有限公司 Short message link generation method and device, electronic equipment and storage medium
CN115587609A (en) * 2022-09-27 2023-01-10 深圳市智码通科技有限公司 Short-link two-dimensional code generation method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5216232A (en) * 1990-09-10 1993-06-01 Metrologic Instruments, Inc. Projection laser scanner producing a narrow scan volume
CN106412140A (en) * 2015-08-03 2017-02-15 沈阳东软睿道教育服务有限公司 Short link address generating method and system thereof
CN106933854A (en) * 2015-12-30 2017-07-07 阿里巴巴集团控股有限公司 Short linking processing method, device and server
CN110851748A (en) * 2019-10-14 2020-02-28 平安科技(深圳)有限公司 Short link generation method, server, storage medium and computer equipment
CN111027656A (en) * 2019-11-15 2020-04-17 浙江口碑网络技术有限公司 Two-dimensional code generation and identification method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5216232A (en) * 1990-09-10 1993-06-01 Metrologic Instruments, Inc. Projection laser scanner producing a narrow scan volume
CN106412140A (en) * 2015-08-03 2017-02-15 沈阳东软睿道教育服务有限公司 Short link address generating method and system thereof
CN106933854A (en) * 2015-12-30 2017-07-07 阿里巴巴集团控股有限公司 Short linking processing method, device and server
CN110851748A (en) * 2019-10-14 2020-02-28 平安科技(深圳)有限公司 Short link generation method, server, storage medium and computer equipment
CN111027656A (en) * 2019-11-15 2020-04-17 浙江口碑网络技术有限公司 Two-dimensional code generation and identification method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112380464A (en) 2021-02-19

Similar Documents

Publication Publication Date Title
CN112380464B (en) Short link generation method and related equipment
CN109040341B (en) Intelligent contract address generation method and device, computer equipment and readable storage medium
US20200220735A1 (en) Merkle signature scheme tree expansion
EP3203709B1 (en) Cloud service server and method for managing cloud service server
US10033741B2 (en) Scalable and dynamic content obfuscation
CN110224999B (en) Information interaction method and device and storage medium
CN109521956B (en) Cloud storage method, device, equipment and storage medium based on block chain
CN105516068A (en) Information interaction method, method and device for associating human body biological characteristic data with account number
CN111163130A (en) Network service system and data transmission method thereof
CN105357110A (en) Mail sending method, device and system
CN104601582A (en) File transfer method, device and system
CN111984735A (en) Data archiving method and device, electronic equipment and storage medium
CN111367923A (en) Data processing method, data processing device, node equipment and storage medium
CN113094334A (en) Digital service method, device, equipment and storage medium based on distributed storage
CN112035763A (en) Information processing method, device and system, electronic equipment and storage medium
CN114499836A (en) Key management method, key management device, computer equipment and readable storage medium
CN113243093B (en) System and method for message transmission and retrieval using blockchain
CN116055143A (en) Encryption method and device for sharing links
CN108737350B (en) Information processing method and client
CN114282239A (en) Data encryption method, device, storage medium and processor
CN115361376A (en) Government affair file uploading method and device, electronic equipment and storage medium
CN114039801A (en) Short link generation method, short link analysis system, short link analysis equipment and storage medium
CN112417326A (en) URL conversion method and device, electronic equipment and storage medium
CN113765674A (en) Cross-platform registration method and device based on block chain
CN112714068A (en) Method, device and system for processing coded image, storage medium and electronic device

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
GR01 Patent grant
GR01 Patent grant