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

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

问题描述

我正在研究缩短/加密网址的可能性,使用算法将长度从150到250个字符到最多12个字符。最初我怀疑这是可能的,但我想利用StackOverflow的伟大思想:)

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?

我正在阅读此处,在CFB模式下的AES将会流密码和输出长度将与输入长度相同。有没有办法缩短更多?

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

即使字符串是实际上是一样的长度。使用压缩,您可以减少表达相同含义所需的位数,但只能减少一点。这一点取决于原始消息的信息内容。

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个字符的字符串的信息量很少,可以有效地压缩到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.

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

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