天天看點

看了個文章,說7z壓縮檔案損壞後無法恢複。建議使用zip/rar格式

  吾一直使用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格式,那麼你就祈禱吧,祈禱壓縮包裡一個位元組錯誤都不要有。因為隻要出現一個位元組錯誤,整個壓縮包就廢了。

繼續閱讀