如何缩短URL中的数学方法 [英] how to shorten the url in a mathematical approach

查看:231
本文介绍了如何缩短URL中的数学方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待到缩短/加密,这将是使用一种算法长度150至250个字符至最大12字符的URL的可能性。最初,我怀疑这是可能的,但我想利用计算器的伟大人物:)

I am looking into the possibility of shortening / encrypting a url which will be from 150 to 250 characters in length to maximum 12 characters using an algorithm. Initially I am doubting it's possible but I wanted to leverage the great minds of StackOverflow :)

算法应该是一个可以在传统的ASP,SQL,C#,VB编写,或FOXPRO或其他语言。

the algorithm should be one that can be written in classic asp, sql, c#, vb, or foxpro or other language.

是,即使可能没有数据库为中心的方法?

Is that even possible without a database centric approach?

我读<一个href=\"http://stackoverflow.com/questions/985830/how-do-i-encrypt-a-string-and-get-a-equal-length-encrypted-string\">here该AES在CFB模式,将做一个流加密和输出长度将是相同的作为输入的长度。有什么办法缩短它更?

I was reading here that AES in CFB mode, will do a stream cipher and the output length will be the same as the input length. Is there any way to shorten it even more?

推荐答案

答案,一如既往,是看情况。有这么谈论一组数据的信息含量一个数学理论。如果你的数据是原来的字符串是这样的:

The answer, as always, is "it depends". There's a mathematical theory that talks about the "information content" of a bunch of data. If your data is originally strings like this:

lleAgByD2rREjzqj85g68207NsjspdINfPRNvU9udgWw7y4qXh0EQLSy0yEi2

则信息含量远远大于如果你的字符串是这样的:

then the information content is much greater than if your strings look like this:

one zero one one zero one zero zero one zero one one zero one

即使串实际上是相同的长度。使用COM pression,可以减少必要的前preSS的相同的含义的比特数,但只下降到一个点。这点取决于原始邮件的信息内容。

even though the strings are actually the same length. Using compression, you can reduce the number of bits necessary to express the same meaning, but only down to a point. That point depends on the information content of the original message.

这似乎不太可能,我认为你的150至250个字符的字符串有可能是有效的COM pressed下降到12个字符这么少的信息内容。可能必须在较长的数据存储在数据库中,并分配较短的钥匙的每个数据项

It seems unlikely to me that your string of 150 to 250 characters has so little information content that it could be effectively compressed down to 12 characters. You may have to store the longer data in the database and assign a shorter "key" to each data item.

有关进一步的阅读,一个地方开始是在信息论维基百科的文章。

For further reading, one place to start is the Wikipedia article on Information theory.

这篇关于如何缩短URL中的数学方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