看了个文章,说7z压缩文件损坏后无法恢复。建议使用zip/rar格式

本文探讨了7zip使用的LZMA2压缩算法在文件损坏时的不可恢复性,对比Deflate算法,LZMA2在面对数据错误时更为脆弱,可能导致整个压缩包无法解码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  吾一直使用7zip。后来看文章说,7zip压缩算法,如果文件出现一点错误,很难恢复。这么一说,吾决定以后统一使用zip格式。

  在LINUX上,默认的就是zip/tar,都是zip格式。

  压缩软件使用winZip?winRAR?待吾看看。

 

https://www.zhihu.com/question/23299326/answer/820275787

  关于安全的部分如下:

  The [LZMA2 format] contains an unrestricted mix of LZMA packets and uncompressed data packets. Each packet starts with a header that is not protected by any check sequence in spite of containing the type and size of the following data. Therefore, every bit flip in a LZMA2 header causes either a framing error or a desynchronization of the decoder. In any case it is usually not possible to decode the remaining data in the block or even to know what failed. Compare this with [Deflate] which at least does protect the length field of its non-compressed blocks. (Deflate's compressed blocks do not have a length field).

  我简单解释一下,LZMA2是7z的默认压缩算法,用这种算法压缩文件会产生这么一种情况:

  假如一个普通文件内容是「ABCDEFG」,然後它第二个字节损坏了,我们看到的就是「A?CDEFG」。但如果这是一个使用了LZMA2算法的7z压缩包,我们看到的就是「A??????」。

  Therefore, every bit flip in a LZMA2 header causes either a framing error or a desynchronization of the decoder. In any case it is usually not possible to decode the remaining data in the block or even to know what failed.

  翻译:因此,在LZMA2报头中的每个位翻转都会引起解码器的帧错误或者同步失调。在所有情况下,通常都不可能解码块中的剩余数据,甚至都不知道哪里错了

  最後,这位大佬给出的建议是:不要用LZMA2算法储存重要文件。

  也就是说,如果你坚持使用7z格式,那么你就祈祷吧,祈祷压缩包裡一个字节错误都不要有。因为只要出现一个字节错误,整个压缩包就废了。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

柳鲲鹏

能给阁下一点帮助,非常荣幸

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值