CN115391689B - Short link generation method, device, equipment and storage medium - Google Patents

Short link generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN115391689B
CN115391689B CN202211013898.7A CN202211013898A CN115391689B CN 115391689 B CN115391689 B CN 115391689B CN 202211013898 A CN202211013898 A CN 202211013898A CN 115391689 B CN115391689 B CN 115391689B
Authority
CN
China
Prior art keywords
random code
binary
short link
binary numbers
exchange
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
CN202211013898.7A
Other languages
Chinese (zh)
Other versions
CN115391689A (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.)
Beijing Teddy Future Technology Co ltd
Original Assignee
Beijing Teddy Bear Mobile Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Teddy Bear Mobile Technology Co ltd filed Critical Beijing Teddy Bear Mobile Technology Co ltd
Priority to CN202211013898.7A priority Critical patent/CN115391689B/en
Publication of CN115391689A publication Critical patent/CN115391689A/en
Application granted granted Critical
Publication of CN115391689B publication Critical patent/CN115391689B/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/9558Details of hyperlinks; Management of linked annotations
    • 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)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a short link generation method, a short link generation device, short link generation equipment and a storage medium, and relates to the technical field of computers. The method mainly comprises the following steps: acquiring binary numbers corresponding to the current sequence codes; performing bit operation on the binary numbers to obtain disordered binary numbers; carrying out preset binary system conversion on the disordered binary system to obtain a random code index number; indexing the characters in the character space according to the index number of the random code to obtain the random code; and splicing the domain name with the random code to obtain a short link. The short link generation method, the short link generation device, the short link generation equipment and the short link storage medium can ensure that the generated short link has uniqueness and randomness, do not need weight verification, and improve the short link generation efficiency.

Description

