CN110365806A - Network address conversion method and device - Google Patents

Network address conversion method and device Download PDF

Info

Publication number
CN110365806A
CN110365806A CN201910492561.0A CN201910492561A CN110365806A CN 110365806 A CN110365806 A CN 110365806A CN 201910492561 A CN201910492561 A CN 201910492561A CN 110365806 A CN110365806 A CN 110365806A
Authority
CN
China
Prior art keywords
network address
code
chosen
equal
integer
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.)
Granted
Application number
CN201910492561.0A
Other languages
Chinese (zh)
Other versions
CN110365806B (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.)
WIRELESS LIFE (HANGZHOU) INFORMATION TECHNOLOGY Co Ltd
Original Assignee
WIRELESS LIFE (HANGZHOU) INFORMATION 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 WIRELESS LIFE (HANGZHOU) INFORMATION TECHNOLOGY Co Ltd filed Critical WIRELESS LIFE (HANGZHOU) INFORMATION TECHNOLOGY Co Ltd
Priority to CN201910492561.0A priority Critical patent/CN110365806B/en
Publication of CN110365806A publication Critical patent/CN110365806A/en
Application granted granted Critical
Publication of CN110365806B publication Critical patent/CN110365806B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/672Short addresses

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to network address conversion method and devices.This method comprises: doing Hash operation to long network address, H hashed values are obtained, H is more than or equal to 32;With preset order, M codes are chosen from hashed value every time, take n times, compared with the position the M code that n-th is chosen, in the position the M code that n times are chosen before an at least code is not included in (n+1)th position M code chosen, n is more than or equal to 1, M and is more than or equal to 6, N more than or equal to 8;The position the M chosen every time code is converted to 0~2MNumberical range in respective value;A character corresponding with respective value is obtained from preset characters group;The character string that will be made of the N number of character obtained, as the short network address output after the conversion of long network address.The technical solution can be such that the length of short network address fixes and unordered, reduce security risk;At least 64 can be obtained8(281,000,000,000,000) the short network address of kind combination, substantially reduces the collision rate between short network address;It can also realize resource multiplex, and save resource memory space.

Description

