Short link generation method, link management method, electronic equipment and storage medium
By embedding user information in short links and combining digital signature and hashing algorithms, the problems of lack of tamper-proof mechanism, inability to trace the usage situation and insufficient data security in the existing short link generation methods are solved, and efficient, secure and personalized short link generation and management are achieved.
Patent Information
- Application Number
- CN202411988397.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-22
AI Technical Summary
The existing short link generation methods lack tamper-proof mechanisms, cannot trace the use of links, insufficient data security, and cannot implement personalized and targeted services.
Ensure the data integrity and security of short links by embedding user information in short links and combining digital signatures and hashing algorithms. When generating a short link, the long URL, user information and timestamp are spliced into a string, hash calculation and signature, and finally the final short link is generated through Base64 encoding.
Effectively prevent short link tampering, improve traceability, improve data security and personalized experience, simplify data sharing, and optimize data storage and transmission efficiency.
Smart Images

Figure CN119862333A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a short link generation method, a link management method, an electronic device and a storage medium. Background Art
[0002] In the field of geological engineering survey, existing report generation and data management technologies have many problems and shortcomings when processing large amounts of complex data, including the following aspects:
[0003] Short links are easily tampered with and forged: Traditional short link generation methods lack effective anti-tampering mechanisms. Attackers or malicious users can simply replace or tamper with the content in the short link to direct users to malicious websites or conduct fraudulent operations. This poses a security risk when users click on short links, especially on public platforms such as social media and advertisements, where short links can easily become tools for phishing attacks.
[0004] Lack of traceability and auditing capabilities: Traditional short link generation solutions usually do not support effective traceability mechanisms. The inability to track and audit the source of the short link, the identity of the visitor, and the access time makes it impossible to accurately record and analyze the use of the short link. This lack of traceability is particularly prominent in scenarios that require security audits, user behavior tracking, and data analysis.
[0005] Insufficient data security: Without embedding user information and encryption protection, traditional short links usually simply compress the URL, failing to fully consider the protection of user data and privacy security. This means that the user's identity information, click behavior, etc. may be exposed, leading to privacy leakage or abuse, especially in application scenarios involving sensitive information, data security issues are particularly prominent.
[0006] Inability to achieve personalized and targeted services: Traditional short link generation methods usually only focus on link compression, and fail to embed personalized data such as user information and source channels in the short link, and cannot provide users with customized experience or services. In the application scenarios of precision marketing and targeted advertising, it is impossible to perform personalized jumps based on users' specific needs or behaviors, resulting in poor promotion effects. Summary of the invention
[0007] The present invention aims to solve at least one of the technical problems existing in the prior art, and proposes a short link generation method, a link management method, an electronic device and a storage medium. The present invention embeds user information (such as user ID, channel ID, geographic area, etc.) in the short link, and combines digital signatures and hash algorithms to ensure that the generated short link has both efficient compression function and can prevent tampering and ensure data integrity. While transmitting user-specific information, the short link uses digital signature technology to encrypt the data to prevent any unauthorized tampering, thereby improving the security of the link.
[0008] In a first aspect, the present invention provides a short link generation method, comprising the following steps:
[0009] Receive a request from a client, wherein the request carries at least a long URL;
[0010] Concatenate the long URL, user information and timestamp into a single string;
[0011] Perform hash calculation on the concatenated strings to generate a unique hash value;
[0012] Sign the hash value using a private key to generate a digital signature;
[0013] Encode the hash value, user information, timestamp and digital signature to generate a character-readable encoding string;
[0014] Concatenate the encoded data with the server's base URL to form the final short link.
[0015] Furthermore, the user information includes user ID, channel ID, and geographic area.
[0016] Further, using a private key to sign the hash value specifically includes: using a private key in asymmetric encryption to sign the hash value.
[0017] Furthermore, encoding the hash value, user information, timestamp and digital signature specifically includes: Base64 encoding the hash value, user information, timestamp and digital signature.
[0018] In a second aspect, the present invention provides an electronic device, comprising:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores one or more computer programs that can be executed by the at least one processor, and the one or more computer programs are executed by the at least one processor so that the at least one processor can execute the short link generation method as described in the first aspect.
[0022] In a third aspect, the present invention provides a storage medium for readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the short link generation method as described in the first aspect.
[0023] In a fourth aspect, the present invention provides a link management method, comprising the following steps:
[0024] When a click event of the short link is sensed, verifying the short link, wherein the short link is generated by the short link generation method as described in the first aspect;
[0025] Verify the short link, including:
[0026] Decode the encoded part of the short link and extract the hash value, user information, timestamp and signature;
[0027] Use the public key to verify the extracted signature. If the signature verification fails, the user will be denied access. If the signature is successful, the hash value is recalculated and compared with the hash value contained in the short link. If the hash values are consistent, the verification is successful.
[0028] After verification, jump to the personalized target page or content based on the user information.
[0029] Furthermore, the link management method of the present invention further comprises the following step: tracing back the generation history and usage record of the short link according to the timestamp and user information.
[0030] In a fifth aspect, the present invention provides an electronic device, comprising:
[0031] at least one processor; and
[0032] a memory communicatively connected to the at least one processor; wherein,
[0033] The memory stores one or more computer programs that can be executed by the at least one processor, and the one or more computer programs are executed by the at least one processor so that the at least one processor can execute the link management method as described in the fourth aspect.
[0034] In a sixth aspect, the present invention provides a storage medium for readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the link management method as described in the fourth aspect.
[0035] The present invention has at least the following beneficial effects:
[0036] 1. Enhanced security: This invention can effectively prevent the short link from being tampered with or forged during transmission by introducing hash calculation and digital signature technology. The digital signature generated by the private key is combined with the public key verification mechanism to ensure the data integrity and authenticity of the short link and prevent malicious tampering or forgery of the link.
[0037] 2. Improve traceability: The present invention embeds user information and timestamp data in the short link, making it easier to trace the source, generation time, and usage of the short link. This is of great significance for user behavior analysis, content tracking, and data auditing. The usage history of a short link can be quickly tracked to provide support for security auditing and marketing analysis.
[0038] 3. Improve personalized experience: Short links can embed personalized information of users, such as channel ID, geographic region, user ID, etc. Through this information, the system can provide users with personalized content and services. For example, jump to a specific page or advertisement, enhance user experience, and improve conversion rate.
[0039] 4. Simplify data sharing: The present invention utilizes the generation of short links and the embedding of user information to convert complex long links into short, easy-to-spread URLs. Users can quickly share information through short links while ensuring the data security and integrity of the shared links.
[0040] 5. Optimize data storage and transmission efficiency: The present invention uses Base64 encoding to compress complex data into short character strings, thereby reducing the pressure of data storage and transmission. Short links can not only effectively store key information, but also facilitate transmission in the network, saving storage space and bandwidth resources.
[0041] 6. Prevent illegal link reuse: Since each short link carries verification mechanisms such as user information, timestamp and signature, short links cannot be reused or abused. Even if an external malicious user obtains the short link, they cannot forge a new legal link, thus effectively preventing the abuse of illegal links.
[0042] 7. Enhanced data privacy protection: The encryption and signature mechanism in the short link helps protect the user's private data from being leaked. Even if the short link is obtained by a third party, the encryption of the data minimizes the risk of information leakage and improves the security of user data. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A flowchart of a short link generation method provided by an embodiment of the present invention;
[0044] Figure 2 The present invention provides a flowchart of a link management method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] The background of short link technology mainly stems from the need to manage long URLs, especially in the Internet and mobile application environment, long URLs are often too long and difficult to share. Many platforms and applications have strict restrictions on the character length of URLs, especially in channels such as social media, text messages, and emails. Long links are often not easy to spread or exceed the character limit. Short link technology solves this problem by converting long URLs into short, easy-to-share links, while improving user experience and link readability.
[0047] In addition, short links also play an important role in data transmission efficiency and optimization. By simplifying the parameters and information in the URL, short links can reduce redundant data and improve the speed and efficiency of network transmission. Especially in complex URLs that need to pass multiple parameters, short links provide a more efficient way of data transmission. At the same time, short links are widely used in marketing promotion. Combined with tracking identifiers such as UTM parameters, they can help advertisers track important data such as clicks, user sources, and geographic locations, thereby achieving accurate promotion effect analysis.
[0048] This paper proposes a short link generation method based on user information embedding and anti-tampering mechanism, aiming to solve the shortcomings of existing short links in terms of security, personalized customization and data traceability. This method combines technologies such as digital signature, hash algorithm, data encryption and Base64 encoding to ensure the security, data integrity, personalized service and traceability of short links.
[0049] See also Figure 1 The embodiment of the present invention discloses a short link generation method, comprising the following steps:
[0050] Receive a request from a client, wherein the request carries at least a long URL;
[0051] Concatenate the long URL, user information and timestamp into a single string;
[0052] Perform hash calculation on the concatenated strings to generate a unique hash value;
[0053] Sign the hash value using a private key to generate a digital signature;
[0054] Encode the hash value, user information, timestamp and digital signature to generate a character-readable encoding string;
[0055] Concatenate the encoded data with the server's base URL to form the final short link.
[0056] The present invention also requires obtaining user information. When requesting to generate a short link, the way the server obtains user information may vary depending on the specific implementation method and application scenario. But generally speaking, the server can obtain user information in the following ways, but not limited to:
[0057] Information directly provided by users: In some cases, users may need to fill out forms or register to generate short links. In these processes, users will actively provide personal information, and the server can collect and store this information for subsequent use.
[0058] User information can also be obtained through user login or registration system.
[0059] The user provides a long URL that needs to be converted into a short link, such as a user inputting a long URL. The present invention splices key data such as the long URL, user information, and timestamp into a string to be processed. This step combines the original long URL with the user's personalized information to form a link data structure that can be customized according to the user's specific needs.
[0060] The concatenated data example is:
[0061] longUrl+userId+channelId+geoRegion+timestamp
[0062] Furthermore, the user information includes user ID, channel ID, and geographic area.
[0063] Furthermore, when performing hash calculation on the concatenated data, a common hash algorithm (such as SHA-256) can be used to generate a fixed-length hash value. The function of the hash algorithm is to map data of any length to an output of a fixed length. The purpose of this step is to generate a unique identifier for verifying the consistency and integrity of the data. For example:
[0064] hashValue=SHA-256(longUrl+userId+channelId+geoRegion+timestamp)
[0065] Furthermore, the hash value is signed using a private key, specifically including: using the private key in asymmetric encryption to sign the hash value. The purpose of the signature is to ensure that the data will not be tampered with during transmission, and the integrity of the data can be ensured during verification. The digital signature is generated using a private key, and only the corresponding public key can be verified, thus effectively ensuring the tamper-proof nature of the short link. The signing process is as follows:
[0066] signature=sign(hashValue, privateKey)
[0067] Further, the hash value, user information, timestamp and digital signature are encoded to generate a character-readable encoding string, specifically including: Base64 encoding the hash value, user information, timestamp and digital signature, converting all data into a character-readable string for transmission in the short link. Base64 encoding can convert binary data into printable characters, which is very effective for transmitting encrypted data in the link.
[0068] The encoded data structure may look like this:
[0069] encodedData=Base64.encode(hashValue+″|″+userId+″|″+channelId+″|″+geoRegion+″|″+timestamp+″|″+signature)
[0070] Furthermore, the present invention concatenates the Base64-encoded data with the server's base URL to form a final short link. For example:
[0071] shortLink="https: / / example.com / "+encodedData
[0072] The short link generated by the above method of the present invention is not only a short and easy-to-spread URL, but also contains necessary user information, timestamp and signature, thereby ensuring the security and personalization of the short link.
[0073] The short link generation scheme of the present invention has significant technical value. By combining the hash algorithm and the digital signature technology, the security of the short link is improved. The digital signature generated by the private key and verified by the public key ensures the data integrity and authenticity of the short link during the transmission process, effectively preventing tampering and forgery, and is particularly suitable for fields that require high security, such as finance and e-commerce.
[0074] The present invention achieves traceability by embedding user information and timestamps in short links, which facilitates subsequent security audits, data analysis, and user behavior tracking. In addition, the short link generation process supports embedding user personalized information, such as user ID, geographic location, etc., to achieve customized content jumps, improve user experience and conversion rate, and is widely used in advertising marketing and recommendation systems.
[0075] The present invention also optimizes data transmission and storage efficiency through Base64 encoding, reduces bandwidth consumption and storage space requirements, and is suitable for scenarios where short links are generated at a high frequency, such as social media sharing and mobile Internet applications. At the same time, the timestamp and signature mechanism in the short link effectively prevents the abuse of illegal links and ensures the uniqueness and timeliness of the link.
[0076] The present invention also protects user privacy through encryption and signature technology, meets modern data security requirements, and ensures the security of data in a public network environment. In summary, the present invention improves the security, traceability and personalization of short links through a variety of technical means, and has broad application prospects.
[0077] Based on the same inventive concept, an embodiment of the present invention provides an electronic device, including:
[0078] at least one processor; and
[0079] a memory communicatively connected to the at least one processor; wherein,
[0080] The memory stores one or more computer programs that can be executed by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the short link generation method described above.
[0081] Based on the same inventive concept, an embodiment of the present invention provides a storage medium for readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the short link generation method as described above.
[0082] Embodiment 2
[0083] See also Figure 2, an embodiment of the present invention provides a link management method, comprising the following steps:
[0084] When a click event of the short link is sensed, the short link is verified, wherein the short link is generated by the short link generation method as described in the first embodiment;
[0085] After verification, jump to the personalized target page or content based on the user information.
[0086] After the user clicks the short link, the system needs to verify. The specific process is as follows:
[0087] Decoding: The system first decodes the Base64 encoded part of the short link and extracts the hash value, user information, timestamp and signature.
[0088] Signature verification: The system uses the public key to verify the extracted signature to ensure the legitimacy of the signature. If the signature verification fails, it means that the link may have been tampered with and the system will deny access.
[0089] Hash value recalculation: The system recalculates the hash value and compares it with the hash value contained in the short link to ensure that the data has not been modified.
[0090] After verification, the system can provide personalized jumps based on user information, source channels, geographic regions and other data. For example, different users or channels may jump to different target pages or display different content. Short links not only complete simple jump tasks, but also support customized services based on user characteristics. The link management method of the present invention can realize customized jumps.
[0091] When a user clicks on a short link, the server receives a request containing the short link information. The server parses the received short link and finds the corresponding long link or target page information.
[0092] Furthermore, the link management method of the present invention further comprises the following steps: tracing the generation history and usage record of the short link according to the timestamp and user information. This information can be used for security audit or marketing data analysis.
[0093] The solution of the present invention is implemented through Java program, including multiple modules such as data analysis, database query, logical operation, data filling, etc., based on object-oriented architecture design. The interface between each module is flexibly defined through configuration files, and the system has high scalability and maintainability.
[0094] The present invention first concatenates data such as long URL, user information and generation timestamp into a string, and performs hash calculation on the string to generate a hash value of fixed length. Then, the hash value is digitally signed using a private key to ensure the security of the short link during the generation process. Finally, all relevant data (including hash value, user information, signature, etc.) are combined into a short link through Base64 encoding and provided to the user. The generated short link can provide a customized jump experience, while also supporting the tracing of access data to ensure that the source of the data and historical operation records can be traced back. The present invention can not only effectively prevent the short link from being tampered with, but also realize the personalized customization and efficient tracking of the short link, and is widely used in multiple fields such as precision marketing, customer relationship management, and advertising.
[0095] Based on the same inventive concept, an embodiment of the present disclosure provides an electronic device, including:
[0096] at least one processor; and
[0097] a memory communicatively connected to the at least one processor; wherein,
[0098] The memory stores one or more computer programs executable by the at least one processor. The one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the link management method described above.
[0099] Based on the same inventive concept, an embodiment of the present disclosure provides a storage medium for readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the link management method as described above.
[0100] Among them, the processor is a device with data processing capabilities, including but not limited to a central processing unit (CPU), etc.; the memory is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) is connected between the processor and the memory, and can realize information exchange between the processor and the memory, including but not limited to a data bus (Bus), etc.
[0101] In some embodiments, the processor, memory, and I / O interface are connected to each other and, in turn, to other components of the computing device via a bus.
[0102] In some embodiments, the one or more processors include a field programmable gate array.
[0103] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, including a computer program carried on a machine-readable medium, the computer program containing a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), the above-mentioned functions defined in the system of the present disclosure are executed.
[0104] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0105] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of the code, and the aforementioned module, program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0106] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present disclosure, but the present disclosure is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and substance of the present disclosure, and these modifications and improvements are also considered to be within the scope of protection of the present disclosure.
Claims
1. A short link generation method, characterized in that: The steps include: Receive a request from a client, wherein the request carries at least a long URL; Concatenate the long URL, user information and timestamp into a single string; Perform hash calculation on the concatenated strings to generate a unique hash value; Sign the hash value using a private key to generate a digital signature; Encode the hash value, user information, timestamp and digital signature to generate a character-readable encoding string; Concatenate the encoded data with the server's base URL to form the final short link.
2. The short link generation method according to claim 1, characterized in that: User information includes user ID, channel ID, and geographic area.
3. The short link generation method according to claim 1, characterized in that: Signing the hash value using a private key specifically includes: signing the hash value using a private key in asymmetric encryption.
4. The short link generation method according to claim 1, characterized in that: Encoding the hash value, user information, timestamp and digital signature specifically includes: Base64 encoding the hash value, user information, timestamp and digital signature.
5. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the short link generation method according to any one of claims 1 to 4.
6. A storage medium for readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the short link generation method as described in any one of claims 1 to 4.
7. A link management method, characterized in that: The steps include: When a click event of the short link is sensed, verifying the short link, wherein the short link is generated by the short link generation method according to any one of claims 1 to 4; Verify the short link, including: Decode the encoded part of the short link and extract the hash value, user information, timestamp and signature; Use the public key to verify the extracted signature. If the signature verification fails, the user will be denied access. If the signature is successful, the hash value is recalculated and compared with the hash value contained in the short link. If the hash values are consistent, the verification is successful. After verification, jump to the personalized target page or content based on the user information.
8. The link management method according to claim 7, characterized in that: The method also includes the following steps: tracing the generation history and usage records of the short link based on the timestamp and user information.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the link management method according to any one of claims 7 to 8.
10. A storage medium for readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the link management method according to any one of claims 7 to 8.
Citation Information
Cited By
National cryptographic algorithm-based unique identifier generation method and system, electronic equipment and storage medium
CN121150954A
Short link generation method and device, storage medium and electronic device
CN121301674A
Pre-signature URL (Uniform Resource Locator) generation method and equipment
CN121711105A