Short link generation method, device, equipment and storage medium
Technical Field
The disclosure relates to the field of computer technology, and in particular, to a method, a device, equipment and a storage medium for generating a short link.
Background
The short link is a short website character string obtained by converting the long link, which can achieve the same effect as the corresponding long link, and the short link generally comprises a domain name and a random code. In the prior art, short links are typically generated by:
(1) The random codes are orderly generated, the domain name and the random codes are spliced to obtain short links, but the short links generated in the mode are orderly and have no randomness;
(2) The random code is generated by utilizing a hash algorithm and the like, the domain name and the random code are spliced to obtain a short link, and the short link generated in the method is random but is not unique, the short link needs to be judged in the random code generated in the history, if the generated random code is repeated with the random code generated in the history, the random code needs to be regenerated and judged again, and the time for generating the short link is greatly increased.
Disclosure of Invention
The present disclosure provides a method, an apparatus, a device, and a storage medium for generating a short link, so as to at least solve the above technical problems in the prior art.
According to a first aspect of the present disclosure, there is provided a short link generation method, the method comprising: acquiring binary numbers corresponding to the current sequence codes; performing bit operation on the binary numbers to obtain disordered binary numbers; carrying out preset binary system conversion on the disordered binary system to obtain a random code index number; indexing the characters in the character space according to the index number of the random code to obtain the random code; and splicing the domain name with the random code to obtain a short link.
In one embodiment, before the performing the bit operation on the binary number, the method further includes: performing a leading zero padding operation on the binary number until the number of bits of the binary number reaches a first preset threshold; and before indexing the characters in the character space according to the index number of the random code to obtain the random code, the method further comprises: and performing a pre-zero padding operation on the random code index number until the number of bits of the random code index number reaches a second preset threshold value.
In one embodiment, the performing the bit operation on the binary number to obtain an out-of-order binary number includes: performing position exchange on the binary numbers to obtain initial binary numbers; and carrying out logic operation on the initial binary number and a fixed factor to obtain the disordered binary number.
In an embodiment, the performing the position exchange on the binary number to obtain an initial binary number includes: and carrying out position symmetry exchange on the value of the preset position in the binary number to obtain the initial binary number.
In an embodiment, the performing the position exchange on the binary number to obtain an initial binary number includes: equally dividing the value of a first preset position in the binary number to obtain a first exchange number and a second exchange number; and exchanging the values of the second preset positions of the first exchange number and the second exchange number to obtain the initial binary number.
In one embodiment, the logical operation includes at least one of: and performing AND operation, OR operation and XOR operation.
In an embodiment, the indexing the characters in the character space according to the index number of the random code to obtain the random code includes: searching the characters with the subscript identical to the value of each bit of the index number of the random code in the character space to obtain a searching result; and generating the random code according to the search result.
According to a second aspect of the present disclosure, there is provided a short link generation apparatus comprising: the acquisition module is used for acquiring binary numbers corresponding to the current sequence codes; the bit operation module is used for carrying out bit operation on the binary numbers to obtain disordered binary numbers; the conversion module is used for carrying out preset binary conversion on the disordered binary numbers to obtain random code index numbers; the index module is used for indexing the characters in the character space according to the index number of the random code to obtain the random code; and the splicing module is used for splicing the domain name with the random code to obtain a short link.
According to a third aspect of the present disclosure, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods described in the present disclosure.
According to a fourth aspect of the present disclosure, there is provided a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of the present disclosure.
The method, the device, the equipment and the storage medium for generating the short link comprise the steps of firstly carrying out bit operation on binary numbers corresponding to current sequence codes to obtain disordered binary numbers, then carrying out preset binary conversion on the disordered binary numbers to obtain random code index numbers, indexing characters in a character space according to the random code index numbers to obtain random codes, and finally splicing domain names and the random codes to obtain the short link. Therefore, the method can ensure that the generated short link has uniqueness and randomness by carrying out bit operation on the current sequence code and carrying out preset binary conversion and character indexing, and the method does not need weight verification, thereby improving the generation efficiency of the short link.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present disclosure will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings, in which:
in the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
FIG. 1 shows a schematic flow diagram of a short link generation method according to a first embodiment of the present disclosure;
FIG. 2 shows a schematic flow diagram of a short link generation method according to a third embodiment of the present disclosure;
FIG. 3 shows a flow diagram of a short link generation method according to a fourth embodiment of the present disclosure;
fig. 4 is a schematic structural view showing a short-link generating apparatus according to a fifth embodiment of the present disclosure;
fig. 5 shows a schematic diagram of a composition structure of an electronic device according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, features and advantages of the present disclosure more comprehensible, the technical solutions in the embodiments of the present disclosure will be clearly described in conjunction with the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. Based on the embodiments in this disclosure, all other embodiments that a person skilled in the art would obtain without making any inventive effort are within the scope of protection of this disclosure.
Fig. 1 shows a schematic flow chart of a short link generation method according to a first embodiment of the disclosure, as shown in fig. 1, the method mainly includes:
step S101, obtaining a binary number corresponding to the current sequence code.
In this embodiment, first, binary numbers corresponding to the current sequence code need to be acquired, where the current sequence code may be the number of times of generating the random code in the random code space, for example, if the random code is generated for the first time, the current sequence code is 1; if the random code is generated for the second time, the current sequence code is 2, and so on, after the current sequence code is obtained, the current sequence code needs to be converted into a binary number, specifically, the binary conversion method is the prior art, and the description is omitted here. The random code space is a space formed by all generated random codes under the condition that the character string length of the random codes and all characters which can be used for forming the random codes are certain, for example, the character string length of the preset generated random codes is 5, all the characters which can be used for forming the random codes are all capital English letters, namely A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, the random code space is a space formed by all the random codes with the character string length of 5 according to all the capital English letters, and the random codes in the random code space are different from each other.
Step S102, performing bit operation on the binary numbers to obtain disordered binary numbers.
In this embodiment, after obtaining the binary number corresponding to the current sequential code, the binary number needs to be subjected to bit operation, where the bit operation is used to scramble the binary number, so as to obtain a disordered binary number, and ensure that the subsequent random code generated according to the disordered binary number has randomness.
In one embodiment, the binary number may be subjected to a bit operation, which may be non-operation, or may be subjected to a position symmetrical exchange of values in the binary number, for example, if the binary number is 30 bits, and the position numbers are 1 to 30, the value corresponding to the position 1 is exchanged with the value corresponding to the position 30, the value corresponding to the position 2 is exchanged with the value corresponding to the position 29, and the like.
Step S103, performing preset binary conversion on the disordered binary numbers to obtain random code index numbers.
In this embodiment, preset binary conversion is further required for the disordered binary number to obtain a random code index number. The preset level is related to the number of all the characters that can be used to compose the random code, for example, if all the characters that can be used to compose the random code are all capital english letters, the preset level is 26 level; if all the characters which can be used for forming the random code are all capital English letters and all lowercase English letters, the preset system is a 52 system. Specifically, the preset binary conversion is a prior art, and will not be described herein.
Step S104, indexing the characters in the character space according to the index number of the random code to obtain the random code.
In this embodiment, after the random code index number is obtained, the characters in the character space are indexed according to the random code index number, so as to obtain the random code. The character space is a set of all characters that can be used to compose a random code, for example, if all characters that can be used to compose a random code are all capital english letters, the character space is: { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }.
In an embodiment, all the characters in the character space have corresponding subscripts, for example, in the character space formed by all the capital english letters, the subscript of the character a is 0, the subscript of the character B is 1, and so on, the subscript of the character Z is 25, and the subscript identical to the value can be searched in the character space according to the value of each bit of the index number of the random code in turn, and the characters corresponding to all the subscripts can form the random code.
Step S105, splicing the domain name and the random code to obtain a short link.
In this embodiment, the short link can be obtained by splicing the domain name with the generated random code. The domain name consists of a string of characters and points to an internet protocol (IP, internet Protocol) address, and the domain name can be acquired according to actual situations. Specifically, if the domain name is td6.Cn, the random code is 0YjXT, and the short link obtained by splicing the domain name and the random code is td6.Cn/0YjXT.
In a first embodiment of the present disclosure, first, a binary number corresponding to a current sequential code is subjected to a bit operation, that is, the current sequential code is scrambled to obtain a scrambled binary number, then the scrambled binary number is subjected to a preset binary conversion to obtain a random code index number, and according to the random code index number, characters in a character space are indexed to obtain a random code, and finally a domain name and the random code are spliced to obtain a short link. Therefore, the generated short link can be guaranteed to have uniqueness and randomness, weight verification is not needed, and the generation efficiency of the short link is improved.
In a second embodiment of the present disclosure, before step S102, the method further includes: performing front bit zero padding operation on binary numbers until the number of the binary numbers reaches a first preset threshold value; prior to step S104, the method further comprises: and performing a pre-zero padding operation on the random code index number until the number of bits of the random code index number reaches a second preset threshold.
In this embodiment, before performing the bit operation on the binary number, a preceding bit zero-filling operation is further performed on the binary number to make the number of bits of the binary number reach a first preset threshold, where the first preset threshold is the number of bits of the binary number corresponding to the size of the random code space, the size of the random code space is the number of all random codes in the random code space, and the size of the random code space can be calculated according to the size of the character space and the character string length of the random code, where the size of the character space is the number of all characters in the character space, for example, if the character space is composed of all capital english letters, the size of the character space is 26. Specifically, the random code space size may be calculated according to the following formula: m=q P Wherein M is the space size of the random code, Q is the size of the character space, P is the character string length of the random code, binary conversion is carried out on the random code after the space size of the random code is obtained, binary numbers corresponding to the space size of the random code are obtained, and the number of bits of the binary numbers corresponding to the space size of the random code is the first preset threshold value.
In one embodiment, if the size of the character space is 62 and the string length of the random code is 5, the space size of the random code is m=62 5 916132832, performing binary conversion to obtain binary number 110110100110110001001111100000 corresponding to the space of the random code, and then obtainingThe number of binary digits corresponding to the space size of the random code is 30, namely the first preset threshold value is 30; if the binary number corresponding to the current sequential code is 10101001110001010100, the number of bits is 20, so that 10 zeros are added before the binary number corresponding to the current sequential code, thereby obtaining 000000000010101001110001010100.
In this embodiment, before indexing the characters in the character space according to the random code index number, a preceding zero padding operation is further required for the random code index number until the number of bits of the random code index number reaches a second preset threshold, where the second preset threshold is the string length of the preset random code.
In the second embodiment of the present disclosure, the preceding zero padding operation is performed on the binary numbers corresponding to the current sequential code, so that the number of bits of the binary numbers reaches a first preset threshold value, the subsequent bit padding operation is convenient, and the first preset threshold value is the binary number corresponding to the space size of the random code, so that the preceding zero padding operation is performed on the binary numbers corresponding to the current sequential code, so that the number of bits of the binary numbers reaches the first preset threshold value, and the comprehensiveness of generating the random code can be ensured; in addition, the front bit zero padding operation is performed on the random code index number until the bit number of the random code index number reaches a second preset threshold value, so that the length of the character string of the finally generated random code can be ensured to reach the preset length.
Fig. 2 is a schematic flow chart of a short link generation method according to a third embodiment of the disclosure, as shown in fig. 2, step S102 mainly includes: performing position exchange on binary numbers to obtain initial binary numbers; and carrying out logic operation on the initial binary number and the fixed factor to obtain the disordered binary number.
In this embodiment, the binary number is first required to be subjected to position exchange to obtain an initial binary number, and then the initial binary number and the fixed factor are subjected to logic operation to obtain an disordered binary number, wherein the fixed factor is a number set in advance, and the fixed factor is not limited as long as the fixed factor can generate a larger difference in logic operation.
In one embodiment, performing a position exchange on the binary number to obtain an initial binary number includes: and carrying out position symmetry exchange on the value of the preset position in the binary number to obtain an initial binary number, namely selecting the value of the preset position in the binary number, for example selecting the value of the x to y bits in the binary number, then carrying out position symmetry exchange on the value of the x to y bits, namely exchanging the value corresponding to the x bit with the value corresponding to the y bit, and exchanging the value corresponding to the x-1 bit with the value corresponding to the y-1 bit, and the like, wherein the preset position can be set by oneself according to actual conditions. For example, if the binary number is 1001110100, the value of 5 to 10 bits thereof, namely 110100, is subjected to the position symmetry exchange to obtain 001011, the initial binary number is 1001001011.
In one embodiment, performing a position exchange on the binary number to obtain an initial binary number includes: equally dividing the value of a first preset position in the binary number to obtain a first exchange number and a second exchange number; and exchanging the values of the second preset positions of the first exchange number and the second exchange number to obtain an initial binary number. Equally dividing the value of the first preset position in the binary number from the middle position, wherein the obtained digits of the first exchange number and the second exchange number are the same, and then exchanging the value of the second preset position in the first exchange number and the second exchange number, for example exchanging the even number digits in the first exchange number and the second exchange number, so as to obtain the initial binary number, wherein the first preset position and the second preset position can be set according to actual conditions. For example, if the binary number is 1001110100, the value of 5 to 10 bits is 110100, then the number is equally divided to obtain the first exchange number 110 and the second exchange number 100, then the even number bits in the first exchange number and the second exchange number are exchanged, that is, the second number bits of the first exchange number and the second number bits are exchanged to obtain 100110, then the initial binary number is 1001100110.
In one embodiment, the logical operation includes at least one of: before the logical operation is performed on the initial binary number and the fixed factor, the AND operation, OR operation and exclusive OR operation are required to ensure that the number of bits of the initial binary number and the number of bits of the fixed factor are the same, and the binary number corresponding to the fixed factor can be subjected to pre-bit zero padding so that the number of bits corresponding to the fixed factor is the same as the number of bits of the initial binary number, wherein the number of bits of the initial binary number is the number of bits of the binary number corresponding to the space size of the random code, namely a first preset threshold value.
In the third embodiment of the present disclosure, the binary numbers are subjected to position exchange to obtain initial binary numbers, and the initial binary numbers and the fixed factors are subjected to logic operation to obtain disordered binary numbers, so that the randomness of the random codes generated according to the disordered binary numbers can be ensured.
Fig. 3 is a schematic flow chart of a short link generation method according to a fourth embodiment of the disclosure, as shown in fig. 3, step S104 mainly includes: searching the characters with the same values of each bit of the subscript and the random code index number in a character space to obtain a searching result; and generating a random code according to the search result.
In this embodiment, after obtaining the random code index number, for each value corresponding to each bit of the random code index number, the index is searched for the character whose index is identical to that of the index in the character space, so as to obtain a search result, and a random code is generated according to the search result.
In one embodiment, if the character space is: { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "X", "Y", "Z" } i.e. the size of the character space is 62, the subscript of the number 0 may be set to 0, the subscript of the number 1 may be set to 1, and so on, the subscript of the character Z may be set to 61, if the random code index number is 0YjXT, since the subscript of the character space is decimal, for convenience of indexing, the value of each bit of the random code index number needs to be converted into decimal, the value of each bit of the random code index number is actually (0, 60, 19, 59, 55), and the characters with subscripts of 0, 60, 19, 59, 55 are found in the character space, respectively, and the characters 0, Y, J, X, T may be obtained, and the random code is 0YjXT.
In an embodiment, the subscript of the character in the character space may be set to other bins, for example, the subscript of the character in the character space may be set to the same bin as the random code index number, so that the decimal conversion of the random code index number is not required, and the character with the subscript being the same as the value of each bit of the random code index number is directly searched in the character space, thereby obtaining the search result.
In the fourth embodiment of the present disclosure, the characters with the same values of each bit of the index numbers of the subscript and the random code are searched in the character space, so as to obtain a search result, and then the random code is generated according to the search result, so that the generated short link can be ensured to have uniqueness and randomness, and the weight verification is not required, thereby improving the short link generation efficiency.
A short link generation method of the present disclosure is described below by way of one example:
assume that:
the domain name is: td6.cn
The current random code m is: 695380;
the character string length P of the preset generated random code is as follows: 5, a step of;
the size Q of the character space is: 62;
the fixed factor N is: 38917561, binary 000010010100011101010110111001;
the random code space size M is: 62 5 916132832, binary 110110100110110001001111100000, 30 bits total;
the character space S is: { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", where the subscript of the number 0 is 0, the subscript of the number 1 is 1, and so on, the subscript of the character Z is 61.
Then:
the binary number corresponding to the current random code m is: 10101001110001010100;
leading the binary number corresponding to m to carry out zero padding so that the bit number reaches 30 bits: 000000000010101001110001010100;
taking 5 to 30 bits of binary numbers corresponding to m after zero padding operation, namely 00000010101001110001010100, then equally dividing the binary numbers to obtain a first exchange number 0000001010100 and a second exchange number 1110001010100, then exchanging odd-numbered bit values of the first exchange number and the second exchange number, namely exchanging 1-th bit value of the first exchange number with 1-th bit value of the second exchange number, exchanging 3-th bit value of the first exchange number with 3-th bit value of the second exchange number, and the like to obtain 10100010101000100001010100, splicing 1 to 4 bits of binary numbers corresponding to m before the value to obtain an initial binary number 000010100010101000100001010100, performing exclusive-or operation on the initial binary number and binary number 000010010100011101010110111001 of a fixed factor N to obtain disordered binary numbers: 000000110110110101110111101101;
converting the disordered binary number into Q system, namely 62 system, to obtain a random code index number: yjXT, carrying out front bit zero padding on the bit to enable the bit number to reach the character string length P of a preset generated random code, namely 5 bits, so as to obtain 0YjXT;
the value of each bit of the index number 0YjXT of the random code is actually (0, 60, 19, 59, 55), so that characters with subscripts of 0, 60, 19, 59, 55 are found in the character space, and characters 0, y, j, x, t can be obtained, and the random code is 0YjXT;
the domain name td6.Cn is spliced with the random code 0YjXT to obtain the short link td6.Cn/0YjXT.
Fig. 4 is a schematic structural view of a short link generation apparatus according to a fifth embodiment of the present disclosure, and as shown in fig. 4, the apparatus mainly includes:
an acquisition module 40, configured to acquire a binary number corresponding to a current sequential code; a bit operation module 41 for performing bit operation on binary numbers to obtain disordered binary numbers; the conversion module 42 is configured to perform preset binary conversion on the disordered binary numbers to obtain a random code index number; an indexing module 43, configured to index the characters in the character space according to the index number of the random code, so as to obtain the random code; and the splicing module 44 is used for splicing the domain name and the random code to obtain a short link.
In one embodiment, the apparatus further comprises: the zero padding module is used for performing a pre-bit zero padding operation on binary numbers until the number of the binary numbers reaches a first preset threshold; and performing a pre-zero padding operation on the random code index number until the number of bits of the random code index number reaches a second preset threshold.
In one embodiment, the bit manipulation module 41 mainly includes: the position exchange sub-module is used for carrying out position exchange on binary numbers to obtain initial binary numbers; the logic operation sub-module is used for carrying out logic operation on the initial binary number and the fixed factor to obtain an out-of-order binary number, wherein the logic operation comprises at least one of the following steps: and performing AND operation, OR operation and XOR operation.
In an embodiment, the location exchange sub-module is further configured to perform location symmetry exchange on a value of a preset location in the binary number to obtain an initial binary number.
In one embodiment, the location exchange submodule includes: the halving unit is used for halving the value of a first preset position in the binary number to obtain a first exchange number and a second exchange number; and the exchange unit is used for exchanging the values of the second preset positions of the first exchange number and the second exchange number to obtain an initial binary number.
In one embodiment, the indexing module 43 mainly includes: the searching sub-module is used for searching the characters with the same subscript value as each bit of the random code index number in the character space to obtain a searching result; and the generation sub-module is used for generating a random code according to the search result.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
Fig. 5 illustrates a schematic block diagram of an example electronic device 500 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 5, the apparatus 500 includes a computing unit 501 that can perform various suitable actions and processes according to a computer program stored in a Read Only Memory (ROM) 502 or a computer program loaded from a storage unit 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, ROM 502, and RAM 503 are connected to each other by a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Various components in the device 500 are connected to the I/O interface 505, including: an input unit 506 such as a keyboard, a mouse, etc.; an output unit 507 such as various types of displays, speakers, and the like; a storage unit 508 such as a magnetic disk, an optical disk, or the like; and a communication unit 509 such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 501 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 501 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as a short link generation method. For example, in some embodiments, a short link generation method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 500 via the ROM 502 and/or the communication unit 509. When a computer program is loaded into RAM 503 and executed by computing unit 501, one or more steps of one short link generation method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform a short link generation method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present disclosure, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
The foregoing is merely specific embodiments of the disclosure, but the protection scope of the disclosure is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the disclosure, and it is intended to cover the scope of the disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (9)

1. A short link generation method, the method comprising:
acquiring binary numbers corresponding to the current sequence codes;
performing bit operation on the binary numbers to obtain disordered binary numbers;
carrying out preset binary system conversion on the disordered binary system to obtain a random code index number;
indexing the characters in the character space according to the index number of the random code to obtain the random code;
splicing the domain name and the random code to obtain a short link;
the bit operation is performed on binary numbers to obtain disordered binary numbers, and the bit operation comprises the following steps:
performing position exchange on the binary numbers to obtain initial binary numbers;
and carrying out logic operation on the initial binary number and a fixed factor to obtain the disordered binary number.
2. The method of claim 1, wherein prior to said bit manipulation of binary numbers, the method further comprises:
performing a leading zero padding operation on the binary number until the number of bits of the binary number reaches a first preset threshold;
and before indexing the characters in the character space according to the index number of the random code to obtain the random code, the method further comprises:
and performing a pre-zero padding operation on the random code index number until the number of bits of the random code index number reaches a second preset threshold value.
3. The method of claim 1, wherein the performing the position exchange on the binary number to obtain the initial binary number comprises:
and carrying out position symmetry exchange on the value of the preset position in the binary number to obtain the initial binary number.
4. The method of claim 1, wherein the performing the position exchange on the binary number to obtain the initial binary number comprises:
equally dividing the value of a first preset position in the binary number to obtain a first exchange number and a second exchange number;
and exchanging the values of the second preset positions of the first exchange number and the second exchange number to obtain the initial binary number.
5. The method of any one of claims 1 to 4, wherein the logical operation comprises at least one of: and performing AND operation, OR operation and XOR operation.
6. The method according to claim 2, wherein indexing the characters in the character space according to the index number of the random code to obtain the random code comprises:
searching the characters with the subscript identical to the value of each bit of the index number of the random code in the character space to obtain a searching result;
and generating the random code according to the search result.
7. A short link generation apparatus, the apparatus comprising:
the acquisition module is used for acquiring binary numbers corresponding to the current sequence codes;
the bit operation module is used for carrying out bit operation on the binary numbers to obtain disordered binary numbers;
the conversion module is used for carrying out preset binary conversion on the disordered binary numbers to obtain random code index numbers;
the index module is used for indexing the characters in the character space according to the index number of the random code to obtain the random code;
the splicing module is used for splicing the domain name and the random code to obtain a short link;
the bit operation is performed on binary numbers to obtain disordered binary numbers, and the bit operation comprises the following steps:
performing position exchange on the binary numbers to obtain initial binary numbers;
and carrying out logic operation on the initial binary number and a fixed factor to obtain the disordered binary number.
8. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
9. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-6.
CN202211013898.7A 2022-08-23 2022-08-23 Short link generation method, device, equipment and storage medium Active CN115391689B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211013898.7A CN115391689B (en) 2022-08-23 2022-08-23 Short link generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211013898.7A CN115391689B (en) 2022-08-23 2022-08-23 Short link generation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115391689A CN115391689A (en) 2022-11-25
CN115391689B true CN115391689B (en) 2023-08-22

Family

ID=84120171

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211013898.7A Active CN115391689B (en) 2022-08-23 2022-08-23 Short link generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115391689B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110851748A (en) * 2019-10-14 2020-02-28 平安科技(深圳)有限公司 Short link generation method, server, storage medium and computer equipment
CN112035763A (en) * 2020-09-01 2020-12-04 中国银行股份有限公司 Information processing method, device and system, electronic equipment and storage medium
CN112784183A (en) * 2019-11-07 2021-05-11 北京京东尚科信息技术有限公司 Short chain joint generation method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109889616B (en) * 2018-05-21 2020-06-05 新华三信息安全技术有限公司 Method and device for identifying domain name

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110851748A (en) * 2019-10-14 2020-02-28 平安科技(深圳)有限公司 Short link generation method, server, storage medium and computer equipment
CN112784183A (en) * 2019-11-07 2021-05-11 北京京东尚科信息技术有限公司 Short chain joint generation method and device
CN112035763A (en) * 2020-09-01 2020-12-04 中国银行股份有限公司 Information processing method, device and system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN115391689A (en) 2022-11-25

Similar Documents

Publication Publication Date Title
CN112184367B (en) Order processing method and device
CN110489466B (en) Method and device for generating invitation code, terminal equipment and storage medium
US20190095490A1 (en) Memory-efficient storage and searching in hash tables using compressed indexes
CN103309893A (en) Character string comparing method and device
CN112818387A (en) Method, apparatus, storage medium, and program product for model parameter adjustment
CN115391689B (en) Short link generation method, device, equipment and storage medium
CN111737534B (en) File processing method, device and equipment
CN111353289B (en) Document comparison method and device, storage medium and electronic equipment
CN112486848A (en) Test data generation method and device, chip and storage medium
CN113448764A (en) Check code generation method and device, electronic equipment and computer storage medium
CN114722048B (en) Data processing method and device, electronic equipment and storage medium
CN113868254B (en) Method, device and storage medium for removing duplication of entity node in graph database
CN113467974B (en) Identification information generation method
CN112559547B (en) Method and device for determining consistency among multiple storage object copies
CN112000667B (en) Method, apparatus, server and medium for retrieving tree data
CN115242402A (en) Signature method, signature verification method and electronic equipment
CN114499465A (en) Hash algorithm, circuit and electronic equipment
CN109426358B (en) Information input method and device
CN111444535A (en) Method, apparatus, and computer storage medium for generating aggregated data tags
CN114357330A (en) Method, apparatus, device and medium for generating short-link code
CN113434508B (en) Method and apparatus for storing information
CN113901003B (en) Abstract compression method and related device
CN111460515B (en) Data matching method and device and electronic equipment
CN116341023B (en) Block chain-based service address verification method, device, equipment and storage medium
CN117056133B (en) Data backup method, device and medium based on distributed Internet of things architecture

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
CB02 Change of applicant information

Address after: East of 1st floor, No.36 Haidian Street, Haidian District, Beijing, 100000

Applicant after: Beijing Teddy Bear Mobile Technology Co.,Ltd.

Address before: 100085 07a36, block D, 7 / F, No.28, information road, Haidian District, Beijing

Applicant before: BEIJING TEDDY BEAR MOBILE TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: East of 1st floor, No.36 Haidian Street, Haidian District, Beijing, 100080

Patentee after: Beijing Teddy Future Technology Co.,Ltd.

Address before: East of 1st floor, No.36 Haidian Street, Haidian District, Beijing, 100000

Patentee before: Beijing Teddy Bear Mobile Technology Co.,Ltd.

CP03 Change of name, title or address