Network address conversion method and device
Technical field
The present invention relates to Internet technical field more particularly to a kind of network address conversion method and devices.
Background technique
Short network address refers to network address shorter in form, is usually calculated and is obtained according to original interminable long network address, and For replacing original long network address, to be user-friendly for network address sharing.
However, the length of short network address is not fixed when obtaining short network address using existing method, the length of short network address can be with The increase for the sequence of values being added in long network address and it is elongated, length is not fixed, moreover, obtain short network address it is orderly, exist not The risk of safety;And a possibility that repeating between the short network address of difference of acquisition, is also higher.
Summary of the invention
The embodiment of the present invention provides network address conversion method and device.The technical solution is as follows:
According to a first aspect of the embodiments of the present invention, a kind of network address conversion method is provided, comprising: Hash fortune is done to long network address It calculates, obtains H hashed values, H is the integer more than or equal to 32;With preset order, M are chosen from the hashed value every time Code, takes n times altogether, wherein compared with the position the M code that n-th is chosen, an at least code does not include in the position the M code of (n+1)th selection In the position the M code that preceding n times are chosen, n is the integer more than or equal to 1, and M is the integer more than or equal to 6, and N is more than or equal to 8 Integer;The position the M chosen every time code is converted to 0~2MNumberical range in respective value;It is obtained from preset characters group A character corresponding with the respective value, wherein the preset characters group includes at least 2M+ 1 kinds of characters, and it is each Character and described 0~2MNumberical range in a numerical value it is corresponding;By the character string as composed by the N number of character obtained, As the short network address output after the long network address conversion.
Preferably, H of the hashed value indicates the byte arrays including H/8 element, the method also includes: from institute Y element of selection in byte arrays is stated, Y is the integer more than or equal to 4;Y selected element is subjected to system number conversion, Obtain hexadecimal character string;The hexadecimal character string is subjected to overturning processing, the character string after being overturn;It will Character string after the overturning is initialized as X big integers, and X is the integer more than or equal to 32;It is described with preset order, often It is secondary that M codes are chosen from the hashed value, n times are taken altogether, comprising: with preset order, are chosen from described X of big integer every time M codes, take n times altogether.
Preferably, described with preset order when H is greater than or equal to 64, M codes are chosen from the hashed value every time, N times are taken altogether, wherein compared with the position the M code that n-th is chosen, an at least code is not included in the position the M code of (n+1)th selection In the position the M code that preceding n times are chosen, comprising: since the low level of the hashed value or a high position, M codes are continuously taken every time, take n times altogether, Wherein, the last bit for the position the M code that n-th is chosen is adjacent with the initial bit of the position M code that (n+1)th time is chosen.
Preferably, the preset characters array is at least made of following character: " a "~" z ", " A "~" Z ", " 0 "~" 9 ", "=", "-".
Preferably, using any hash function in MD5, MD4, SHA and CRC-32, Hash is carried out to the long network address Operation.
According to a second aspect of the embodiments of the present invention, a kind of network address conversion equipment is provided, comprising: processing module, for pair Long network address does Hash operation, obtains H hashed values, and H is greater than or equal to 32;First chooses module, is used for preset order, every time M codes are chosen from the hashed value, take n times altogether, wherein compared with the position the M code that n-th is chosen, the position M of (n+1)th selection In the position the M code that n times are chosen before an at least code is not included in code, n is integer more than or equal to 1, M for more than or equal to 6 integer, N are the integer more than or equal to 8;First conversion module, for the position the M chosen every time code to be converted to 0~2M's Respective value in numberical range;Module is obtained, for obtaining one corresponding with the respective value from preset characters group Character, wherein the preset characters group includes at least 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range In a numerical value it is corresponding;Output module, for by the character string as composed by the N number of character obtained, as the fourdrinier wire Short network address output after the conversion of location.
Preferably, H of the hashed value indicates the byte arrays including H/8 element, described device further include: second Module is chosen, for choosing Y element from the byte arrays, Y is the integer more than or equal to 4;Second conversion module is used In Y selected element is carried out system number conversion, hexadecimal character string is obtained;Flip module is used for described ten The character string of senary carries out overturning processing, the character string after being overturn;Third conversion module, for will be after the overturning Character string is initialized as X big integers, and X is the integer more than or equal to 32;The first selection module further includes the first choosing Submodule is taken, for M codes being chosen from described X of big integer every time, taking n times altogether with preset order.
Preferably, when H be greater than or equal to 64 when, it is described first choose module further include: second choose submodule, for from The low level or a high position of the hashed value start, and continuously take M codes every time, take n times altogether, wherein the end for the position the M code that n-th is chosen Position, it is adjacent with the initial bit of the position M code that (n+1)th time is chosen.
Preferably, the preset characters array is at least made of following character: " a "~" z ", " A "~" Z ", " 0 "~" 9 ", "=", "-".
According to a third aspect of the embodiments of the present invention, a kind of network address conversion equipment is provided, comprising: processor;For storing The memory of the processor-executable instruction;The processor is configured to executing the network address conversion that above-mentioned first aspect provides Method.
The technical solution that the embodiment of the present invention provides can include the following benefits: by doing Hash fortune to long network address It calculates, obtains H hashed values, H is the integer more than or equal to 32;With preset order, M are chosen from the hashed value every time Code, takes n times altogether, wherein compared with the position the M code that n-th is chosen, an at least code does not include in the position the M code of (n+1)th selection In the position the M code that preceding n times are chosen, n is the integer more than or equal to 1, and M is the integer more than or equal to 6, and N is more than or equal to 8 Integer;0~2 is converted by the position the M chosen every time codeMNumberical range in respective value;It is obtained from preset characters group A character corresponding with the respective value, wherein the preset characters group includes at least 2M+ 1 kinds of characters, and it is each Character and described 0~2MNumberical range in a numerical value it is corresponding;By the character string as composed by the N number of character obtained, As the short network address after the long network address conversion;The length of short network address can be made to fix and unordered, reduce security risk;It can obtain Obtain at least 648(281,000,000,000,000) the short network address of kind combination, substantially reduces the collision rate between short network address;And, it can also be ensured that phase Same long network address can be mapped in the same short network address, and for internal usage scenario, resource multiplex both may be implemented, also Resource memory space can be saved.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not It can the limitation present invention.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows and meets implementation of the invention Example, and be used to explain the principle of the present invention together with specification.
Fig. 1 is the flow chart of network address conversion method shown according to an exemplary embodiment.
Fig. 2 is the flow chart of network address conversion method shown according to an exemplary embodiment.
Fig. 3 is the flow chart of network address conversion method shown according to an exemplary embodiment.
Fig. 4 is the block diagram of network address conversion equipment shown according to an exemplary embodiment.
Fig. 5 is the block diagram of network address conversion equipment shown according to an exemplary embodiment.
Fig. 6 is the block diagram of network address conversion equipment shown according to an exemplary embodiment.
Fig. 7 is the block diagram of network address conversion equipment shown according to an exemplary embodiment.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment Described in embodiment do not represent all embodiments consistented with the present invention.On the contrary, they be only with it is such as appended The example of device and method being described in detail in claims, some aspects of the invention are consistent.
Fig. 1 is a kind of flow chart of network address conversion method shown according to an exemplary embodiment, as shown in Figure 1, the net Location conversion method includes the following steps 101-105:
In a step 101, Hash operation is done to long network address, obtains H hashed values, H is the integer more than or equal to 32.
Here, long network address is the long network address of character string type.It is exemplary, it can be using in MD5, MD4, SHA, CRC-32 Any hash function carries out Hash processing to long network address, to obtain the hashed value for including at least 32bit.
In a step 102, with preset order, M codes is chosen from the hashed value every time, take n times altogether, wherein with n-th The position the M code of secondary selection is compared, in the position the M code that n times are chosen before an at least code is not included in the position the M code of (n+1)th selection, N is the integer more than or equal to 1, and M is the integer more than or equal to 6, and N is the integer more than or equal to 8.
It is exemplary, it can be after obtaining at least hashed value of 32bit, according to bit sequences, each step-by-step obtains 6 Yard, an at least code was never acquired before being in 6 codes for taking 8 times, also, once obtaining altogether afterwards.After for example, Have in 6 codes once obtained and be illustrated for being never acquired before 2 codes, when hashed value is When " 001110101110 ... 101011100001 ", " 001110 " can be taken for the first time since a high position, then move to right two, " 111010 " are taken for the second time, continues to move to right two later, takes " 101011 " for the third time, until taking 8 times.Here, when H is 32bit When, in 6 codes once obtaining afterwards, can at least have and never be taken before 1 code, can have up to before 3 codes never It was taken;When after 6 codes once obtaining in have 1 code before never taken it is out-of-date, it is at most 27 times desirable;When after primary acquisition 6 codes in have never taken before 3 codes it is out-of-date, it is at most 9 times desirable.
In step 103,0~2 is converted by the position the M chosen every time codeMNumberical range in respective value.
It is exemplary, the M code can be converted into decimal number after often selecting M codes, for example, when the position M taken out Index value when code is " 001110 ", can be converted into decimal number " 14 ", and the numerical value being obtained as character.
At step 104, a character corresponding with the respective value is obtained from preset characters group, wherein described Preset characters group includes at least 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range in a numerical value phase It is corresponding.
Here, since every m code can be converted into 0~2MNumberical range in number, in order to reduce touching for short network address Rate is hit, needs to make 0~2MDigital scope in each numerical value corresponding to character it is different, so, the preset characters group is extremely It less include 2M+ 1 different character.Exemplary, the preset characters array is at least made of following character: " a "~" z ", " A " ~" Z ", " 0 "~" 9 ", "=", "-".
In step 105, by the character string as composed by the N number of character obtained, as short after the long network address conversion Network address output.
It is exemplary, when the character string successively obtained is " c ", " 9 ", " 2 ", " G ", "=", " 4 ", " j " and " E ", then export Short network address be then " c92G=4jE ".
Here, network address conversion method described in above-mentioned steps 101-105, which is applicable to C, C++ etc., can carry out bit manipulation In language environment.
In the present embodiment, long network address is handled by using hash function, obtains H hashed values, H is to be greater than or wait In 32 integer;With preset order, M codes are chosen from the hashed value every time, take n times altogether, wherein the M chosen with n-th Position code is compared, in the position the M code that n times are chosen before an at least code is not included in the position the M code of (n+1)th selection, n to be greater than or Integer equal to 1, M are the integer more than or equal to 6, and N is the integer more than or equal to 8;It converts the position the M chosen every time code to 0~2MNumberical range in respective value;A character corresponding with the respective value is obtained from preset characters group, In, the preset characters group includes at least 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range in one A numerical value is corresponding;By the character string as composed by the N number of character obtained, as the short network address after the long network address conversion;It can So that the length of short network address is fixed and unordered, reduction security risk;At least 64 can be obtained8(281,000,000,000,000) the short net of kind combination Location substantially reduces the collision rate between short network address;And, it can also be ensured that identical long network address may map to same short In network address, for internal usage scenario, resource multiplex both may be implemented, moreover it is possible to save resource memory space.
Fig. 2 is a kind of flow chart of network address conversion method shown according to an exemplary embodiment, as shown in Fig. 2, above-mentioned Network address conversion method further includes step 202-205, and step 102 may be performed that 206:
In step 201, Hash operation is done to long network address, obtains H hashed values, H is the integer more than or equal to 32, institute Stating H hashed values indicates the byte arrays including H/8 element.
It is exemplary, when hashed value is 32, then it represents that the byte arrays comprising 4 elements;When hashed value is 64, Then indicate the byte arrays comprising 8 elements.Here, a byte in an element representation byte arrays.
In step 202, Y element is chosen from the byte arrays, Y is the integer more than or equal to 4.
In step 203, Y selected element is subjected to system number conversion, obtains hexadecimal character string.
It is exemplary, it, can will be in 32 codes corresponding to 4 elements when choosing 4 elements from byte arrays Every 4 codes are converted to a hexadecimal character, finally, obtain the hexadecimal string including 8 characters.
In step 204, the hexadecimal character string is subjected to overturning processing, the character string after being overturn.
Here it is possible to overturning processing be carried out using the method that any character string is overturn, for example, can be using overturning function Reserse () is overturn.
In step 205, the character string after the overturning is initialized as to X big integers, X is more than or equal to 32 Integer.
Here, the character string after overturning is initialized as Biginteger.Here, extremely due to the hexadecimal character string It is less 32, so, it can get at least 32 big integers after conversion.
Here, data storage is carried out since C Plus Plus environment generallys use little endian mode, Java language generallys use big end Mode, by the way that the element chosen from byte arrays is converted to hexadecimal string, and by the hexadecimal string It is initialized as big integer, the data stored with big end mode can be converted to the data stored with little endian mode, to make to count It is consistent according to type.
In step 206, with preset order, M codes is chosen from described X of big integer every time, take n times altogether, wherein Compared with the position the M code that n-th is chosen, the position M of n times selection before an at least code is not included in the position the M code of (n+1)th selection In code, n is the integer more than or equal to 1, and M is the integer more than or equal to 6, and N is the integer more than or equal to 8.
In step 207, the position the M chosen every time code is converted to 0~2MNumberical range in respective value.
In a step 208, a character corresponding with the respective value is obtained from preset characters group, wherein described Preset characters group includes at least 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range in a numerical value phase It is corresponding.
In step 209, by the character string as composed by the N number of character obtained, as short after the long network address conversion Network address output.
In the present embodiment, by doing Hash operation to long network address, H hashed values are obtained, H is whole more than or equal to 32 Number, H of the hashed value indicate the byte arrays including H/8 element;Y element is chosen from the byte arrays, Y is Integer more than or equal to 4;Y selected element is subjected to system number conversion, obtains hexadecimal character string;It will be described Hexadecimal character string carries out overturning processing, the character string after being overturn;Character string after the overturning is initialized as X The big integer of position, X are the integer more than or equal to 32;With preset order, M codes are chosen from described X of big integer every time, N times are taken altogether, wherein compared with the position the M code that n-th is chosen, an at least code is not included in the position the M code of (n+1)th selection In the position the M code that preceding n times are chosen, n is the integer more than or equal to 1, and M is the integer more than or equal to 6, and N is more than or equal to 8 Integer;The position the M chosen every time code is converted to 0~2MNumberical range in respective value;From preset characters group obtain with The corresponding character of the respective value, wherein the preset characters group includes at least 2M+ 1 kinds of characters, and each word Symbol and described 0~2MNumberical range in a numerical value it is corresponding;By the character string as composed by the N number of character obtained, make For the short network address output after the long network address conversion;Can be realized in Java context length fix and it is unordered, collision rate is low The conversion of short network address;It can also guarantee that identical long network address may map in the same short network address, field is used for inside For scape, resource multiplex both may be implemented, moreover it is possible to save resource memory space.
Fig. 3 is a kind of flow chart of network address conversion method shown according to an exemplary embodiment, as shown in figure 3, step 102 can also be performed as 302:
In step 301, Hash operation is done to long network address, obtains H hashed values, H is greater than or equal to 64.
In step 302, since the low level of the hashed value or a high position, M codes are continuously taken every time, take n times altogether, In, the last bit for the position the M code that n-th is chosen is adjacent with the initial bit of the position M code that (n+1)th time is chosen, and n is whole more than or equal to 1 Number, M are the integer more than or equal to 6, and N is the integer more than or equal to 8.
Here, since H is greater than or equal to 64, so, when only taking 8 times, can make latter 6 codes obtained is it The preceding code never taken.It is exemplary, when H is 64, according to bit sequences, can first be taken since a high position for hashed value It is 6 high, later, 6 are moved to right, takes this 6 moved to right;For example, when hashed value is " 001110101110 ... 101011100001 " When, " 001110 " is first taken, then take " 101110 ".Here, when the code being never selected before the M position code chosen every time is, It can make to be converted that obtained numerical value is more dispersed by the M position code chosen, and then make dispersion rate between the kinds of characters obtained more Height, to keep the short network address obtained safer.
In step 303,0~2 is converted by the position the M chosen every time codeMNumberical range in respective value.
In step 304, a character corresponding with the respective value is obtained from preset characters group, wherein described Preset characters group includes at least 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range in a numerical value phase It is corresponding.
In step 305, by the character string as composed by the N number of character obtained, as short after the long network address conversion Network address output.
In the present embodiment, by doing Hash operation to long network address, H hashed values are obtained, H is greater than or equal to 64;From described The low level or a high position of hashed value start, and continuously take M codes every time, take n times altogether, wherein the last bit for the position the M code that n-th is chosen, with The initial bit of the position the M code of (n+1)th selection is adjacent, and n is the integer more than or equal to 1, and M is the integer more than or equal to 6, and N is Integer more than or equal to 8;The position the M chosen every time code is converted to 0~2MNumberical range in respective value;From predetermined word Fu Zuzhong obtains a character corresponding with the respective value, wherein the preset characters group includes at least 2M+ 1 difference Character, and each character and described 0~2MNumberical range in a numerical value it is corresponding;By N number of character institute group by obtaining At character string, as the short network address output after the long network address conversion;May be implemented length fix, be unordered, it is safe and collide The conversion of the low short network address of rate;It can also guarantee that identical long network address may map in the same short network address, for inside For usage scenario, resource multiplex both may be implemented, moreover it is possible to save resource memory space.
In another embodiment, above-mentioned steps 206 also may be performed that above-mentioned steps 302.
Fig. 4 is a kind of block diagram of network address conversion equipment shown according to an exemplary embodiment, which can be by soft Part, hardware or both are implemented in combination with as some or all of of electronic equipment.As shown in figure 4, the network address conversion equipment Include:
Processing module 401 obtains H hashed values, H is whole more than or equal to 32 for doing Hash operation to long network address Number;First chooses module 402, for choosing M codes from the hashed value every time, taking n times altogether with preset order, wherein with The position the M code that n-th is chosen is compared, the position the M code that n times are chosen before an at least code is not included in the position the M code of (n+1)th selection In, n is the integer more than or equal to 1, and M is the integer more than or equal to 6, and N is the integer more than or equal to 8;First modulus of conversion Block 403, for the position the M chosen every time code to be converted to 0~2MNumberical range in respective value;Module 404 is obtained, is used for A character corresponding with the respective value is obtained from preset characters group, wherein the preset characters group includes at least 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range in a numerical value it is corresponding;Output module 405 is used In by the character string as composed by the N number of character obtained, exported as the short network address after the long network address conversion.
As a kind of possible embodiment, Fig. 5 is a kind of network address conversion equipment shown according to an exemplary embodiment Block diagram.As shown in figure 5, the network address conversion equipment can be configured to include the second selection module 406, the second conversion module 407, flip module 408 and third conversion module 409;And first selection module 402 can be additionally configured to include first select Take submodule 4021;H of the hashed value indicates the byte arrays including H/8 element, in which:
Second chooses module 406, and for choosing Y element from the byte arrays, Y is the integer more than or equal to 4; Second conversion module 407 obtains hexadecimal character string for Y selected element to be carried out system number conversion;Overturning Module 408, for the hexadecimal character string to be carried out overturning processing, the character string after being overturn;Third modulus of conversion Block 409, for the character string after the overturning to be initialized as to X big integers, X is the integer more than or equal to 32;And First chooses submodule 4021, for M codes being chosen from described X of big integer every time, take n times altogether with preset orders, In, compared with the position the M code that n-th is chosen, n times are chosen before an at least code is not included in the position the M code of (n+1)th selection In M codes, n is the integer more than or equal to 1, and M is the integer more than or equal to 6, and N is the integer more than or equal to 8.
As a kind of possible embodiment, Fig. 6 is a kind of network address conversion equipment shown according to an exemplary embodiment Block diagram.As shown in fig. 6, the first selection module 402 can be configured to include the second selection submodule 4022, for working as When H is greater than or equal to 64, since the low level of the hashed value or a high position, M codes are continuously taken every time, take n times altogether, wherein n-th The last bit of the position the M code of secondary selection is adjacent with the initial bit of the position M code that (n+1)th time is chosen.
About the device in above-described embodiment, plurality of module executes the concrete mode of operation in related this method Embodiment in be described in detail, no detailed explanation will be given here.
Following is Installation practice provided by the invention, can be used for executing above method embodiment in the present invention.
Fig. 7 is a kind of block diagram of network address conversion equipment shown according to an exemplary embodiment, which is suitable for terminal Equipment.For example, device 700 can be computer equipment.
Device 700 may include following one or more components: processing component 702, memory 704, power supply module 706, Multimedia component 708, audio component 710, the interface 712 of input/output (I/O), sensor module 714 and communication component 716。
The integrated operation of the usual control device 700 of processing component 702, such as with display, telephone call, data communication, phase Machine operation and record operate associated operation.Processing component 702 may include that one or more processors 720 refer to execute It enables, to perform all or part of the steps of the methods described above.In addition, processing component 702 may include one or more modules, just Interaction between processing component 702 and other assemblies.For example, processing component 702 may include multi-media module, it is more to facilitate Interaction between media component 708 and processing component 702.
Memory 704 is configured as storing various types of data to support the operation in device 700.These data are shown Example includes the instruction of any application or method for operating on device 700, contact data, and telephone book data disappears Breath, picture, video etc..Memory 704 can be by any kind of volatibility or non-volatile memory device or their group It closes and realizes, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM) is erasable to compile Journey read-only memory (EPROM), programmable read only memory (PROM), read-only memory (ROM), magnetic memory, flash Device, disk or CD.
Power supply module 706 provides electric power for the various assemblies of device 700.Power supply module 706 may include power management dress Set, one or more power supplys and other with for device 700 generate, manage, and distribute the associated component of electric power.
Multimedia component 708 includes the screen of one output interface of offer between described device 700 and user.One In a little embodiments, screen may include liquid crystal display (LCD) and touch panel (TP).If screen includes touch panel, screen Curtain may be implemented as touch screen, to receive input signal from the user.Touch panel includes one or more touch sensings Device is to sense the gesture on touch, slide, and touch panel.The touch sensor can not only sense touch or sliding action Boundary, but also detect duration and pressure associated with the touch or slide operation.In some embodiments, more matchmakers Body component 708 includes a front camera and/or rear camera.When device 700 is in operation mode, such as screening-mode or When video mode, front camera and/or rear camera can receive external multi-medium data.Each front camera and Rear camera can be a fixed optical lens device or have focusing and optical zoom capabilities.
Audio component 710 is configured as output and/or input audio signal.For example, audio component 710 includes a Mike Wind (MIC), when device 700 is in operation mode, when such as call mode, recording mode, and voice recognition mode, microphone is matched It is set to reception external audio signal.The received audio signal can be further stored in memory 704 or via communication set Part 716 is sent.In some embodiments, audio component 710 further includes a loudspeaker, is used for output audio signal.
I/O interface 712 provides interface between processing component 702 and peripheral interface module, and above-mentioned peripheral interface module can To be keyboard, click wheel, button etc..These buttons may include, but are not limited to: home button, volume button, start button and lock Determine button.
Sensor module 714 includes one or more sensors, and the state for providing many aspects for device 700 is commented Estimate.For example, sensor module 714 can detecte the state that opens/closes of device 700, and the relative positioning of component, for example, it is described Component is the display and keypad of device 700, and sensor module 714 can be with 700 1 components of detection device 700 or device Position change, the existence or non-existence that user contacts with device 700,700 orientation of device or acceleration/deceleration and device 700 Temperature change.Sensor module 714 may include proximity sensor, be configured to detect without any physical contact Presence of nearby objects.Sensor module 714 can also include optical sensor, such as CMOS or ccd image sensor, at As being used in application.In some embodiments, which can also include acceleration transducer, gyro sensors Device, Magnetic Sensor, pressure sensor or temperature sensor.
Communication component 716 is configured to facilitate the communication of wired or wireless way between device 700 and other equipment.Device 700 can access the wireless network based on communication standard, such as WiFi, 2G or 3G or their combination.In an exemplary implementation In example, communication component 716 receives broadcast singal or broadcast related information from external broadcasting managing device via broadcast channel. In one exemplary embodiment, the communication component 716 further includes near-field communication (NFC) module, to promote short range communication.Example Such as, NFC module can be based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra wide band (UWB) technology, Bluetooth (BT) technology and other technologies are realized.
In the exemplary embodiment, device 700 can be believed by one or more application specific integrated circuit (ASIC), number Number processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are realized, for executing the above method.
In the exemplary embodiment, a kind of non-transitorycomputer readable storage medium including instruction, example are additionally provided It such as include the memory 704 of instruction, above-metioned instruction can be executed by the processor 720 of device 700 to complete the above method.For example, The non-transitorycomputer readable storage medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk With optical data storage devices etc..
A kind of computer readable storage medium is present embodiments provided, when the instruction in the storage medium is by device 700 Processor execute when perform the steps of
Hash processing is done to long network address, obtains H hashed values, H is the integer more than or equal to 32;With preset order, often It is secondary that M codes are chosen from the hashed value, n times are taken altogether, wherein compared with the position the M code that n-th is chosen, the M of (n+1)th selection In the position the M code that n times are chosen before an at least code is not included in the code of position, n is the integer more than or equal to 1, and M is to be greater than or wait In 6 integer, N is the integer more than or equal to 8;The position the M chosen every time code is converted to 0~2MNumberical range in it is corresponding Numerical value;A character corresponding with the respective value is obtained from preset characters group, wherein the preset characters group is at least wrapped Include 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range in a numerical value it is corresponding;By the N by obtaining Character string composed by a character, as the short network address output after the long network address conversion.
H of the hashed value indicates the byte arrays including H/8 element, and the instruction in the storage medium is processed Device can also perform the steps of the Y element of selection from the byte arrays when executing, Y is the integer more than or equal to 4; Y selected element is subjected to system number conversion, obtains hexadecimal character string;By the hexadecimal character string into Row overturning processing, the character string after being overturn;Character string after the overturning is initialized as to X big integers, X be greater than Or the integer equal to 32;It is described with preset order, every time from the hashed value choose M codes, take n times altogether, comprising: with preset Sequentially, M codes are chosen from described X of big integer every time, take n times altogether.
Instruction in the storage medium can also perform the steps of when being executed by processor from the low of the hashed value Position or a high position start, and continuously take M codes every time, take n times altogether, wherein the last bit for the position the M code that n-th is chosen is selected with (n+1)th time The initial bit of the position the M code taken is adjacent.
Instruction in the storage medium can also be performed the steps of when being executed by processor to the byte arrays into The conversion of row memory module, obtains the byte arrays stored with preset mode;The Y element chosen in the byte arrays, It include: to choose Y element from the byte arrays stored with preset mode.
The present embodiment additionally provides a kind of network address conversion equipment, comprising: processor;For storage processor executable instruction Memory;Processor is configured as:
Hash operation is done to long network address, obtains H hashed values, H is the integer more than or equal to 32;With preset order, often It is secondary that M codes are chosen from the hashed value, n times are taken altogether, wherein compared with the position the M code that n-th is chosen, the M of (n+1)th selection In the position the M code that n times are chosen before an at least code is not included in the code of position, n is the integer more than or equal to 1, and M is to be greater than or wait In 6 integer, N is the integer more than or equal to 8;The position the M chosen every time code is converted to 0~2MNumberical range in it is corresponding Numerical value;A character corresponding with the respective value is obtained from preset characters group, wherein the preset characters group is at least wrapped Include 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range in a numerical value it is corresponding;By the N by obtaining Character string composed by a character, as the short network address output after the long network address conversion.
In one embodiment, H of the hashed value indicates the byte arrays including H/8 element, and processor may be used also To be configured as: choosing Y element from the byte arrays, Y is the integer more than or equal to 4;By Y selected element System number conversion is carried out, hexadecimal character string is obtained;The hexadecimal character string is subjected to overturning processing, is turned over Character string after turning;Character string after the overturning is initialized as to X big integers, X is the integer more than or equal to 32;Institute It states with preset order, chooses M codes from the hashed value every time, take n times altogether, comprising: with preset order, every time from the X M codes are chosen in the big integer of position, take n times altogether.
In one embodiment, processor can be additionally configured to: when H is greater than or equal to 64, from the hashed value Low level or a high position start, and continuously take M codes every time, take n times altogether, wherein the last bit for the position the M code that n-th is chosen, with (n+1)th time The initial bit of the position the M code of selection is adjacent.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to of the invention its Its embodiment.This application is intended to cover any variations, uses, or adaptations of the invention, these modifications, purposes or Person's adaptive change follows general principle of the invention and including the undocumented common knowledge in the art of the present invention Or conventional techniques.The description and examples are only to be considered as illustrative, and true scope and spirit of the invention are by following Claim is pointed out.
It should be understood that the present invention is not limited to the precise structure already described above and shown in the accompanying drawings, and And various modifications and changes may be made without departing from the scope thereof.The scope of the present invention is limited only by the attached claims.

