加密消息然后压缩它还是相反?哪个更安全? [英] Is it better to encrypt a message and then compress it or the other way around? Which provides more security?

查看:23
本文介绍了加密消息然后压缩它还是相反?哪个更安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我假设根本没有额外的保护.

I have the assumption there is no added protection at all.

推荐答案

所提供的安全性没有区别,但由于压缩算法的工作方式,如果先压缩再加密,您可能会获得更好的压缩效果.

There is no difference in the security provided, but because of the way compression algorithms work, you are probably going to get better compression if you compress first then encrypt.

压缩算法利用数据中的统计冗余(例如存在于自然语言或许多文件格式中的冗余),这些冗余在您加密时,因此加密消息应该't 能够压缩得那么好.

Compression algorithms exploit statistical redundancies (such as those that exist in natural language or in many file formats) in the data which should be eliminated when you encrypt it, therefore an encrypted message shouldn't be able to be compressed all that well.

来自维基百科文章:

然而,无损数据压缩算法总是无法压缩某些文件;事实上,任何压缩算法都必然无法压缩任何不包含可辨别模式的数据.因此,尝试压缩已经压缩过的数据通常会导致扩展,就像尝试压缩除最简单加密的数据之外的所有数据一样.

However, lossless data compression algorithms will always fail to compress some files; indeed, any compression algorithm will necessarily fail to compress any data containing no discernible patterns. Attempts to compress data that has been compressed already will therefore usually result in an expansion, as will attempts to compress all but the most trivially encrypted data.

这篇关于加密消息然后压缩它还是相反?哪个更安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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