任何方式融为一体preSS 256字节"类似MD5"串入160字节还是少了? [英] Any way to compress a 256 bytes "MD5-like" string into 160 bytes or less?

查看:136
本文介绍了任何方式融为一体preSS 256字节"类似MD5"串入160字节还是少了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算送这样的字符串(256字节):

<$p$p><$c$c>633a88d35a0f8fd172bd21158a03a8bb17ddc0acc6edb8ae19a9dbd1aa855b75319e540910fb70cf7bb51d608219dd4b387623f94262705a9c2c19332240e2a6d696d4cb896abf0101afae1aeebf3d6299675e0e67904e7a544de9e3e65fb9def9b0b047fb57a0b742226d602d386d9e2fe176a88837eddd0c77d6911d386c2e

通过利用Android手机短信,内容应该是1消息中。

正如你可能知道,SMS具有的每条消息160字节的限制,我已经在Java中,然后连接code与基地64 COM pressed东西使用gzip尝试过,但在COM pression比例不太好。

由于玉米pressed数据将通过SMS发送,应该有一个编码方法,使玉米pressed字符串透射

任何想法?

感谢您的任何意见/答案!


解决方案

您不能完全做到这一点。其原因是,MD5,如数据最大熵,因此gzip和朋友们将有一个很难获得接近50%的效率,甚至如果他们这么做,它会被击中或错过。

最佳2:1玉米pression是:每2个字符对待为十六进制字节,并将其转换成一个二进制字符。这将削减规模下降为1/2。然而,二进制数据不能被发送,所以你必须为Base64 EN code它,导致33%的增幅。这使您〜170个字符。 基地-128编码没有帮助,因为没有128个字符是一定的传输。

总之,你需要削减的数据了。毕竟,送少数据最简单的方法就是少数据:)

I intend to send such a string (256bytes):

633a88d35a0f8fd172bd21158a03a8bb17ddc0acc6edb8ae19a9dbd1aa855b75319e540910fb70cf7bb51d608219dd4b387623f94262705a9c2c19332240e2a6d696d4cb896abf0101afae1aeebf3d6299675e0e67904e7a544de9e3e65fb9def9b0b047fb57a0b742226d602d386d9e2fe176a88837eddd0c77d6911d386c2e

via SMS through android, and the content should be within 1 message.

As you may know, the SMS has a limit of 160 bytes per message, I have tried using gzip in Java and then encode the compressed stuff with Base 64, but the compression ratio is not quite good.

Since the compressed data will be sent via SMS, there should be a encoding method to make the compressed string "transmittable".

Any ideas?

Thank you for any comments/answers!

解决方案

You can't quite do it. The reason is that MD5-like data maximized entropy, and so gzip and friends will have a hard time getting close to 50% efficiency, and even if they did, it would be hit or miss.

The optimal 2:1 compression is: Treat every 2 chars as a byte in hex, and convert it into a binary char. That will cut the size down to 1/2. However, the binary data can't be sent, so you have to base64 encode it, leading to 33% increase. That leaves you at ~170 chars. "Base-128" encoding won't help, since there aren't 128 chars that are certain to transmit.

In short, you need to cut the data down. After all, the easiest way to send less data is to have less data :)

这篇关于任何方式融为一体preSS 256字节&QUOT;类似MD5&QUOT;串入160字节还是少了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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