Claims (10)

1. a kind of network address conversion method characterized by comprising
Hash operation is done to long network address, obtains H hashed values, H is the integer more than or equal to 32;
With preset order, M codes are chosen from the hashed value every time, take n times altogether, wherein the position the M code phase chosen with n-th Than in the position the M code that n times are chosen before an at least code is not included in the position the M code of (n+1)th selection, n is more than or equal to 1 Integer, M is integer more than or equal to 6, and N is the integer more than or equal to 8;
The position the M chosen every time code is converted to 0~2MNumberical range in respective value;
A character corresponding with the respective value is obtained from preset characters group, wherein the preset characters group is at least wrapped Include 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range in a numerical value it is corresponding;
By the character string as composed by the N number of character obtained, as the short network address output after the long network address conversion.
2. network address conversion method according to claim 1, which is characterized in that H of the hashed value indicates to include H/8 The byte arrays of element, the method also includes:
Y element is chosen from the byte arrays, Y is the integer more than or equal to 4;
Y selected element is subjected to system number conversion, obtains hexadecimal character string;
The hexadecimal character string is subjected to overturning processing, the character string after being overturn;
Character string after the overturning is initialized as to X big integers, X is the integer more than or equal to 32;
It is described with preset order, every time from the hashed value choose M codes, take n times altogether, comprising:
With preset order, M codes are chosen from described X of big integer every time, take n times altogether.
3. network address conversion method according to claim 1, which is characterized in that described with default when H is greater than or equal to 64 Sequentially, M codes are chosen from the hashed value every time, take n times altogether, wherein compared with the position the M code that n-th is chosen, (n+1)th time In the position the M code that n times are chosen before an at least code is not included in the position the M code of selection, comprising:
Since the low level of the hashed value or a high position, M codes are continuously taken every time, take n times altogether, wherein the position M that n-th is chosen The last bit of code is adjacent with the initial bit of the position M code that (n+1)th time is chosen.
4. network address conversion method according to claim 1, which is characterized in that the preset characters array is at least by with lower word Symbol composition: " a "~" z ", " A "~" Z ", " 0 "~" 9 ", "=", "-".
5. network address conversion method according to claim 1, which is characterized in that using in MD5, MD4, SHA and CRC-32 Any hash function carries out Hash operation to the long network address.
6. a kind of network address conversion equipment characterized by comprising
Processing module obtains H hashed values, H is the integer more than or equal to 32 for doing Hash operation to long network address;
First chooses module, for preset order, chooses M codes from the hashed value every time, takes n times altogether, wherein with the The position the M code that n times are chosen is compared, the position the M code that n times are chosen before an at least code is not included in the position the M code of (n+1)th selection In, n is the integer more than or equal to 1, and M is the integer more than or equal to 6, and N is the integer more than or equal to 8;
First conversion module, for the position the M chosen every time code to be converted to 0~2MNumberical range in respective value;
Module is obtained, for obtaining a character corresponding with the respective value from preset characters group, wherein described default Character group includes at least 2M+ 1 kinds of characters, and each character and described 0~2MNumberical range in a numerical value it is opposite It answers;
Output module, for the short network address by the character string as composed by the N number of character obtained, after being converted as the long network address Output.
7. network address conversion equipment according to claim 6, which is characterized in that H of the hashed value indicates to include H/8 The byte arrays of element, described device further include:
Second chooses module, and for choosing Y element from the byte arrays, Y is the integer more than or equal to 4;
Second conversion module obtains hexadecimal character string for Y selected element to be carried out system number conversion;
Flip module, for the hexadecimal character string to be carried out overturning processing, the character string after being overturn;
Third conversion module, for the character string after the overturning to be initialized as to X big integers, X is more than or equal to 32 Integer;
The first selection module further includes the first selection submodule, is used for preset order, every time from described X of big integer M codes of middle selection, take n times altogether.
8. network address conversion equipment according to claim 6, which is characterized in that when H is greater than or equal to 64, first choosing Modulus block further include:
Second chooses submodule, for continuously taking M codes every time, taking n times altogether since the low level of the hashed value or a high position, Wherein, the last bit for the position the M code that n-th is chosen is adjacent with the initial bit of the position M code that (n+1)th time is chosen.
9. network address conversion equipment according to claim 6, which is characterized in that the preset characters array is at least by with lower word Symbol composition: " a "~" z ", " A "~" Z ", " 0 "~" 9 ", "=", "-".
10. a kind of network address conversion equipment characterized by comprising
Processor;
For storing the memory of the processor-executable instruction;
The processor is configured to executing the described in any item network address conversion methods of the claims 1-5.
CN201910492561.0A 2019-06-06 2019-06-06 Website conversion method and device Active CN110365806B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910492561.0A CN110365806B (en) 2019-06-06 2019-06-06 Website conversion method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910492561.0A CN110365806B (en) 2019-06-06 2019-06-06 Website conversion method and device

Publications (2)

Publication Number Publication Date
CN110365806A true CN110365806A (en) 2019-10-22
CN110365806B CN110365806B (en) 2022-05-10

Family

ID=68216761

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910492561.0A Active CN110365806B (en) 2019-06-06 2019-06-06 Website conversion method and device

Country Status (1)

Country Link
CN (1) CN110365806B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110809048A (en) * 2019-11-08 2020-02-18 腾讯科技(深圳)有限公司 Data transfer method, device and computer readable storage medium
CN112149445A (en) * 2020-10-22 2020-12-29 北京京东振世信息技术有限公司 Bar code processing method, device, equipment and storage medium
CN113612869A (en) * 2021-08-25 2021-11-05 福建凯米网络科技有限公司 Short network address generation method, terminal and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1096385A1 (en) * 1999-10-31 2001-05-02 Institute for the Development of Emerging Architectures, L.L.C. A method and apparatus for forming an entry address
CN103002061A (en) * 2011-09-16 2013-03-27 阿里巴巴集团控股有限公司 Method and device for mutual conversion of long domain names and short domain names
CN104657432A (en) * 2015-01-28 2015-05-27 北京金和软件股份有限公司 Method for reducing repetitive rate of converting long address into short addresses
CN106210161A (en) * 2016-06-24 2016-12-07 中国银联股份有限公司 A kind of short chain delivers a child into method and system
CN106412140A (en) * 2015-08-03 2017-02-15 沈阳东软睿道教育服务有限公司 Short link address generating method and system thereof
CN106548068A (en) * 2016-10-31 2017-03-29 珠海市魅族科技有限公司 Short website information display system and method
CN106708956A (en) * 2016-11-29 2017-05-24 中国人民解放军国防科学技术大学 HTTP (Hyper Text Transport Protocol) data matching method based on multi-URL (Uniform Resource Locator) rule set
CN107135283A (en) * 2017-04-17 2017-09-05 南京欣网互联信息技术有限公司 A kind of Chief Web Officer short chain configuring management method
CN107729409A (en) * 2017-09-26 2018-02-23 中国银联股份有限公司 A kind of short chain delivers a child into method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1096385A1 (en) * 1999-10-31 2001-05-02 Institute for the Development of Emerging Architectures, L.L.C. A method and apparatus for forming an entry address
CN103002061A (en) * 2011-09-16 2013-03-27 阿里巴巴集团控股有限公司 Method and device for mutual conversion of long domain names and short domain names
CN104657432A (en) * 2015-01-28 2015-05-27 北京金和软件股份有限公司 Method for reducing repetitive rate of converting long address into short addresses
CN106412140A (en) * 2015-08-03 2017-02-15 沈阳东软睿道教育服务有限公司 Short link address generating method and system thereof
CN106210161A (en) * 2016-06-24 2016-12-07 中国银联股份有限公司 A kind of short chain delivers a child into method and system
CN106548068A (en) * 2016-10-31 2017-03-29 珠海市魅族科技有限公司 Short website information display system and method
CN106708956A (en) * 2016-11-29 2017-05-24 中国人民解放军国防科学技术大学 HTTP (Hyper Text Transport Protocol) data matching method based on multi-URL (Uniform Resource Locator) rule set
CN107135283A (en) * 2017-04-17 2017-09-05 南京欣网互联信息技术有限公司 A kind of Chief Web Officer short chain configuring management method
CN107729409A (en) * 2017-09-26 2018-02-23 中国银联股份有限公司 A kind of short chain delivers a child into method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郭一华: "短网址服务系统的实现及相关技术研究", 《软件》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110809048A (en) * 2019-11-08 2020-02-18 腾讯科技(深圳)有限公司 Data transfer method, device and computer readable storage medium
CN110809048B (en) * 2019-11-08 2020-12-15 腾讯科技(深圳)有限公司 Data transfer method, device and computer readable storage medium
CN112149445A (en) * 2020-10-22 2020-12-29 北京京东振世信息技术有限公司 Bar code processing method, device, equipment and storage medium
CN113612869A (en) * 2021-08-25 2021-11-05 福建凯米网络科技有限公司 Short network address generation method, terminal and storage medium
CN113612869B (en) * 2021-08-25 2023-12-19 福建凯米网络科技有限公司 Short website generation method, terminal and storage medium

