Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zip adds zstd compression algorithm support #181

Merged
merged 10 commits into from
Jul 21, 2020
Merged

zip adds zstd compression algorithm support #181

merged 10 commits into from
Jul 21, 2020

Conversation

fcharlie
Copy link
Contributor

Recently, the zip specification file added 93 as the magic number of the zstd algorithm (initially 20, but WinZip used 93 and later changed to 93). This PR mainly implements support for zstd. This PR may not be tested enough, but I Here, unzipping the zip(zstd) file is successful.

It should be noted that this version does not implement support for compression levels, and may require some minor adjustments.

zip(zstd) related:

mcmilk/7-Zip-zstd#132
mholt/archiver#223
zlib-ng/minizip-ng#498

@ipaucek4680 If you are interested, you can try it.

@fcharlie fcharlie marked this pull request as ready for review June 20, 2020 12:22
@ghost
Copy link

ghost commented Jun 20, 2020

I can confirm that extraction of Zstd ZIP file (created by WinZip) is working.

For compression/modification, I guess src/ziptool.c may need to be edited as well? (Reference: a91b3c4 and cc5b86f)

We may also need to set the "version needed to extract".
Although the latest APPNOTE Section 4.4.3.2 does not state the minimum feature version for Zstd, it should be 6.3 (Zstd is added to the specification in revision 6.3.7).
However, it looks like WinZip just sets the version needed to extract to 20 (i.e. 2.0) for Zstd ZIP.

@fcharlie
Copy link
Contributor Author

@ipaucek4680 I’m not sure which value version_needed should be set to, I didn’t install WinZip

@ghost
Copy link

ghost commented Jun 20, 2020

This is a test file created by WinZip:
test-zstd.zip

If you run 7z l -slt test-zstd.zip, you should see something like:

Path = DOC/README.md
Folder = -
Size = 6837
Packed Size = 2435
Modified = 2020-05-30 11:57:14
Created = 2020-05-30 15:53:32
Accessed = 2020-05-30 12:39:49
Attributes = 
Encrypted = -
Comment = 
CRC = 9EF8FDFF
Method = 93
Host OS = FAT
Version = 20
Volume Index = 0

So I believe that Version = 20 indicates that WinZip sets version_needed to 2.0.

@fcharlie
Copy link
Contributor Author

@ipaucek4680 already updated

@ghost
Copy link

ghost commented Jun 20, 2020

Thanks.

I noticed that this repository contains a copy of the APPNOTE.txt, but section 1.4.2 states that "any reproduction or distribution of this document in whole or in part without prior written permission from PKWARE is strictly prohibited"......

@fcharlie
Copy link
Contributor Author

@ipaucek4680 APPNOTE.txt already existed before. Is it necessary to reauthorize to update APPNOTE.txt? I am not very clear about this. If there is a problem, I will withdraw the APPNOTE.txt update.

@fcharlie
Copy link
Contributor Author

@ipaucek4680 I have undo the update of appnote.txt

@ghost
Copy link

ghost commented Jun 20, 2020

Well, according to the Git history, the file is added in 2004 (16 years ago) and the commit messages do not say whether the developers were authorized to maintain a copy of it in the repo......

@0-wiz-0
Any thoughts?

@fcharlie
Copy link
Contributor Author

fcharlie commented Jul 5, 2020

@0-wiz-0

@0-wiz-0 0-wiz-0 merged commit ddd6fdb into nih-at:master Jul 21, 2020
@0-wiz-0
Copy link
Member

0-wiz-0 commented Jul 21, 2020

Thank you! We cleaned it up and merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants