Short address

A short address Introduction

Short address (also called short URL Short the URL of ) is to make a long website links shortened to a short link.

It is the result of short address, because there are word limit, in order to meet short address is the number of words in the microblogging limitations arising from within microblogging. Now most of the micro-blog, mobile e-mail body has a lot of other places the application mode, and occupy a certain market.

 

Second, the short address algorithm theory

A algorithm:

  1, the 32-bit long address generating MD5 signature string, divided into four ends, each 8 bytes;

  2, these four loop processing, takes 8 bytes, which is regarded as a hexadecimal string and 0 * 3FFFFFFF (30 bit 1) operation, i.e., handling more than 30 is ignored;

  3, 30 which is divided into 6 segments, each five-digit number as an index to obtain a particular alphabet character strings sequentially performed to obtain 6;

  4, the overall sequence may be obtained MD5 four 6-bit string, any one of which can be taken as a short length of the URL address of the web site;

Algorithms II:

  az, AZ, 0-9, 62 which takes six combinations, can produce 500 million combinations of orders. The numbers and characters do some combination of the mapping, we can generate a unique character string, such as 62 combinations is aaaaa9, the first composition 63 is aaaaba, reuse shuffling algorithm, the original string storage disrupted, then the corresponding combination position in the string will be a combination of disordered.

  The length of the URL stored in the database, taking returned id, find the corresponding character string, for example, returns the ID 1, then the corresponding character string is a combination of the above BBB, empathy ID is 2, the string combination BBA, and so on may appear after repeated until the repetition may occur after reaching the 64 combinations, so if using the above 62 characters, 6 characters taken arbitrarily combined into a string, the data storage capacity of 500 million.

 

Third, the actual operation

Converting short address does not need to own a little bit to calculate the conversion, the conversion can help to meet short address on the page you want to convert.

More commonly used and easily convert website: https://dwz.cn/

 

 


Reference: https://baike.baidu.com/item/%E7%9F%AD%E5%9C%B0%E5%9D%80/2760921?fr=aladdin

 

Guess you like

Origin www.cnblogs.com/nyw1983/p/12008072.html