Also Published As

Publication number Publication date
CN110365806B (en) 2022-05-10

Similar Documents

Publication Publication Date Title
EP3748547A1 (en) Super network training method and device
CN110365806A (en) Network address conversion method and device
US10001919B2 (en) Apparatus for providing integrated functions of dial and calculator and method thereof
CN105430625B (en) Communication information transfer method, apparatus and system
CN102970408A (en) Apparatus and method for managing application in wireless terminal
US20120173744A1 (en) Wireless connection method and apparatus using image recognition in mobile communication terminal
EP3001300A1 (en) Method and apparatus for generating preview data
US20150242076A1 (en) Method of editing one or more objects and apparatus for same
KR20150075140A (en) Message control method of electronic apparatus and electronic apparatus thereof
CN110826697B (en) Method and device for acquiring sample, electronic equipment and storage medium
CN106295379A (en) Encrypt input method and device, deciphering input method and device and relevant device
CN105589575B (en) Input method call method and device
US20210133505A1 (en) Method, device, and storage medium for retrieving samples
WO2019204996A1 (en) Interleaving mapping method and interleaving mapping device
CN111767006A (en) Data processing method and device
CN109491655A (en) A kind of incoming event processing method and processing device
CN106664114B (en) Electronic device, the method for controlling electronic device, recording medium and the receiver J-Horner end cap with electronic device intercommunication
CN110545107B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN106407818B (en) Network packet encryption method and device
US20220174650A1 (en) Methods and apparatuses for configuring a control region
CN107535013A (en) A kind of method for processing business and terminal
CN104035763B (en) Word methods of exhibiting, device and terminal
CN113885785B (en) Data deduplication method and device
CN114003542B (en) Signal conditioner, signal conditioning method, electronic device, and storage medium
CN114020505B (en) Data processing method and device, electronic equipment and storage medium

Legal Events

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